How can I create a PEM file from an SSL certificate?
These are the files that I have available:
.crt
server.csr
server.key
How can I create a PEM file from an SSL certificate?
These are the files that I have available:
.crt
server.csr
server.key
Additionally, if you don't want it to ask for a passphrase, then need to run the following command:
What I have observed is: if you use openssl to generate certificates, it captures both the text part and the base64 certificate part in the crt file. The strict pem format says (wiki definition) that the file should start and end with BEGIN and END.
So for some libraries (I encountered this in java) that expect strict pem format, the generated crt would fail the validation as an 'invalid pem format'.
Even if you copy or grep the lines with BEGIN/END CERTIFICATE, and paste it in a cert.pem file, it should work.
Here is what I do, not very clean, but works for me, basically it filters the text starting from BEGIN line:
Your keys may already be in PEM format, but just named with .crt or .key.
If the file's content begins with
-----BEGIN
and you can read it in a text editor:The file uses base64, which is readable in ASCII, not binary format. The certificate is already in PEM format. Just change the extension to .pem.
If the file is in binary:
For the server.crt, you would use
For server.key, use
openssl rsa
in place ofopenssl x509
.The server.key is likely your private key, and the .crt file is the returned, signed, x509 certificate.
If this is for a Web server and you cannot specify loading a separate private and public key:
You may need to concatenate the two files. For this use:
I would recommend naming files with "includesprivatekey" to help you manage the permissions you keep with this file.
Run below commands:
a)
openssl pkcs12 -in Certificates.p12 -out CertificateName.pem -nodes
,b)
openssl pkcs12 -in Certificates.p12 -out pushcert.pem -nodes -clcerts
I needed to do this for an AWS ELB. After getting beaten up by the dialog many times, finally this is what worked for me:
Thanks NCZ
Edit: As @floatingrock says
With AWS, don't forget to prepend the filename with
file://
. So it'll look like:http://docs.aws.amazon.com/cli/latest/reference/iam/upload-server-certificate.html
Trying to upload a GoDaddy certificate to AWS I failed several times, but in the end it was pretty simple. No need to convert anything to .pem. You just have to be sure to include the GoDaddy bundle certificate in the chain parameter, e.g.
And to delete your previous failed upload you can do