[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [ooni-probe/master] Change getContext() to only set the ciphersuite list, and add method



commit dfc16658964a3bcbec5d94c970bde8c8927286d5
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Thu Feb 28 04:05:42 2013 +0000

    Change getContext() to only set the ciphersuite list, and add method
    getPeerCert() for dumping the server x509 certificate.
---
 nettests/experimental/tls_handshake.py |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/nettests/experimental/tls_handshake.py b/nettests/experimental/tls_handshake.py
index 2c11122..3e22f38 100644
--- a/nettests/experimental/tls_handshake.py
+++ b/nettests/experimental/tls_handshake.py
@@ -172,15 +172,15 @@ class TLSHandshakeTest(nettest.NetTestCase):
         return s
 
     def getContext(self):
-        if 'ssl2' in self.methods:
-            if not 'ssl3' in self.methods:
-                context = SSL.Context(SSL.SSLv2_METHOD)
-            else:
-                context = SSL.Context(SSL.SSLv23_METHOD)
-        elif 'ssl3' in self.methods:
-            context = SSL.Context(SSL.SSLv3_METHOD)
-        elif 'tls1' in self.methods:
-            context = SSL.Context(SSL.TLSv1_METHOD)
+        self.context.set_cipher_list(self.ciphersuite)
+        return self.context
+
+    @staticmethod
+    def getPeerCert(connection, get_chain=False):
+        if not get_chain:
+            x509_cert = connection.get_peer_certificate()
+            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)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits