[tor-commits] [ooni-probe/master] Add support for parsing the server certificate chain into a list of x509 certs

art at torproject.org art at torproject.org
Tue Apr 30 13:01:43 UTC 2013


commit 638359fa3df1901d150671c95087827fba8f4b7b
Author: Isis Lovecruft <isis at torproject.org>
Date:   Thu Feb 28 04:07:28 2013 +0000

    Add support for parsing the server certificate chain into a list of x509 certs
    in method getPeerCert().
---
 nettests/experimental/tls_handshake.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/nettests/experimental/tls_handshake.py b/nettests/experimental/tls_handshake.py
index 3e22f38..af59227 100644
--- a/nettests/experimental/tls_handshake.py
+++ b/nettests/experimental/tls_handshake.py
@@ -182,9 +182,12 @@ class TLSHandshakeTest(nettest.NetTestCase):
             pem_cert = dump_certificate(FILETYPE_PEM, x509_cert)
             return pem_cert
         else:
-            raise Exception("No SSL/TLS method chosen!")
-        context.set_cipher_list(self.ciphersuite)
-        return context
+            cert_chain = []
+            x509_cert_chain = connection.get_peer_cert_chain()
+            for x509_cert in x509_cert_chain:
+                pem_cert = dump_certificate(FILETYPE_PEM, x509_cert)
+                cert_chain.append(pem_cert)
+            return cert_chain
 
     def test_tlsv1_handshake(self):
 





More information about the tor-commits mailing list