【问题标题】:Validate Certificate using Python使用 Python 验证证书
【发布时间】:2010-08-30 12:55:45
【问题描述】:

我想通过 HTTPS 访问网络服务。

我已获得客户端证书(p12 文件)以便访问它。 以前我们使用的是基本身份验证。

使用 python 我不确定如何访问它。

我想用 httplib2

h = Http()
#h.add_credentials("testuser", "testpass")
#h.add_certificate(keyfile, certfile, '')
resp, content = h.request("https://example.com/webservice", "POST", xml_data)
print content

现在,我对 SSL 很陌生,我可以调用 add_cert 或类似的东西,然后给它 p12 文件。 我需要将其转换为 PEM 文件吗?

【问题讨论】:

    标签: python openssl ssl-certificate


    【解决方案1】:

    我的问题的答案在我的问题中

    h.add_certificate(keyfile, certfile, '')
    

    我有一个 pkcs12 文件,我只需要从 p12 文件中提取密钥和证书。

    openssl pkcs12 -in file.p12 -out key.pem -nodes -nocerts
    openssl pkcs12 -in file.p12 -out cert.pem -nodes -nokeys
    

    【讨论】:

      猜你喜欢
      • 2010-11-08
      • 2022-06-17
      • 1970-01-01
      • 2021-11-26
      • 1970-01-01
      • 2018-12-25
      • 2013-10-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多