Mozekoze

Mozekoze

Wow, a blog..How original

Mozekoze RSS Feed
 
 
 
 

Converting SSL-certificates from CRT format to PEM

Dovecot, for example, seems to expect pem-files, while RapidSSL only issues crt-files. The solution? Use OpenSSL to convert (via the DER-format) to pem:

openssl x509 -in input.crt -out input.der -outform DER

then

openssl x509 -in input.der -inform DER -out output.pem -outform PEM

9 Responses to “Converting SSL-certificates from CRT format to PEM”

  1. 1
    Mike Hall:

    Thanks, your steps also worked for Network Solution’s CRT files.

  2. 2
    James:

    Tried this on a GoDaddy certificate. The first command worked, but the second one returned:

    unable to load certificate
    12085:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:650:Expecting: TRUSTED CERTIFICATE

    (OpenSSL 0.9.8k)

  3. 3
    admin:

    Hi James,

    This seems to imply that the file you use for input does not
    contain a “—–BEGIN CERTIFICATE—–”-line, which means
    the previous command didn’t work or that your syntax is
    incorrect. Could you paste the exact commands that you ran and what your original filenames were?

  4. 4
    ppsk8358:

    Thanks for your help. It function now….

  5. 5
    Leandro:

    CRT is just a common extension, but the format is PEM in both cases. For a prove of that just take a CRT certificate, apply the commands listed above and compare the resultant file with the original. You will see that they are exactly the same.

  6. 6
    piri:

    Leandro, that’s not necessarily true. Some CRT files might even use DER format

  7. 7
    Jamie:

    Many thanks

  8. 8
    Twirrim:

    Thanks for the blog. Not sure that you need to do this in two stages though?

    Just specifying “-outform PEM” in the first command created an identical file to doing it in two stages.

  9. 9
    Brad Landis:

    It outputs to the same file for me, at least when following @Twirrim’s instructions, but it still works.

Leave a Reply