[tor-commits] [ooni-probe/develop] Add Sphinx docstring for getPeerCert() function.

isis at torproject.org isis at torproject.org
Thu Jun 6 16:41:38 UTC 2013


commit a550f38e1b79a924b3c6e636a3bf5464130b6382
Author: Isis Lovecruft <isis at torproject.org>
Date:   Mon Apr 22 00:46:42 2013 +0000

    Add Sphinx docstring for getPeerCert() function.
---
 nettests/experimental/tls_handshake.py |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/nettests/experimental/tls_handshake.py b/nettests/experimental/tls_handshake.py
index b715387..d2f58a3 100644
--- a/nettests/experimental/tls_handshake.py
+++ b/nettests/experimental/tls_handshake.py
@@ -226,6 +226,15 @@ class HandshakeTest(nettest.NetTestCase):
 
     @staticmethod
     def getPeerCert(connection, get_chain=False):
+        """Get the PEM-encoded certificate or cert chain of the remote host.
+
+        :param connection: A :class:`OpenSSL.SSL.Connection <Connection>`.
+        :param bool get_chain: If True, get the all certificates in the
+            chain. Otherwise, only get the remote host's certificate.
+        :returns: A PEM-encoded x509 certificate. If
+            :param:`getPeerCert.get_chain <get_chain>` is True, returns a list
+            of PEM-encoded x509 certificates.
+        """
         if not get_chain:
             x509_cert = connection.get_peer_certificate()
             pem_cert = crypto.dump_certificate(crypto.FILETYPE_PEM, x509_cert)





More information about the tor-commits mailing list