54

I was trying to create a SSL certificate to use with MySQL as like mentioned here : http://dev.mysql.com/doc/refman/5.5/en/creating-ssl-certs.html

While verifying the certificates I got the following error

  # openssl verify -CAfile ca-cert.pem server-cert.pem client-cert.pem
    server-cert.pem: C = IN, ST = KERALA, L = COCHIN, O = ABCD, OU = OPERATIONAL, CN = SATHISH, emailAddress = [email protected]
    error 18 at 0 depth lookup:self signed certificate
    OK
    client-cert.pem: C = IN, ST = KERALA, L = COCHIN, O = ABCD, OU = OPERATIONAL, CN = sathish, emailAddress = [email protected]
    error 18 at 0 depth lookup:self signed certificate
    OK

Could someone help me on generating keys without any errors based on the document in the above link.

2

2 Answers 2

184

I think you missed this part of the instructions:

Whatever method you use to generate the certificate and key files, the Common Name value used for the server and client certificates/keys must each differ from the Common Name value used for the CA certificate. Otherwise, the certificate and key files will not work for servers compiled using OpenSSL.

When OpenSSL prompts you for the Common Name for each certificate, use different names.

2
  • 3
    I had the same issue: after you enter some values for the Distinguished Name you can enter the value for the Common Name.
    – Cerveser
    Feb 11, 2014 at 20:54
  • 2
    I have the same issue when generated ca.pem and client.pem with the same CN, thanks u!
    – itlux
    Jun 29, 2021 at 14:07
4

When you use openssl command that creates the certificates and keys, it will ask you to fill some fields, and you will come across Common Name option like following:

Common Name (e.g. server FQDN or YOUR name) []: 

In this case you need to provide a different name each time and not to let it use the default value.

For example:

CA Cert: app-ca-cert.

Server Cert: app-server-cert.

Client Cert: app-client-cert.

As the guide explained

Important

Whatever method you use to generate the certificate and key files, the Common Name value used for the server and client certificates/keys must each differ from the Common Name value used for the CA certificate. Otherwise, the certificate and key files do not work for servers compiled using OpenSSL.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.