I need to extract the private key from a .DER
file, however analyzing the openssl_pkey_get_private I have identified that it is necessary to pass as a parameter a file with the .PEM
extension.
I tried to see the contents of the certificate using the following command:
openssl x509 -in certificate.der -inform der -text -noout
However, the following error occurred:
unable to load certificate
Error: 0D0680A8: asn1 encoding routines: asn1_check_tlen: wrong tag: ../ crypto / asn1 / tasn_dec.c: 1112: 140492645532928: error: 0D07803A: asn1 encoding routines: asn1_item_embed_d2i: nested asn1 error: ../ crypto / asn1 / tasn_dec.c: 274: Type = X509_CINF 140492645532928: error: 0D08303A: asn1 encoding routines: asn1_template_noexp_d2i: nested asn1 error: ../ crypto / asn1 / tasn_dec.c: 609: Field = cert_info, Type = X509
I tried to convert from .DEM
format to .PEM
format using the following command, however I need a file with the format .CRT
that I do not have:
openssl x509 -in certificate.crt -inform der -outform pem -out cert.pem
Is it possible to extract the private key of a file with the .DER
?