Implementing secure sockets with the TLS and SSL modules
The standard Python library provides ssl
as a built-in module that can be used as a minimalistic HTTP/HTTPS web server. It provides support for the protocol and allows you to extend capabilities by subclassing. This module provides access to Transport Layer Security encryption and uses the openssl
module at a low level for managing certificates. In the documentation, you can find some examples on establishing a connection and getting certificates from a server in a secure way. You can find the documentation about this module at this URL: https://docs.python.org/3/library/ssl.html.
Next, we are going to implement some functionalities this module provides. For example, we could access the encryption protocols supported by the ssl
module. You can find the following code in the get_ciphers.py
file inside the ssl
folder:
import ssl
ciphers = ssl.SSLContext(ssl.PROTOCOL_SSLv23).get_ciphers()
for cipher in ciphers:
print...