从shell脚本输入密码到openssl命令

时间:2014-11-19 16:40:10

标签: shell openssl sh piping

我试图在没有任何用户输入的情况下从shell脚本将p12转换为pem。 我可以将密码作为脚本中的变量。

所以当我打电话时:

openssl pkcs12 -in *.p12 -out cert.pem -nodes

终端打印“输入导入密码:”并等待输入。

我尝试使用以下方法输入密码:

echo $PASS | openssl pkcs12 -in *.p12 -out cert.pem -nodes

以及尝试使用openssl命令的标志,但无法弄清楚如何执行此操作。

1 个答案:

答案 0 :(得分:0)

这一个班轮对我有用 -

openssl pkcs12 -in certificate.p12 -password pass:<your_password> -nodes | openssl x509 -noout -enddate