[Cryptography-dev] Download and save certificate chain as single file

Mikael Stålhammar mikael_stalhammar at hotmail.com
Wed Mar 22 05:57:26 EDT 2023


Hi. In a web browser it is possible to export a certificate chain as a single (pem/crt) file on disk. I wonder if the same is possible using Python and pyOpenSSL? I've played around with the connection.get_peer_cert_chain() method, which returns a list of X509 objects. Not sure how to process those properly and have them saved as a cert chain in a single valid cert file, that later can be passed in as a "verify" param when calling "requests.post(url, verify=<cert file>...)". Does anyone know and can share a code snippet? Thanks!

/Mikael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/cryptography-dev/attachments/20230322/997a40fe/attachment.html>


More information about the Cryptography-dev mailing list