DER 개인 키를 PEM으로 변환하는 방법

DER 개인 키를 PEM으로 변환하는 방법

바이너리 형식의 개인 키가 있습니다. 이것이 DER 형식인지는 확실하지 않지만 PEM으로 변환해야 합니다.

다음 명령으로 openssl을 사용하고 있습니다.

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

하지만 오류가 발생합니다.

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

PEM 키를 어떻게 얻을 수 있나요? DER 키가 아닐 수도 있습니까?

관련 정보