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

2023-03-22 Thread Mikael Stålhammar
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 th

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

2023-03-22 Thread Paul Kehrer
You can loop over the certs you get and serialize them to a single file. Either via converting it to a cryptography object (there's a method on the X509 object for that) and calling public_bytes() (see https://cryptography.io/en/latest/x509/reference/#cryptography.x509.Certificate.public_bytes) or