问题原文
原帖链接 · Ayrat · CC BY-SA 3.0
- I extracted certificate using Chrome's SSL/export command.
- Then provided it as input to openvpn - in the config for openvpn:
pkcs12 "path/to/pkcs12_container" - When calling
openvpn ~/openvp_configit asks for a password for private key (wich I entered when exporting using Chrome):
Enter Private Key Password:... - I want to remove this password request.
The question: how to remove the password for private key from pkcs12?
That is, create pkcs12 file which doesn't require a password.
(seems that I already somehow did this a year ago, and now forgot it.damn.)
已采纳解答
原帖链接 · zero0 · CC BY-SA 4.0
It can be achieved by various openssl calls.
- PASSWORD is your current password
- YourPKCSFile is the file you want to convert
- NewPKCSWithoutPassphraseFile is the target file for the PKCS12 without passphrase
First, extract the certificate:
$ openssl pkcs12 -clcerts -nokeys -legacy -in "YourPKCSFile" \
-out certificate.crt -password pass:PASSWORD -passin pass:PASSWORD
Second, the CA key:
$ openssl pkcs12 -cacerts -nokeys -legacy -in "YourPKCSFile" \
-out ca-cert.ca -password pass:PASSWORD -passin pass:PASSWORD
Now, the private key:
$ openssl pkcs12 -nocerts -legacy -in "YourPKCSFile" \
-out private.key -password pass:PASSWORD -passin pass:PASSWORD \
-passout pass:TemporaryPassword
Now remove the passphrase:
$ openssl rsa -legacy -in private.key -out "NewKeyFile.key" \
-passin pass:TemporaryPassword
Put things together for the new PKCS-File:
$ cat "NewKeyFile.key" \
"certificate.crt" \
"ca-cert.ca" > PEM.pem
And create the new file:
$ openssl pkcs12 -export -nodes -CAfile ca-cert.ca \
-in PEM.pem -out "NewPKCSWithoutPassphraseFile"
Now you have a new PKCS12 key file without passphrase on the private key part.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
