@@ -1020,7 +1020,7 @@ def fixture_data(self, backend) -> bytes:
10201020 @pytest .fixture (name = "certificate" )
10211021 def fixture_certificate (self , backend ) -> x509 .Certificate :
10221022 return load_vectors_from_file (
1023- os .path .join ("pkcs7" , "verify_cert .pem" ),
1023+ os .path .join ("pkcs7" , "ca .pem" ),
10241024 loader = lambda pemfile : x509 .load_pem_x509_certificate (
10251025 pemfile .read ()
10261026 ),
@@ -1030,7 +1030,7 @@ def fixture_certificate(self, backend) -> x509.Certificate:
10301030 @pytest .fixture (name = "private_key" )
10311031 def fixture_private_key (self , backend ) -> types .PrivateKeyTypes :
10321032 return load_vectors_from_file (
1033- os .path .join ("pkcs7" , "verify_key .pem" ),
1033+ os .path .join ("pkcs7" , "ca_key .pem" ),
10341034 lambda pemfile : serialization .load_pem_private_key (
10351035 pemfile .read (), None , unsafe_skip_rsa_key_validation = True
10361036 ),
@@ -1192,18 +1192,20 @@ def test_pkcs7_verify_der_wrong_certificate(
11921192 with pytest .raises (ValueError ):
11931193 pkcs7 .pkcs7_verify_der (signature , certificate = rsa_certificate )
11941194
1195- def test_pkcs7_verify_der_unsupported_digest_algorithm (
1196- self , backend , data , certificate , private_key
1195+ def test_pkcs7_verify_der_unsupported_rsa_digest_algorithm (
1196+ self , backend , data
11971197 ):
1198- # Signature
1198+ certificate , private_key = _load_rsa_cert_key ()
1199+
1200+ # Signature with an unsupported digest algorithm
11991201 builder = (
12001202 pkcs7 .PKCS7SignatureBuilder ()
12011203 .set_data (data )
12021204 .add_signer (certificate , private_key , hashes .SHA384 ())
12031205 )
12041206 signature = builder .sign (serialization .Encoding .DER , [])
12051207
1206- # Verification with another certificate
1208+ # Verification
12071209 with pytest .raises (exceptions .UnsupportedAlgorithm ):
12081210 pkcs7 .pkcs7_verify_der (signature )
12091211
@@ -1263,9 +1265,7 @@ def test_pkcs7_verify_smime_with_content(
12631265 # Verification
12641266 pkcs7 .pkcs7_verify_smime (signed , content = data )
12651267
1266- def test_pkcs7_verify_smime_opaque_signing (
1267- self , backend , data , certificate , private_key
1268- ):
1268+ def test_pkcs7_verify_smime_opaque_signing (self , backend ):
12691269 # Signature
12701270 signed = load_vectors_from_file (
12711271 os .path .join ("pkcs7" , "signed-opaque.msg" ),
@@ -1283,9 +1283,7 @@ def test_pkcs7_verify_smime_opaque_signing(
12831283 b"Content-Type: multipart/signed;\n Hello world!" ,
12841284 ],
12851285 )
1286- def test_pkcs7_verify_smime_wrong_format (
1287- self , backend , data , certificate , signature
1288- ):
1286+ def test_pkcs7_verify_smime_wrong_format (self , backend , signature ):
12891287 with pytest .raises (ValueError ):
12901288 pkcs7 .pkcs7_verify_smime (signature )
12911289
0 commit comments