@@ -208,10 +208,6 @@ def has_tls_version(version):
208
208
:param version: TLS version name or ssl.TLSVersion member
209
209
:return: bool
210
210
"""
211
- if version == "SSLv2" :
212
- # never supported and not even in TLSVersion enum
213
- return False
214
-
215
211
if isinstance (version , str ):
216
212
version = ssl .TLSVersion .__members__ [version ]
217
213
@@ -3129,37 +3125,10 @@ def test_ssl_cert_verify_error(self):
3129
3125
self .assertIn (msg , repr (e ))
3130
3126
self .assertIn ('certificate verify failed' , repr (e ))
3131
3127
3132
- @requires_tls_version ('SSLv2' )
3133
- def test_protocol_sslv2 (self ):
3134
- """Connecting to an SSLv2 server with various client options"""
3135
- if support .verbose :
3136
- sys .stdout .write ("\n " )
3137
- try_protocol_combo (ssl .PROTOCOL_SSLv2 , ssl .PROTOCOL_SSLv2 , True )
3138
- try_protocol_combo (ssl .PROTOCOL_SSLv2 , ssl .PROTOCOL_SSLv2 , True , ssl .CERT_OPTIONAL )
3139
- try_protocol_combo (ssl .PROTOCOL_SSLv2 , ssl .PROTOCOL_SSLv2 , True , ssl .CERT_REQUIRED )
3140
- try_protocol_combo (ssl .PROTOCOL_SSLv2 , ssl .PROTOCOL_TLS , False )
3141
- if has_tls_version ('SSLv3' ):
3142
- try_protocol_combo (ssl .PROTOCOL_SSLv2 , ssl .PROTOCOL_SSLv3 , False )
3143
- try_protocol_combo (ssl .PROTOCOL_SSLv2 , ssl .PROTOCOL_TLSv1 , False )
3144
- # SSLv23 client with specific SSL options
3145
- try_protocol_combo (ssl .PROTOCOL_SSLv2 , ssl .PROTOCOL_TLS , False ,
3146
- client_options = ssl .OP_NO_SSLv3 )
3147
- try_protocol_combo (ssl .PROTOCOL_SSLv2 , ssl .PROTOCOL_TLS , False ,
3148
- client_options = ssl .OP_NO_TLSv1 )
3149
-
3150
3128
def test_PROTOCOL_TLS (self ):
3151
3129
"""Connecting to an SSLv23 server with various client options"""
3152
3130
if support .verbose :
3153
3131
sys .stdout .write ("\n " )
3154
- if has_tls_version ('SSLv2' ):
3155
- try :
3156
- try_protocol_combo (ssl .PROTOCOL_TLS , ssl .PROTOCOL_SSLv2 , True )
3157
- except OSError as x :
3158
- # this fails on some older versions of OpenSSL (0.9.7l, for instance)
3159
- if support .verbose :
3160
- sys .stdout .write (
3161
- " SSL2 client to SSL23 server test unexpectedly failed:\n %s\n "
3162
- % str (x ))
3163
3132
if has_tls_version ('SSLv3' ):
3164
3133
try_protocol_combo (ssl .PROTOCOL_TLS , ssl .PROTOCOL_SSLv3 , False )
3165
3134
try_protocol_combo (ssl .PROTOCOL_TLS , ssl .PROTOCOL_TLS , True )
@@ -3197,8 +3166,6 @@ def test_protocol_sslv3(self):
3197
3166
try_protocol_combo (ssl .PROTOCOL_SSLv3 , ssl .PROTOCOL_SSLv3 , 'SSLv3' )
3198
3167
try_protocol_combo (ssl .PROTOCOL_SSLv3 , ssl .PROTOCOL_SSLv3 , 'SSLv3' , ssl .CERT_OPTIONAL )
3199
3168
try_protocol_combo (ssl .PROTOCOL_SSLv3 , ssl .PROTOCOL_SSLv3 , 'SSLv3' , ssl .CERT_REQUIRED )
3200
- if has_tls_version ('SSLv2' ):
3201
- try_protocol_combo (ssl .PROTOCOL_SSLv3 , ssl .PROTOCOL_SSLv2 , False )
3202
3169
try_protocol_combo (ssl .PROTOCOL_SSLv3 , ssl .PROTOCOL_TLS , False ,
3203
3170
client_options = ssl .OP_NO_SSLv3 )
3204
3171
try_protocol_combo (ssl .PROTOCOL_SSLv3 , ssl .PROTOCOL_TLSv1 , False )
@@ -3211,8 +3178,6 @@ def test_protocol_tlsv1(self):
3211
3178
try_protocol_combo (ssl .PROTOCOL_TLSv1 , ssl .PROTOCOL_TLSv1 , 'TLSv1' )
3212
3179
try_protocol_combo (ssl .PROTOCOL_TLSv1 , ssl .PROTOCOL_TLSv1 , 'TLSv1' , ssl .CERT_OPTIONAL )
3213
3180
try_protocol_combo (ssl .PROTOCOL_TLSv1 , ssl .PROTOCOL_TLSv1 , 'TLSv1' , ssl .CERT_REQUIRED )
3214
- if has_tls_version ('SSLv2' ):
3215
- try_protocol_combo (ssl .PROTOCOL_TLSv1 , ssl .PROTOCOL_SSLv2 , False )
3216
3181
if has_tls_version ('SSLv3' ):
3217
3182
try_protocol_combo (ssl .PROTOCOL_TLSv1 , ssl .PROTOCOL_SSLv3 , False )
3218
3183
try_protocol_combo (ssl .PROTOCOL_TLSv1 , ssl .PROTOCOL_TLS , False ,
@@ -3225,8 +3190,6 @@ def test_protocol_tlsv1_1(self):
3225
3190
if support .verbose :
3226
3191
sys .stdout .write ("\n " )
3227
3192
try_protocol_combo (ssl .PROTOCOL_TLSv1_1 , ssl .PROTOCOL_TLSv1_1 , 'TLSv1.1' )
3228
- if has_tls_version ('SSLv2' ):
3229
- try_protocol_combo (ssl .PROTOCOL_TLSv1_1 , ssl .PROTOCOL_SSLv2 , False )
3230
3193
if has_tls_version ('SSLv3' ):
3231
3194
try_protocol_combo (ssl .PROTOCOL_TLSv1_1 , ssl .PROTOCOL_SSLv3 , False )
3232
3195
try_protocol_combo (ssl .PROTOCOL_TLSv1_1 , ssl .PROTOCOL_TLS , False ,
@@ -3245,8 +3208,6 @@ def test_protocol_tlsv1_2(self):
3245
3208
try_protocol_combo (ssl .PROTOCOL_TLSv1_2 , ssl .PROTOCOL_TLSv1_2 , 'TLSv1.2' ,
3246
3209
server_options = ssl .OP_NO_SSLv3 | ssl .OP_NO_SSLv2 ,
3247
3210
client_options = ssl .OP_NO_SSLv3 | ssl .OP_NO_SSLv2 ,)
3248
- if has_tls_version ('SSLv2' ):
3249
- try_protocol_combo (ssl .PROTOCOL_TLSv1_2 , ssl .PROTOCOL_SSLv2 , False )
3250
3211
if has_tls_version ('SSLv3' ):
3251
3212
try_protocol_combo (ssl .PROTOCOL_TLSv1_2 , ssl .PROTOCOL_SSLv3 , False )
3252
3213
try_protocol_combo (ssl .PROTOCOL_TLSv1_2 , ssl .PROTOCOL_TLS , False ,
0 commit comments