diff --git a/tests/hazmat/primitives/test_pkcs7.py b/tests/hazmat/primitives/test_pkcs7.py index 0787acef97a9..5261760d87f3 100644 --- a/tests/hazmat/primitives/test_pkcs7.py +++ b/tests/hazmat/primitives/test_pkcs7.py @@ -1192,7 +1192,7 @@ def test_smime_decrypt_no_recipient_match( ) # Test decryption with another RSA chain - with pytest.raises(x509.AttributeNotFound): + with pytest.raises(ValueError): pkcs7.pkcs7_decrypt_der( enveloped, another_cert, another_private_key, [] ) @@ -1219,7 +1219,7 @@ def test_smime_decrypt_not_enveloped( signed = builder.sign(serialization.Encoding.DER, options) # Test decryption failure with signed email - with pytest.raises(exceptions.UnsupportedAlgorithm): + with pytest.raises(ValueError): pkcs7.pkcs7_decrypt_der(signed, certificate, private_key, []) def test_smime_decrypt_smime_not_encrypted(