Method Name:
SSLSocket.version
Method Signature:
SSLSocket.version()
Parameters:
None
Return Value:
The version of the SSL protocol obtained during the SSL handshake. The value is from the set of protocol values {"SSLv2", "SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"}
Overview:
- When an SSL connection is established between two machines in the network, several parameters are established like
- Protocol version
- Cipher Suite
- Compression Method
which will be used for the communication.
- The method SSLSocket.version() returns the version of the SSL protocol to be used in the communication between two SSL sockets.
Example:
# Example Python program that prints the SSL import ssl # Create an SSL context # Create a streaming socket # Create a secure socket print("The SSL protocol version before calling SSLSocket.connect() is:") # Connect to host |
Output:
The SSL protocol version before calling SSLSocket.connect() is: |