You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
457 B
29 lines
457 B
# Basic test of ssl.SSLContext get_ciphers() and set_ciphers() methods.
|
|
|
|
try:
|
|
import ssl
|
|
except ImportError:
|
|
print("SKIP")
|
|
raise SystemExit
|
|
|
|
|
|
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
|
|
|
|
ciphers = ctx.get_ciphers()
|
|
|
|
for ci in ciphers:
|
|
print(ci)
|
|
|
|
ctx.set_ciphers(ciphers[:1])
|
|
|
|
# Test error cases.
|
|
|
|
try:
|
|
ctx.set_ciphers(ciphers[0])
|
|
except TypeError as e:
|
|
print(e)
|
|
|
|
try:
|
|
ctx.set_ciphers(["BAR"])
|
|
except OSError as e:
|
|
print(e)
|
|
|