Forum Discussion

Osama_Ibrahim_M's avatar
Osama_Ibrahim_M
Icon for Nimbostratus rankNimbostratus
Apr 16, 2019

SSL Certification Import

Dears, am trying to import new SSL certificate, but am getting below error, please your support.

 

01070712:3: unable to validate certificate, invalid x509 file (/Common/WC_2019.crt).

 

thanks in advance,

 

3 Replies

  • Are you sure this is a PEM certificate in the first place?

     

    Please, try this:

     

    $ file WC_2019.crt

     

    If it is a PEM certificate, you should see something similar to this:

     

    $ file client.crt client.crt: PEM certificate

     

    In case you confirm this is indeed a PEM encoded certificate, please check for extra space characters as this could be a badly formatted certificate.

     

    This is how my client.crt looks like (just to give you an idea):

     

    $ cat client.crt -----BEGIN CERTIFICATE----- MIID+jCCAeICAQEwDQYJKoZIhvcNAQEFBQAwgYIxCzAJBgNVBAYTAlVLMQ8wDQYD VQQIDAZTdXJyZXkxETAPBgNVBAcMCENoZXJ0c2V5MRQwEgYDVQQKDAtGNSBOZXR3 b3JrczELMAkGA1UECwwCRVMxEDAOBgNVBAMMB2x0bXJvb3QxGjAYBgkqhkiG9w0B CQEWC3Jvb3RAZjUuY29tMB4XDTE2MDgxMTE0NTAxMFoXDTE4MDgxMTE0NTAxMFow gYYxCzAJBgNVBAYTAlVLMQ8wDQYDVQQIDAZTdXJyZXkxGTAXBgNVBAcMEFdhbHRv bi1vbi1UaGFtZXMxDTALBgNVBAoMBFVGUEIxFzAVBgNVBAMMDnJvZHJpZ28tdWJ1 bnR1MSMwIQYJKoZIhvcNAQkBFhRkaWdvZmFyaWFzQGdtYWlsLmNvbTCBnzANBgkq hkiG9w0BAQEFAAOBjQAwgYkCgYEAwET8toIc6pF2m7+8KGTZjMfS8OQjT0QJ8/6F ZN2QKOHxQYF89noy+tczblwdIHlLn5FoDpooptyuqoM/7pFXwiPad/Yknm1AEpzO cggX8M3fx/yA5diwkc1pRmaHP3yt3zGDOpDbLQ87MxR+fOkUK4QVL3YFYXT6W4kY RgTKmc0CAwEAATANBgkqhkiG9w0BAQUFAAOCAgEAnp9If3iUyIRCex0zBzEm2KEc BQJV/7kanyBImwp1KrmYhTvevDPoY6XgybxuCpkfUJnrN5M2X7x/GxS0v2QdLud9 6ckhscpx0ZKrolT5e8Oj8czfyaTEEW9hD9ZdJhK5QTAOynIj4JeibU09sZp8Mm0I bZp4dHfCTlJdN3RqbR1JKZJNqXNtJBy24QdjiNScGsCL6+xkHlbj/CbJlZQnocDd hbYStB8KICjuyPmyQ+mU6mbmq+7QgcNx9uTCTxeV+JhwwwGB9rCZOT4agsViHflG w9PcYue3TOghrH70F2f2RXzlO3L/HDm63T2WN2PA2YENUkajPthWmhITG1upAMWD ahG97yjXdBOVMtCbHudWiEvKVdjidoIpoT/+2XzgkxISUWyqnE9ysPSc5k2K9c7c cSKDN+zR8h9xHe1w83q7fcsRWpAmquMP59dVdVrON9EVMcjiFPLohw6T0roA9doT eio8eeeePi2fIW2I6U54FmnqGrLCud5XFC7zgVGI85uZYjHy4/mJ1R8J/fYjv7Ss TFTRsQBQLfpW45itPWAyfWsAFL6Tx qH5x0pXJZiH4WEzhWRx8DOCRnuXQCBZ7ds/3HXICCi4LhectzI4rJUSCEcuGEv6A K7Jk/nGV7x7ojGX1mHw= -----END CERTIFICATE-----

     

  • Guessing the certificate is not a valid x509 file. You may find the format is incorrect i.e. you have a DER encoded certificate and so need to convert to a PEM (none encoded certificate).

    If you open the certificate file in a text editor should start with something like

    -----BEGIN CERTIFICATE-----
    if not and you know it is a valid certificate it will be the format.

    You can use

    openssl
    to do this:

    openssl x509 -in cert.crt -inform der -outform pem -out cert.pem
    
  • Taking Rodrigo's suggestion, I noticed that my certificate had blank lines between the text. I removed them, and it is working now.