Created
August 16, 2023 20:05
-
-
Save ehzawad/ecb9421acfc31ea529e70aa0b459f8cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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