0

I have DER private key and certificate. I need to convert them to PEM format. Certificate converted normally, but when i try to convert key this error happens:

# openssl x509 -in client-key.der -inform DER -out private.pem -outform PEM
unable to load certificate
3077748360:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1319:
3077748360:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:381:Type=X509_CINF
3077748360:error:0D08303A:asn1 encoding routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 error:tasn_dec.c:751:Field=cert_info, Type=X509

What am i doing wrong? client-key.der is in binary format and has been used in JAVA application, now i need to use it in my C aplication

PersianGulf
  • 602
  • 8
  • 21
Timur
  • 103
  • 1
  • 3

1 Answers1

3

Notice it says "unable to load certificate". The x509 command is for X509 structures, not private keys! Try the rsa command.

David Schwartz
  • 31,449
  • 2
  • 55
  • 84