So konvertieren Sie einen privaten DER-Schlüssel in PEM

So konvertieren Sie einen privaten DER-Schlüssel in PEM

Ich habe einen privaten Schlüssel im Binärformat. Ich bin nicht sicher, ob es sich um das DER-Format handelt, aber ich muss ihn in PEM konvertieren.

Ich verwende OpenSSL mit diesem Befehl:

openssl rsa -inform DER -outform PEM -in test.key -out test.key

Aber ich erhalte eine Fehlermeldung:

unable to load Private Key
48044:error:0D0680A8:asn1 encoding routines:asn1_check_tlen:wrong tag:../openssl-1.1.1q/crypto/asn1/tasn_dec.c:1149:
48044:error:0D06C03A:asn1 encoding routines:asn1_d2i_ex_primitive:nested asn1 error:../openssl-1.1.1q/crypto/asn1/tasn_dec.c:713:
48044:error:0D08303A:asn1 encoding routines:asn1_template_noexp_d2i:nested asn1 error:../openssl-1.1.1q/crypto/asn1/tasn_dec.c:646:Field=version, Type=PKCS8_PRIV_KEY_INFO
48044:error:0D0680A8:asn1 encoding routines:asn1_check_tlen:wrong tag:../openssl-1.1.1q/crypto/asn1/tasn_dec.c:1149:
48044:error:0D06C03A:asn1 encoding routines:asn1_d2i_ex_primitive:nested asn1 error:../openssl-1.1.1q/crypto/asn1/tasn_dec.c:713:
48044:error:0D08303A:asn1 encoding routines:asn1_template_noexp_d2i:nested asn1 error:../openssl-1.1.1q/crypto/asn1/tasn_dec.c:646:Field=version, Type=RSAPrivateKey
48044:error:04093004:rsa routines:old_rsa_priv_decode:RSA lib:../openssl-1.1.1q/crypto/rsa/rsa_ameth.c:142:
48044:error:0D0680A8:asn1 encoding routines:asn1_check_tlen:wrong tag:../openssl-1.1.1q/crypto/asn1/tasn_dec.c:1149:
48044:error:0D06C03A:asn1 encoding routines:asn1_d2i_ex_primitive:nested asn1 error:../openssl-1.1.1q/crypto/asn1/tasn_dec.c:713:
48044:error:0D08303A:asn1 encoding routines:asn1_template_noexp_d2i:nested asn1 error:../openssl-1.1.1q/crypto/asn1/tasn_dec.c:646:Field=version, Type=PKCS8_PRIV_KEY_INFO

Wie kann ich einen PEM-Schlüssel erhalten? Ist es möglich, dass es kein DER-Schlüssel ist?

verwandte Informationen