Transport Layer Security(TLS)/SSL in Python

Overview:

The ssl module of Python standard library provides classes that help implementing secure communication between two network end-points using TLS. 

As per RFC 5246, The Transport Layer Security (TLS) Protocol aims to provide the following,
•    Cryptographic Security
•    Interoperability among independent developers
•    Extensibility of the TLS
•    Relative efficiency in providing the Cryptographic operations

The current version of the TLS is 1.3. 

Prior to the evolution of TLS and the widespread availability of its  implementations SSL3.0 was used as a secure solution to communicate between two endpoints of a communication such as in World Wide Web.

TLS providing secure communication between two network end-points

TLS in Python:

The popular open source library OpenSSL implements both SSL and TLS specifications. 

The OpenSSL library provides various cryptographic functions and is written in C programming language. OpenSSL implements both SSL and TLS protocols. The Python module ssl uses OpenSSL as the underlying library to provide TLS support in Python.

The Python SSL Module provides the classes SSLSocket and SSLContext to implement secure communication using TLS.

The SSLsocket class is derived from the socket class. The socket class provides implementation of a streaming socket (TCP Socket) and the SSLSocket provides SSL handshake and encryption functionalities. Hence the SSLSocket is derived from the socket class the SSLSocket provides streaming communication as well as cryptographic services.

The SSLContext has support for reading - X.509 certificates of the root Certificate Authorities, intermediate certificates and the servers. 

 

 


Copyright 2025 © pythontic.com