Converting .cer to .pem returns error ‘unable to load certificate’

certificatesslssl-certificate

I got an email containing a cert, it looked something like:

—–BEGIN CERTIFICATE—–

MIIHE…

—–END CERTIFICATE—–

I copy/pasted that into notepad and saved it as a .cer file.

What I need now is a .pfx file using this cert. From what I gather I need to first convert my .cer to a .pem.

I tried converting my .cer to a .pem but that only gave error:

OpenSSL> x509 -inform der -in
C:\Users\xxx\Desktop\cert.cer -out certificate.pem

unable to load certificate 7320:error:0D0680A8:asn1 encoding
routines:ASN1_CHECK_TLEN:wrong tag:.\crypto\asn1\tasn_dec.c:1315:
7320:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested
asn1 error:.\crypto\asn1\tasn_dec.c:379:Type=X509

I read some answers that also say just changing .cer to .pem is enough, but for me that does not seem to work at all.

Best Answer

Your certificate is already in PEM format. Just rename it from certificate.cer to certificate.pem

Related Topic