本文整理匯總了Python中ssl.MemoryBIO方法的典型用法代碼示例。如果您正苦於以下問題:Python ssl.MemoryBIO方法的具體用法?Python ssl.MemoryBIO怎麽用?Python ssl.MemoryBIO使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ssl
的用法示例。
在下文中一共展示了ssl.MemoryBIO方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: import ssl [as 別名]
# 或者: from ssl import MemoryBIO [as 別名]
def __init__(self, context, server_side, server_hostname=None):
"""
The *context* argument specifies the ssl.SSLContext to use.
The *server_side* argument indicates whether this is a server side or
client side transport.
The optional *server_hostname* argument can be used to specify the
hostname you are connecting to. You may only specify this parameter if
the _ssl module supports Server Name Indication (SNI).
"""
self._context = context
self._server_side = server_side
self._server_hostname = server_hostname
self._state = _UNWRAPPED
self._incoming = ssl.MemoryBIO()
self._outgoing = ssl.MemoryBIO()
self._sslobj = None
self._need_ssldata = False
self._handshake_cb = None
self._shutdown_cb = None
示例2: __init__
# 需要導入模塊: import ssl [as 別名]
# 或者: from ssl import MemoryBIO [as 別名]
def __init__(self, writer, reader, pem_file):
"""@param: writer and reader are asyncio stream writer and reader objects"""
self._tlsInBuff = ssl.MemoryBIO()
self._tlsOutBuff = ssl.MemoryBIO()
ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1_1)
ctx.set_ciphers('RSA:!aNULL')
ctx.check_hostname = False
ctx.load_cert_chain(pem_file)
self._tlsObj = ctx.wrap_bio(
self._tlsInBuff, self._tlsOutBuff, server_side=True)
self.writer = writer
self.reader = reader
示例3: __init__
# 需要導入模塊: import ssl [as 別名]
# 或者: from ssl import MemoryBIO [as 別名]
def __init__(self):
"""
initialize a new storage queue
"""
self.memorybio = ssl.MemoryBIO()
示例4: _is_sslproto_available
# 需要導入模塊: import ssl [as 別名]
# 或者: from ssl import MemoryBIO [as 別名]
def _is_sslproto_available():
return hasattr(ssl, "MemoryBIO")
# States of an _SSLPipe.
示例5: _make_legacy_ssl_transport
# 需要導入模塊: import ssl [as 別名]
# 或者: from ssl import MemoryBIO [as 別名]
def _make_legacy_ssl_transport(self, rawsock, protocol, sslcontext,
waiter, *,
server_side=False, server_hostname=None,
extra=None, server=None):
# Use the legacy API: SSL_write, SSL_read, etc. The legacy API is used
# on Python 3.4 and older, when ssl.MemoryBIO is not available.
return _SelectorSslTransport(
self, rawsock, protocol, sslcontext, waiter,
server_side, server_hostname, extra, server)
示例6: test_create_ssl_connection
# 需要導入模塊: import ssl [as 別名]
# 或者: from ssl import MemoryBIO [as 別名]
def test_create_ssl_connection(self):
raise unittest.SkipTest("need python 3.5 (ssl.MemoryBIO)")
示例7: test_create_server_ssl
# 需要導入模塊: import ssl [as 別名]
# 或者: from ssl import MemoryBIO [as 別名]
def test_create_server_ssl(self):
raise unittest.SkipTest("need python 3.5 (ssl.MemoryBIO)")
示例8: test_create_server_ssl_match_failed
# 需要導入模塊: import ssl [as 別名]
# 或者: from ssl import MemoryBIO [as 別名]
def test_create_server_ssl_match_failed(self):
raise unittest.SkipTest("need python 3.5 (ssl.MemoryBIO)")
示例9: test_create_server_ssl_verified
# 需要導入模塊: import ssl [as 別名]
# 或者: from ssl import MemoryBIO [as 別名]
def test_create_server_ssl_verified(self):
raise unittest.SkipTest("need python 3.5 (ssl.MemoryBIO)")
示例10: __init__
# 需要導入模塊: import ssl [as 別名]
# 或者: from ssl import MemoryBIO [as 別名]
def __init__(self, maxlen=-1):
""" Creates StreamReader instance.
Params:
maxlen - maximal allowed netstring length.
"""
self._maxlen = maxlen
self._incoming = ssl.MemoryBIO()
self._fetcher = None