使用起来相当简单。这未经测试,但应该可以工作:
# load OpenSSL.cryptofrom OpenSSL import crypto# open it, using password. Supply/read your own from stdin.p12 = crypto.load_pkcs12(open("/path/to/cert.p12", 'rb').read(), passwd)# get various properties of said file.# note these are PyOpenSSL objects, not strings although you# can convert them to PEM-enpred strings.p12.get_certificate() # (signed) certificate objectp12.get_privatekey() # private key.p12.get_ca_certificates() # ca chain.
有关更多示例,请浏览pyopenssl的单元测试代码。您可能想使用库的几乎所有方式都在那里
另请参见这里或没有广告在这里。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)