Linux and Windows Support  

make-it-great-again

Login or Register  

If you wish to contribute an article, please login or register.

Convert SSL certificate from CRT format to PEM

PrintE-mail

Q. Ubuntu 8.04 is setup by default to accept PEM certificates instead of CRT, is there any way to convert it?

A. You can convert the SSL certificates using the following commands:

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

and:

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

Once done, you will get something like that:

-----BEGIN CERTIFICATE-----
MIIBuzCCASQCCQDsmQaV8xWXCDANBgkqhkiG9w0BAQUFADAiMQswCQYDVQQGEwJH
QjETMBEGA1UECBMKU29tZS1TdGF0ZTAeFw0wNzEyMTIxMzQ5MzdaFw0wODEyMTEx
MzQ5MzdaMCIxCzAJBgNVBAYTAkdCMRMwEQYDVQQIEwpTb21lLVN0YXRlMIGfMA0G
CSqGSIb3DQEBAQUAA4GNADCBiQKBgQDgJFB3Utxl1XfoTJXnAL2GZLB3GkIanAGL
e/nUwri4mqkZN1TvpmzbvedBs2V/c74QlQ8PzL+qQyTqSJRkCWtX1r0VHPzF7ISW
dWBmIofjeXFrC22OVz1I3l1l2+l35WawPcnamPK6jc1aUa6G9RznbZLTZS1i9y2e
21akhSwMdwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAACMwVMqKy7nD31VvOUMCKsa
BNJnWrslrvvmUmon9TBupYYs/7xs8nlhyDKPrh1jzx+mp+7MWSQ6wYiLSUucs3IE
D9lMz43qxQehHpmMuzPi/fFX6u1lVLwu7J42w1QNdEDv4HyiJ01JPD6tZD4VY0BY
KFF0GIYgMVpGgxGmxRTp
-----END CERTIFICATE-----

You should add your private key at the top, so the file looks like this:

-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQDgJFB3Utxl1XfoTJXnAL2GZLB3GkIanAGLe/nUwri4mqkZN1Tv
pmzbvedBs2V/c74QlQ8PzL+qQyTqSJRkCWtX1r0VHPzF7ISWdWBmIofjeXFrC22O
Vz1I3l1l2+l35WawPcnamPK6jc1aUa6G9RznbZLTZS1i9y2e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9lMz43qxQehHpmMuzPi/fFX6u1lVLwu7J42w1QNdEDv4HyiJ01JPD6tZD4VY0BY
KFF0GIYgMVpGgxGmxRTp
-----END CERTIFICATE-----

Replace apache.pem with that file and restart apache.

 

Add your comment

Your name:
Subject:
Comment:
  The word for verification. Lowercase letters only with no spaces.
Word verification:
yvComment v.1.24.0
   
Copyright © 1999 - 2017 Virtual Helpme | t | Original Template: Allrounder