从 shell 脚本将密码输入 openssl 命令 [英] entering password into openssl command from shell script
本文介绍了从 shell 脚本将密码输入 openssl 命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在没有任何用户输入的情况下将 p12 从 shell 脚本转换为 pem.我可以将密码作为脚本中的变量.
I am trying to convert a p12 to a pem from a shell script without any user input. I can have the password as a variable within the script.
所以当我打电话时:
openssl pkcs12 -in *.p12 -out cert.pem -nodes
终端打印Enter Import Password:"并等待输入.
The terminal prints "Enter Import Password:" and waits for input.
我试图用管道输入密码:
I tried to pipe the password in with:
echo $PASS | openssl pkcs12 -in *.p12 -out cert.pem -nodes
以及尝试在 openssl 命令中使用标志但不知道如何执行此操作.
as well as trying to use a flag with the openssl command but can't figure out how to do this.
推荐答案
这个班轮对我有用-
openssl pkcs12 -in certificate.p12 -password pass:<your_password> -nodes | openssl x509 -noout -enddate
这篇关于从 shell 脚本将密码输入 openssl 命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文