Though this MicroPython-based library may be available for use in some builds of CircuitPython, it is unsupported and its functionality may change in the future, perhaps significantly. As CircuitPython continues to develop, it may be changed to comply more closely with the corresponding standard Python library. You will likely need to change your code later if you rely on any non-standard functionality it currently provides.
This module implements a subset of the corresponding
as described below. For more information, refer to the original
This module provides access to Transport Layer Security (previously and widely known as “Secure Sockets Layer”) encryption and peer authentication facilities for network sockets, both client-side and server-side.
wrap_socket(sock, server_side=False, keyfile=None, certfile=None, cert_reqs=CERT_NONE, ca_certs=None)¶
streamsock (usually usocket.socket instance of
SOCK_STREAMtype), and returns an instance of ssl.SSLSocket, which wraps the underlying stream in an SSL context. Returned object has the usual
streaminterface methods like
write(), etc. In MicroPython, the returned object does not expose socket interface and methods like
send(). In particular, a server-side SSL socket should be created from a normal socket returned from
accept()on a non-SSL listening server socket.
Depending on the underlying module implementation in a particular
MicroPython port, some or all keyword arguments above may be not supported.
Some implementations of
ussl module do NOT validate server certificates,
which makes an SSL connection established prone to man-in-the-middle attacks.