【问题标题】:Using curl with certificate that has no password将 curl 与没有密码的证书一起使用
【发布时间】:2015-02-27 14:13:49
【问题描述】:

我有自己的 CA 和客户端证书,我已经成功地使用 cURL 使用正常格式:

curl --cacert /etc/myca.crt --cert /etc/myclient.pem:mypassword --cert-type PEM --get https://myhost.com

现在,由于此问题范围之外的原因,我拥有相同的客户端证书,但已使用 openssl 删除了密码。使用 openssl 我已验证新证书是正确的,我可以使用它使用 cURL 以外的应用程序建立 SSL 连接,但我无法让它与 cURL 一起使用。

如果我不输入密码:

curl --cacert /etc/myca.crt --cert /etc/myclient.pem --cert-type PEM --get https://example.com

我收到一条错误消息“curl:(58) 无法使用客户端证书(未找到密钥或密码错误?)”

我也试过了:

curl --cacert /etc/myca.crt --cert /etc/myclient.pem: --cert-type PEM --get https://example.com

但我得到了同样的错误。

我正在从 Perl 脚本中调用 cURL,因此我需要找到一种不会提示我输入密码的方法。我在 RHEL 5 上使用 cURL 7.15.5。

谢谢。

【问题讨论】:

    标签: ssl curl


    【解决方案1】:

    您可以使用--pass 开关:

    --pass <phrase>                  (SSL/SSH) Passphrase for the private key
    

    要传递一个空密码,您可以使用:

    --pass ''
    

    【讨论】:

      猜你喜欢
      • 2015-08-26
      • 2015-03-26
      • 2014-08-24
      • 2011-07-03
      • 2013-10-01
      • 1970-01-01
      • 2021-10-23
      • 1970-01-01
      • 2014-10-16
      相关资源
      最近更新 更多