On this page
ssl.MemoryBIO
Prev: ssl.get_server_certificate | Up: ssl | Next: ssl.namedtuple
Rel: ssl.AlertDescription, ssl.cert_time_to_seconds, ssl.CertificateError, ssl.create_connection
Ref: docs.python.org — ssl.MemoryBIO
Tags: #public #python3 #stdlib #ssl
Import
import ssl
from ssl import MemoryBIO
Signature & Overview
ssl.MemoryBIO(...)
ssl.MemoryBIO class.
Methods & Attributes
MemoryBIO.read(self, size=-1, /)— Read up to size bytes from the memory BIO.MemoryBIO.write(self, b, /)— Writes the bytes b into the memory BIO.MemoryBIO.write_eof(self, /)— Write an EOF marker to the memory BIO.
Usage
import ssl
bio = ssl.MemoryBIO()
bio.write(b"hello")
assert bio.pending == 5 and bio.read() == b"hello"
Gotchas
- Powers socket-less TLS (
SSLContext.wrap_bio): Used byasyncioand custom event loops to drive OpenSSL purely in memory.
REPL Inspect
from ssl import MemoryBIO
help(MemoryBIO)
Linked from
Related notes
- tuts/python3/stdlib_module/ssl/get_server_certificate Linked here; links to this page; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/namedtuple Linked here; links to this page; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/ssl/AlertDescription Linked here; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/cert_time_to_seconds Linked here; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/CertificateError Linked here; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/create_connection Linked here; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/create_default_context shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/DefaultVerifyPaths shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/DER_cert_to_PEM_cert shared tags: #ssl, #stdlib