Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Openssl : error "self signed certificate in certificate chain"

When I used openssl APIs to validate server certificate (self signed), I got following error :

error 19 at 1 depth lookup:self signed certificate in certificate chain

As per openssl documentation, this error (19) is

"X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: self signed certificate in certificate chain - the certificate chain could be built up using the untrusted certificates but the root could not be found locally."

Why this error occurs ? Any problems with my server certificate ?

like image 687
Lunar Mushrooms Avatar asked Aug 29 '12 14:08

Lunar Mushrooms


People also ask

How do I fix SSL error self-signed certificate in certificate chain in Postman?

If certificate verification fails when sending a request, Postman displays an error message in the response pane. To fix the error, turn off SSL verification for the request: Open the request and select the Settings tab. Select Enable SSL certificate verification to turn off this setting.

What does Self_signed_cert_in_chain mean?

The error SELF_SIGNED_CERT_IN_CHAIN means that you have self signed certificate in certificate chain which is basically not trusted by the system.


2 Answers

You have a certificate which is self-signed, so it's non-trusted by default, that's why OpenSSL complains. This warning is actually a good thing, because this scenario might also rise due to a man-in-the-middle attack.

To solve this, you'll need to install it as a trusted server. If it's signed by a non-trusted CA, you'll have to install that CA's certificate as well.

Have a look at this link about installing self-signed certificates.

like image 54
Eitan T Avatar answered Oct 20 '22 22:10

Eitan T


Here is one-liner to verify certificate to be signed by specific CA:

openssl verify -verbose -x509_strict -CAfile ca.pem certificate.pem

This doesn't require to install CA anywhere.

See How does an SSL certificate chain bundle work? for details and correct certificate chain handling.

like image 39
Vadzim Avatar answered Oct 20 '22 23:10

Vadzim