5

I've been trying to use openssl to convert a .crt certificate to a .pem

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

After using that command, I get

unable to load certificate
1760:error:0906D06C:PEM routines:PEM_read_bio:no start line:.\crypto\pem\pem_lib.c:703:Expecting: TRUSTED CERTIFICATE

I've tried following https://support.ssl.com/Knowledgebase/Article/View/19/0/der-vs-crt-vs-cer-vs-pem-certificates-and-how-to-convert-them but I'm at a loss and nothing on there is working for me.

Thank you so much for your help,

Brian

user3772004
  • 51
  • 1
  • 1
  • 2
  • `DER` is *Distinguished Encoding Rules*, and its also known as `ASN.1` encoding. `PEM` is *Privacy Enhanced Mail* and uses `----- BEGIN CERTIFICATE -----` and friends. `CRT` is just a file extension used on occasion, and I've seen it used with both `DER` and `PEM` encoded objects. Use `-inform DER` and `-outform PEM`. – jww Jun 24 '14 at 16:11
  • 1
    This question appears to be off-topic because it is not about programming. Perhaps [Super User](http://superuser.com/) would be a better place to ask. – jww Jun 24 '14 at 16:12
  • 1
    @jww I tried typing in `openssl.exe x509 -in server.crt -out openssl.pem -inform der -outform pem` And I ended up getting a different error `unable to load certificate 8764:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:.\crypto\asn1\tasn_dec.c:1319: 8764:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:.\crypto\asn1\tasn_dec.c:381:Type=X509` – user3772004 Jun 24 '14 at 16:38
  • When you look at the certificate under a text editor, is it ASCII text or is it unreadable binary? And are you sure you have a certificate (versus a key)? – jww Jun 24 '14 at 18:29

1 Answers1

7

may the following post well be helpful for others: How to get .pem file from .key and .crt files?

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

aabdan
  • 111
  • 2
  • 5