开发者

PyOpenSSL: Force SSL negotiations without sending/receiving?

Is it possible to force PyOpenSSL into performing the SSL negotiation (and, specifically, retrieving the peer's certificate) w开发者_开发问答ithout trying to send/receive data?

Currently, with this code:

    ssl_soc = SSL.Connection(self._mk_ctx(), plain_soc)
    ssl_soc.set_connect_state()
    cert = ssl_soc.get_peer_certificate()

The call to get_peer_certificate returns None, but once I've called, eg, ssl_soc.write("hello"), get_peer_certificate starts returning the certificate like I'd expect.


Err, clearly I need to RTFM a little harder. I was looking for the do_handshake method: http://packages.python.org/pyOpenSSL/openssl-connection.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜