aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/hazmat/primitives/test_rsa.py10
-rw-r--r--tests/hazmat/primitives/utils.py14
2 files changed, 12 insertions, 12 deletions
diff --git a/tests/hazmat/primitives/test_rsa.py b/tests/hazmat/primitives/test_rsa.py
index 8e9637fd..a09d6d66 100644
--- a/tests/hazmat/primitives/test_rsa.py
+++ b/tests/hazmat/primitives/test_rsa.py
@@ -759,7 +759,7 @@ class TestRSAPSSMGF1VerificationSHA1(object):
"SigGenPSS_186-2.rsp",
"SigGenPSS_186-3.rsp",
],
- b"SHA1"
+ hashes.SHA1()
)
@@ -776,7 +776,7 @@ class TestRSAPSSMGF1VerificationSHA224(object):
"SigGenPSS_186-2.rsp",
"SigGenPSS_186-3.rsp",
],
- b"SHA224"
+ hashes.SHA224()
)
@@ -793,7 +793,7 @@ class TestRSAPSSMGF1VerificationSHA256(object):
"SigGenPSS_186-2.rsp",
"SigGenPSS_186-3.rsp",
],
- b"SHA256"
+ hashes.SHA256()
)
@@ -810,7 +810,7 @@ class TestRSAPSSMGF1VerificationSHA384(object):
"SigGenPSS_186-2.rsp",
"SigGenPSS_186-3.rsp",
],
- b"SHA384"
+ hashes.SHA384()
)
@@ -827,7 +827,7 @@ class TestRSAPSSMGF1VerificationSHA512(object):
"SigGenPSS_186-2.rsp",
"SigGenPSS_186-3.rsp",
],
- b"SHA512"
+ hashes.SHA512()
)
diff --git a/tests/hazmat/primitives/utils.py b/tests/hazmat/primitives/utils.py
index 884ce00c..31491023 100644
--- a/tests/hazmat/primitives/utils.py
+++ b/tests/hazmat/primitives/utils.py
@@ -376,32 +376,32 @@ def generate_hkdf_test(param_loader, path, file_names, algorithm):
return test_hkdf
-def generate_rsa_pss_test(param_loader, path, file_names, hash_name):
+def generate_rsa_pss_test(param_loader, path, file_names, hash_alg):
all_params = _load_all_params(path, file_names, param_loader)
- all_params = [i for i in all_params if i["algorithm"] == hash_name]
+ all_params = [i for i in all_params
+ if i["algorithm"] == hash_alg.name.upper()]
@pytest.mark.parametrize("params", all_params)
def test_rsa_pss(self, backend, params):
- rsa_pss_test(backend, params)
+ rsa_pss_test(backend, params, hash_alg)
return test_rsa_pss
-def rsa_pss_test(backend, params):
+def rsa_pss_test(backend, params, hash_alg):
public_key = rsa.RSAPublicKey(
public_exponent=params["public_exponent"],
modulus=params["modulus"]
)
- hash_cls = getattr(hashes, params["algorithm"].decode("utf8"))
verifier = public_key.verifier(
binascii.unhexlify(params["s"]),
padding.PSS(
mgf=padding.MGF1(
- algorithm=hash_cls(),
+ algorithm=hash_alg,
salt_length=params["salt_length"]
)
),
- hash_cls(),
+ hash_alg,
backend
)
verifier.update(binascii.unhexlify(params["msg"]))