TransWikia.com

How to resolve "SSLV3_ALERT_BAD_CERTIFICATE" error in Spring Boot

Stack Overflow Asked by Pale Blue Dot on January 1, 2022

I have the following rest end point exposed protected by SSL (Spring Boot)

@RestController
public class TestController {
    @RequestMapping(value = "/data", method = RequestMethod.GET)
    public String getData() {
        
        return "Hello World";
    }

In YML I have the following properties

server:
  ssl:
    enabled: true
    client-auth: need
    key-store: {keystore-path}
    key-store-password: {keystore-password}
    key-alias: alias-name
    key-store-type: JKS
    

Now I am trying to call the above rest end point from another app with the following code

URL obj = new URL(GET_URL);
        HttpURLConnection con = (HttpURLConnection) obj.openConnection();
        con.setRequestMethod("GET");
        int responseCode = con.getResponseCode();
        System.out.println("GET Response Code :: " + responseCode);

But I am getting the following error :

Error: write EPROTO 2771201016:error:10000410:SSL routines:OPENSSL_internal:SSLV3_ALERT_BAD_CERTIFICATE:../../third_party/boringssl/src/ssl/tls_record.cc:587:SSL alert number 42`

How to resolve this error?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP