Permalink
Browse files

Merge pull request #162 from t-8ch/pyopenssl_fingerprints

add fingerprint support to pyopenssl.py
  • Loading branch information...
2 parents e363eaf + b18af9a commit 69823dccf870fd9023d2338e5473ec2be9643b9f @shazow committed Mar 20, 2013
Showing with 7 additions and 1 deletion.
  1. +7 −1 urllib3/contrib/pyopenssl.py
@@ -115,10 +115,16 @@ def settimeout(self, timeout):
def sendall(self, data):
return self.connection.sendall(data)
- def getpeercert(self):
+ def getpeercert(self, binary_form=False):
x509 = self.connection.get_peer_certificate()
if not x509:
raise ssl.SSLError('')
+
+ if binary_form:
+ return OpenSSL.crypto.dump_certificate(
+ OpenSSL.crypto.FILETYPE_ASN1,
+ x509)
+
return {
'subject': (
(('commonName', x509.get_subject().CN),),

0 comments on commit 69823dc

Please sign in to comment.