@@ -56,58 +56,11 @@ def test_fluent_ssl():
56
56
print (ssock .version ())
57
57
58
58
59
- def test_fluent_ssl_no_TLSv1 ():
60
- hostname = 'www.python.org'
61
- context = ssl .SSLContext (ssl .PROTOCOL_SSLv23 )
62
- context .options |= ssl .OP_NO_TLSv1
63
-
64
- with socket .create_connection ((hostname , 443 )) as sock :
65
- with context .wrap_socket (sock , server_hostname = hostname ) as ssock :
66
- print (ssock .version ())
67
-
68
- def test_fluent_ssl_safe ():
69
- hostname = 'www.python.org'
70
- context = ssl .SSLContext (ssl .PROTOCOL_SSLv23 )
71
- context .options |= ssl .OP_NO_TLSv1
72
- context .options |= ssl .OP_NO_TLSv1_1
73
-
74
- with socket .create_connection ((hostname , 443 )) as sock :
75
- with context .wrap_socket (sock , server_hostname = hostname ) as ssock :
76
- print (ssock .version ())
77
-
78
- def test_fluent_ssl_safe_combined ():
79
- hostname = 'www.python.org'
80
- context = ssl .SSLContext (ssl .PROTOCOL_SSLv23 )
81
- context .options |= ssl .OP_NO_TLSv1 | ssl .OP_NO_TLSv1_1
82
-
83
- with socket .create_connection ((hostname , 443 )) as sock :
84
- with context .wrap_socket (sock , server_hostname = hostname ) as ssock :
85
- print (ssock .version ())
86
-
87
- def test_fluent_ssl_unsafe_combined_wrongly ():
88
- hostname = 'www.python.org'
89
- context = ssl .SSLContext (ssl .PROTOCOL_SSLv23 )
90
- context .options |= ssl .OP_NO_TLSv1 & ssl .OP_NO_TLSv1_1
91
-
92
- with socket .create_connection ((hostname , 443 )) as sock :
93
- with context .wrap_socket (sock , server_hostname = hostname ) as ssock :
94
- print (ssock .version ())
95
-
96
- def test_fluent_ssl_safe_combined_multiple ():
97
- hostname = 'www.python.org'
98
- context = ssl .SSLContext (ssl .PROTOCOL_SSLv23 )
99
- context .options |= ssl .OP_NO_TLSv1 | ssl .OP_NO_TLSv1_1 | ssl .OP_NO_TLSv1_2
100
-
101
- with socket .create_connection ((hostname , 443 )) as sock :
102
- with context .wrap_socket (sock , server_hostname = hostname ) as ssock :
103
- print (ssock .version ())
104
-
105
-
106
59
def create_relaxed_context ():
107
- return ssl .SSLContext (ssl .PROTOCOL_SSLv23 )
60
+ return ssl .SSLContext (ssl .PROTOCOL_TLS )
108
61
109
62
def create_secure_context ():
110
- context = ssl .SSLContext (ssl .PROTOCOL_SSLv23 )
63
+ context = ssl .SSLContext (ssl .PROTOCOL_TLS )
111
64
context .options |= ssl .OP_NO_TLSv1 | ssl .OP_NO_TLSv1_1
112
65
return context
113
66
@@ -143,21 +96,21 @@ def test_delegated_context_made_unsafe():
143
96
print (ssock .version ())
144
97
145
98
def test_delegated_connection_unsafe ():
146
- context = ssl .SSLContext (ssl .PROTOCOL_SSLv23 )
99
+ context = ssl .SSLContext (ssl .PROTOCOL_TLS )
147
100
create_connection (context )
148
101
149
102
def test_delegated_connection_safe ():
150
- context = ssl .SSLContext (ssl .PROTOCOL_SSLv23 )
103
+ context = ssl .SSLContext (ssl .PROTOCOL_TLS )
151
104
context .options |= ssl .OP_NO_TLSv1 | ssl .OP_NO_TLSv1_1
152
105
create_connection (context )
153
106
154
107
def test_delegated_connection_made_safe ():
155
- context = ssl .SSLContext (ssl .PROTOCOL_SSLv23 )
108
+ context = ssl .SSLContext (ssl .PROTOCOL_TLS )
156
109
context .options |= ssl .OP_NO_TLSv1 | ssl .OP_NO_TLSv1_1
157
110
create_connection (context )
158
111
159
112
def test_delegated_connection_made_unsafe ():
160
- context = ssl .SSLContext (ssl .PROTOCOL_SSLv23 )
113
+ context = ssl .SSLContext (ssl .PROTOCOL_TLS )
161
114
context .options |= ssl .OP_NO_TLSv1 | ssl .OP_NO_TLSv1_1
162
115
context .options &= ~ ssl .OP_NO_TLSv1_1
163
116
create_connection (context )
0 commit comments