@@ -135,14 +135,14 @@ def test_load_pkcs7_empty_certificates(self):
135135
136136def _load_cert_key ():
137137 key = load_vectors_from_file (
138- os .path .join ("pkcs7 " , "ca_key.pem" ),
138+ os .path .join ("x509" , "custom" , "ca " , "ca_key.pem" ),
139139 lambda pemfile : serialization .load_pem_private_key (
140140 pemfile .read (), None , unsafe_skip_rsa_key_validation = True
141141 ),
142142 mode = "rb" ,
143143 )
144144 cert = load_vectors_from_file (
145- os .path .join ("pkcs7 " , "ca.pem" ),
145+ os .path .join ("x509" , "custom" , "ca " , "ca.pem" ),
146146 loader = lambda pemfile : x509 .load_pem_x509_certificate (pemfile .read ()),
147147 mode = "rb" ,
148148 )
@@ -175,19 +175,25 @@ def build_pkcs7_certificate(
175175 )
176176
177177 # Add AuthorityKeyIdentifier extension
178- aki = certificate .extensions .get_extension_for_oid (
179- ExtensionOID .AUTHORITY_KEY_IDENTIFIER
178+ aki = x509 .AuthorityKeyIdentifier (
179+ b"\xfc \xeb \xb4 \xd8 \x12 \xf2 \xc9 =\x99 \xc3 <g\xf4 }7}\xe6 \x13 \xed \xfa " ,
180+ None ,
181+ None ,
180182 )
181183 certificate_builder = certificate_builder .add_extension (
182- aki .value , critical = False
184+ aki ,
185+ critical = False ,
183186 )
184187
185188 # Add SubjectAlternativeName extension
186- san = certificate .extensions .get_extension_for_oid (
187- ExtensionOID .SUBJECT_ALTERNATIVE_NAME
189+ san = x509 .SubjectAlternativeName (
190+ [
191+ x509 .
RFC822Name (
"[email protected] " ),
192+ ]
188193 )
189194 certificate_builder = certificate_builder .add_extension (
190- san .value , critical = True
195+ san ,
196+ critical = True ,
191197 )
192198
193199 # Add BasicConstraints extension
@@ -266,7 +272,7 @@ def verify_invalid_pkcs7_certificate(certificate: x509.Certificate):
266272 verifier .verify (certificate , [])
267273
268274 @pytest .mark .parametrize (
269- "filename" , ["ca_non_ascii_san .pem" , "ca_ascii_san .pem" ]
275+ "filename" , ["non-ascii-san .pem" , "ascii-san .pem" ]
270276 )
271277 def test_verify_pkcs7_certificate_wrong_san (self , filename ):
272278 # Read a certificate with an invalid SAN
0 commit comments