Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upbpo-18233: Add SSLSocket.getpeercertchain() #17938
Conversation
This comment has been minimized.
This comment has been minimized.
I like that there's the option to get both the raw chain and the verified chain – these are different things and both are important for different purposes. But the docs should be clearer about the difference. Maybe fetching the verified chain should only be supported when building against openssl 1.1.1? That would simplify this patch a lot, and follow the general trend of trying to get rid of custom cert verification logic in the ssl module. For the unverified chain, the openssl docs say:
I think this is confusing, and we should hide the confusing bit from python users. My preference would be for the python wrapper to always return the complete cert chain, including the leaf. So when necessary, the wrapper should manually call |
This comment has been minimized.
This comment has been minimized.
Thanks for taking a look so promptly.
I'm very happy to do that if it's acceptable to only partially support openssl 1.0.2 and throw an exception if
I definitely agree, I'll implement it soon |
…hain()
This comment has been minimized.
This comment has been minimized.
I implemented it in df65d40 but I've changed my mind as it makes using |
chrisburr commentedJan 10, 2020
•
edited
Based on the patch provided by Christian Heimes (christian.heimes) and updated by Mariusz Masztalerczuk (mmasztalerczuk). Updated to use
SSL_get0_verified_chain
in OpenSSL 1.1 as suggested by Jörn Heissler (joernheissler).Tested with both OpenSSL 1.0.2 and 1.1.1 using the included test and:
https://bugs.python.org/issue18233