openssl pkcs12 从命令行设置密码

openssl pkcs12 set password from command line

我有一个这样的bash命令

openssl pkcs12 -export -out ~/certificate.pfx -inkey /etc/letsencrypt/live/exapmle.com/privkey.pem -in /etc/letsencrypt/live/exapmle.com/cert.pem -certfile /etc/letsencrypt/live/exapmle.com/chain.pem

现在我将被要求输入密码来加密 .pfx 文件。那么有什么方法可以通过命令行设置密码,而不是每次都手动执行此操作?

结果命令是

openssl pkcs12 -password pass:your_password -export -out ~/certificate.pfx -inkey /etc/letsencrypt/live/exapmle.com/privkey.pem -in /etc/letsencrypt/live/exapmle.com/cert.pem -certfile /etc/letsencrypt/live/exapmle.com/chain.pem