Green_qaue
Green_qaue

Reputation: 3661

converting .cer to .pem returns error 'unable to load 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.

Upvotes: 3

Views: 17135

Answers (1)

Jitrenka
Jitrenka

Reputation: 305

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

Upvotes: 8

Related Questions