Trusted SSL certificate showing as self signed

Tags: , , ,



I have a trusted TLS certificate deliverd by DigiCert that I’m trying to use in a java/spring application exposing rest apis.

I created a .p12 file with openssl doing the following : openssl pkcs12 -export -in mycertificate.cer -certfile mycertificate_INTERMEDIATE.cer -inkey myprivate_key.key -out myCert.p12

I am able to use this file in my application to access the app through https with the following configuration (application.properties) :

server.port:8443
server.ssl.key-store-type=PKCS12
server.ssl.key-store=classpath:myCert.p12
server.ssl.key-store-password=mypass

However when accessing my app (through postman for example on https://localhost:8443/api/auth) I have an error indicating that I am using a self signed certificate.

My understanding is that since I am using a trusted certificate I shouldn’t have this error message.

Am I missing something when creating the .p12 file that I am using in my app or am I wrong in my assumption ?

Answer

You should not access URL using localhost (definitely you have not provided CN as localhost).

Please access using the same hostname what you have provided as CN parameter when you were generating the certificate.



Source: stackoverflow