Skip to content

Instantly share code, notes, and snippets.

@ehzawad
Created August 16, 2023 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ehzawad/ecb9421acfc31ea529e70aa0b459f8cf to your computer and use it in GitHub Desktop.
Save ehzawad/ecb9421acfc31ea529e70aa0b459f8cf to your computer and use it in GitHub Desktop.
import ssl
# Get the OpenSSL version
openssl_version = ssl.OPENSSL_VERSION
print(f"OpenSSL Version: {openssl_version}")
# Get the OpenSSL version info (tuple)
openssl_version_info = ssl.OPENSSL_VERSION_INFO
print(f"OpenSSL Version Info: {openssl_version_info}")
# Check supported protocols
supported_protocols = [
("TLSv1", ssl.PROTOCOL_TLSv1),
("TLSv1.1", ssl.PROTOCOL_TLSv1_1),
("TLSv1.2", ssl.PROTOCOL_TLSv1_2),
("TLS", ssl.PROTOCOL_TLS),
]
for name, protocol in supported_protocols:
try:
ssl.SSLContext(protocol)
print(f"{name} is supported")
except (ValueError, AttributeError):
print(f"{name} is not supported")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment