[Cryptography-dev] How to retrieve the certificates
Vladimir Didenko
vladimir.didenko at gmail.com
Wed Jul 1 16:12:52 CEST 2015
2015-07-01 17:03 GMT+03:00 Kai Lu:
> Hi,
>
> Could anyone please tell me how to get each certificate (like "begin
> ... end") in the cert chain by using "peercertchain =
> conn.get_peer_cert_chain()"? I use PyOpenssl package. The command line
> like openssl s_client -showcerts -connect XXXX:443 2>/dev/null can print
> out what I need, but I want to use PyOpenssl package or other packages to
> implement it in the Python programs other than calling command line from
> Python code.
>
I don't understand what is a problem. conn.get_peer_cert_chain returns
usual Python list of X509 objects. Each object is certificate. If you need
PEM format you can use crypto.dump_certificate function.
--
Regards,
Vladimir.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cryptography-dev/attachments/20150701/2978b869/attachment.html>
More information about the Cryptography-dev
mailing list