[英]Get private key from PEM
PEM file content.I have the passphrase of PEM file as well. PEM文件内容。我也有PEM文件的密码。
*Bag Attributes
localKeyID: 12 7B 3C 4C ...
subject=/C..OTHER FIELDS
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
Bag Attributes
localKeyID: 12 7B 3C 4C ..
Key Attributes: <No Attributes>
-----BEGIN ENCRYPTED PRIVATE KEY-----
...
-----END ENCRYPTED PRIVATE KEY-----*
I am able to extract certificate from PEM file with command. 我可以使用命令从PEM文件中提取证书。
openssl x509 -outform der -in client.pem -out your-cert.crt
But I am not able to extract private key.Tried below listed commands. 但是我无法提取私钥。请在下面列出的命令中删除。 OpenSSL hangs for both the commands. OpenSSL挂起两个命令。 Am I missing something obvious here ? 我错过了一些明显的东西吗?
openssl pkey -in client.pem -out key.pem
I need to extract client cert and key file to create SSLSocketFactory
object in java. 我需要提取客户端证书和密钥文件以在java中创建SSLSocketFactory
对象。
I assumed commandline will prompt for entering the passphrase but it needs to be provided argument 我假设命令行会提示输入密码,但需要提供参数
-passin file:passphrase.txt -passin文件:passphrase.txt
openssl pkey -inform PEM -outform DER -in client.pem -passin file:passphrase.txt -out key.pem openssl pkey -inform PEM -outform DER -in client.pem -passin file:passphrase.txt -out key.pem
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.