diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2017-12-10 19:07:14 -0500 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2017-12-11 08:07:14 +0800 |
commit | 740f3cd344a05bc644d8ec83271d922942d74389 (patch) | |
tree | 4489f37361c11c75c1cd18437c2d96ad8fa314f7 /tests/hazmat/primitives/test_rsa.py | |
parent | fe06f3a26e54e3f9caadc306e15e4ff965b95881 (diff) | |
download | cryptography-740f3cd344a05bc644d8ec83271d922942d74389.tar.gz cryptography-740f3cd344a05bc644d8ec83271d922942d74389.tar.bz2 cryptography-740f3cd344a05bc644d8ec83271d922942d74389.zip |
Fixed 120 warnings from the RSA tests (#4052)
* Fixed 120 warnings from the RSA tests
* typo
Diffstat (limited to 'tests/hazmat/primitives/test_rsa.py')
-rw-r--r-- | tests/hazmat/primitives/test_rsa.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/tests/hazmat/primitives/test_rsa.py b/tests/hazmat/primitives/test_rsa.py index 09820429..8bab29c4 100644 --- a/tests/hazmat/primitives/test_rsa.py +++ b/tests/hazmat/primitives/test_rsa.py @@ -425,29 +425,27 @@ class TestRSASignature(object): e=public["public_exponent"], n=public["modulus"] ).public_key(backend) - signer = private_key.signer( + signature = private_key.sign( + binascii.unhexlify(example["message"]), padding.PSS( mgf=padding.MGF1(algorithm=hashes.SHA1()), salt_length=padding.PSS.MAX_LENGTH ), hashes.SHA1() ) - signer.update(binascii.unhexlify(example["message"])) - signature = signer.finalize() assert len(signature) == math.ceil(private_key.key_size / 8.0) # PSS signatures contain randomness so we can't do an exact # signature check. Instead we'll verify that the signature created # successfully verifies. - verifier = public_key.verifier( + public_key.verify( signature, + binascii.unhexlify(example["message"]), padding.PSS( mgf=padding.MGF1(algorithm=hashes.SHA1()), salt_length=padding.PSS.MAX_LENGTH ), hashes.SHA1(), ) - verifier.update(binascii.unhexlify(example["message"])) - verifier.verify() @pytest.mark.parametrize( "hash_alg", @@ -787,16 +785,15 @@ class TestRSAVerification(object): e=public["public_exponent"], n=public["modulus"] ).public_key(backend) - verifier = public_key.verifier( + public_key.verify( binascii.unhexlify(example["signature"]), + binascii.unhexlify(example["message"]), padding.PSS( mgf=padding.MGF1(algorithm=hashes.SHA1()), salt_length=20 ), hashes.SHA1() ) - verifier.update(binascii.unhexlify(example["message"])) - verifier.verify() @pytest.mark.supported( only_if=lambda backend: backend.rsa_padding_supported( |