使用 aes 加密密钥运行 openssl s_client 失败

信息安全 tls openssl 密钥生成
2021-08-31 14:33:30

我正在尝试使用openssl s_client命令验证 2 路 SSL 连接

openssl s_client -connect localhost:8883 -CAfile ca.pem -cert client.crt -key client.key

openssl s_client失败并出现以下错误

openssl s_client -connect localhost:8883 -CAfile ca.pem -cert client.crt -key c.key Enter pass phrase for client.key: unable to load client certificate private key file 140289846519624:error:0D07207B:asn1 encoding routines:ASN1_get_object:header too long:asn1_lib.c:150: 140289846519624:error:0D068066:asn1 encoding routines:ASN1_CHECK_TLEN:bad object header:tasn_dec.c:1306: 140289846519624:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:381:Type=RSA 140289846519624:error:04093004:rsa routines:OLD_RSA_PRIV_DECODE:RSA lib:rsa_ameth.c:115: 140289846519624:error:0D07207B:asn1 encoding routines:ASN1_get_object:header too long:asn1_lib.c:150: 140289846519624:error:0D068066:asn1 encoding routines:ASN1_CHECK_TLEN:bad object header:tasn_dec.c:1306: 140289846519624:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:381:Type=PKCS8_PRIV_KEY_INFO 140289846519624:error:0907B00D:PEM routines:PEM_READ_BIO_PRIVATEKEY:ASN1 lib:pem_pkey.c:132:

客户端私钥是使用以下命令生成的

openssl genrsa -aes256 -out client.key 2048

如果我尝试解析它,我会得到以下信息

openssl asn1parse < client.key

我明白了

Error in encoding 140030324189000:error:0D07207B:asn1 encoding routines:ASN1_get_object:header too long:asn1_lib.c:150:

当我生成密钥而不传递-aes256选项时,这确实有效。

我怎样才能让它与使用 aes 或 des 加密的密钥一起工作?

0个回答
没有发现任何回复~