コード例 #1
0
ファイル: _ssl2.py プロジェクト: wellbehavedsoftware/gevent
 def unwrap(self):
     if self._sslobj:
         s = self._sslobj_shutdown()
         self._sslobj = None
         return socket(_sock=s)
     else:
         raise ValueError("No SSL wrapper around " + str(self))
コード例 #2
0
 def unwrap(self):
     if self._sslobj:
         s = self._sslobj_shutdown()
         self._sslobj = None
         return socket(_sock=s)
     else:
         raise ValueError("No SSL wrapper around " + str(self))
コード例 #3
0
 def unwrap(self):
     if self._sslobj:
         s = self._sslobj_shutdown()
         self._sslobj = None
         return socket(_sock=s) # match _ssl2; critical to drop/reuse here on PyPy
     else:
         raise ValueError("No SSL wrapper around " + str(self))
コード例 #4
0
ファイル: _sslgte279.py プロジェクト: ii200400/SpineAnalyzer
 def unwrap(self):
     if self._sslobj:
         s = self._sslobj_shutdown()
         self._sslobj = None
         return socket(_sock=s) # match _ssl2; critical to drop/reuse here on PyPy
     else:
         raise ValueError("No SSL wrapper around " + str(self))
コード例 #5
0
    def unwrap(self):
        if not self._sslobj:
            raise ValueError("No SSL wrapper around " + str(self))

        s = self._sslobj_shutdown()
        self._sslobj = None
        # match _ssl2; critical to drop/reuse here on PyPy
        # XXX: _ssl3 returns an SSLSocket. Is that what the standard lib does on
        # Python 2? Should we do that?
        return socket(_sock=s)
コード例 #6
0
ファイル: _sslgte279.py プロジェクト: wwqgtxx/wwqLyParse
    def unwrap(self):
        if not self._sslobj:
            raise ValueError("No SSL wrapper around " + str(self))

        s = self._sslobj_shutdown()
        self._sslobj = None
        # match _ssl2; critical to drop/reuse here on PyPy
        # XXX: _ssl3 returns an SSLSocket. Is that what the standard lib does on
        # Python 2? Should we do that?
        return socket(_sock=s)
コード例 #7
0
def get_server_certificate(addr, ssl_version=PROTOCOL_SSLv23, ca_certs=None):
    """Retrieve the certificate from the server at the specified address,
    and return it as a PEM-encoded string.
    If 'ca_certs' is specified, validate the server cert against it.
    If 'ssl_version' is specified, use it in the connection attempt."""

    if ca_certs is not None:
        cert_reqs = CERT_REQUIRED
    else:
        cert_reqs = CERT_NONE
    s = wrap_socket(socket(), ssl_version=ssl_version,
                    cert_reqs=cert_reqs, ca_certs=ca_certs)
    s.connect(addr)
    dercert = s.getpeercert(True)
    s.close()
    return DER_cert_to_PEM_cert(dercert)
コード例 #8
0
ファイル: _ssl2.py プロジェクト: wellbehavedsoftware/gevent
def get_server_certificate(addr, ssl_version=PROTOCOL_SSLv23, ca_certs=None):
    """Retrieve the certificate from the server at the specified address,
    and return it as a PEM-encoded string.
    If 'ca_certs' is specified, validate the server cert against it.
    If 'ssl_version' is specified, use it in the connection attempt."""

    if ca_certs is not None:
        cert_reqs = CERT_REQUIRED
    else:
        cert_reqs = CERT_NONE
    s = wrap_socket(socket(), ssl_version=ssl_version,
                    cert_reqs=cert_reqs, ca_certs=ca_certs)
    s.connect(addr)
    dercert = s.getpeercert(True)
    s.close()
    return DER_cert_to_PEM_cert(dercert)