【问题标题】:entering password into openssl command from shell script从 shell 脚本将密码输入到 openssl 命令中
【发布时间】:2014-11-19 16:40:10
【问题描述】:

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

所以当我打电话时:

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

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

我尝试输入密码:

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

以及尝试在 openssl 命令中使用标志,但不知道如何执行此操作。

【问题讨论】:

  • 你试过什么标志?
  • -passin pass:12345678 添加到行
  • 谢谢。我以为 passin 只会将文件作为输入......但我让它与 -password 标准输入一起工作,所以 openssl 期望密码来自标准输入,然后管道工作。

标签: shell openssl sh piping


【解决方案1】:

这一个班轮为我工作-

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

【讨论】:

    猜你喜欢
    • 2010-10-07
    • 1970-01-01
    • 2021-01-16
    • 2017-11-10
    • 1970-01-01
    • 2023-03-30
    • 1970-01-01
    • 2013-06-10
    • 1970-01-01
    相关资源
    最近更新 更多