@@ -102,13 +102,21 @@ def test_parse_cert_CVE_2013_4073(self):
102
102
(('emailAddress' , 'python-dev@python.org' ),))
103
103
self .assertEqual (p ['subject' ], subject )
104
104
self .assertEqual (p ['issuer' ], subject )
105
- self .assertEqual (p ['subjectAltName' ],
106
- (('DNS' , 'altnull.python.org\x00 example.com' ),
107
- ('email' , 'null@python.org\x00 user@example.org' ),
108
- ('URI' , 'http://null.python.org\x00 http://example.org' ),
109
- ('IP Address' , '192.0.2.1' ),
110
- ('IP Address' , '2001:DB8:0:0:0:0:0:1\n ' ))
111
- )
105
+ if ssl ._OPENSSL_API_VERSION >= (0 , 9 , 8 ):
106
+ san = (('DNS' , 'altnull.python.org\x00 example.com' ),
107
+ ('email' , 'null@python.org\x00 user@example.org' ),
108
+ ('URI' , 'http://null.python.org\x00 http://example.org' ),
109
+ ('IP Address' , '192.0.2.1' ),
110
+ ('IP Address' , '2001:DB8:0:0:0:0:0:1\n ' ))
111
+ else :
112
+ # OpenSSL 0.9.7 doesn't support IPv6 addresses in subjectAltName
113
+ san = (('DNS' , 'altnull.python.org\x00 example.com' ),
114
+ ('email' , 'null@python.org\x00 user@example.org' ),
115
+ ('URI' , 'http://null.python.org\x00 http://example.org' ),
116
+ ('IP Address' , '192.0.2.1' ),
117
+ ('IP Address' , '<invalid>' ))
118
+
119
+ self .assertEqual (p ['subjectAltName' ], san )
112
120
113
121
def test_DER_to_PEM (self ):
114
122
with open (SVN_PYTHON_ORG_ROOT_CERT , 'r' ) as f :
0 commit comments