Robert H. Hollar, Jr.


Fixing It
Go
Converting Certificates From .cer To .crt
November 25, 2015
Robert H. Hollar, Jr.

Last night I was trying to install a new SSL certificate that I bought for one of my website and was unable to do so because the certificate I received from the certificate authority was in the wrong format. They gave me a certificate with a .cer file extension and I needed it to be a .crt.

I did some digging and some people were saying that there isn’t a difference between the two file types and to just change the file extension and it should work. I gave it a shot but it still wasn’t working. It turns out that there is a difference, .cer files are an X.509 certificate in binary form that is DER encoded where .crt files are X.509 certificate in binary form that is base-64

By searching for a proper way to convert the certificate I came across a tool that people were saying would do the trick; OpenSSL. So I decided to give this a shot.

After download and unzipping OpenSSL, I opened my command prompt:

  1. Click Start, type Run, then hit ENTER.
  2. Type CMD, then hit ENTER.
  3. I then changed to the directory where I extracted the OpenSSL zip file’s bin. In my case that was
    cd C:\openssl-0.9.8h-1-bin\bin
  4. The command that changes the file format is
    openssl pkcs7 -print_certs -in certificate.cer -out certificate.crt’
  5. Make sure to change the certificate.cer and certificate.crt file path so that it matches where the certificate actually is and where you want to put the new .crt file.
  6. After you’ve done that hit ENTER.

Hopefully you’ve now successfully converted your .cer certificate to a .crt. After I did the conversion myself, I was able to load the new .crt file onto my hosting site without any further problem.

References


Keywords

Converting, CRT, CER, Certificate, SSL