Skip to content

Commit

Permalink
test comments
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyMusatkin committed Oct 13, 2023
1 parent 1804d55 commit 094851a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/test_crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ def test_rsa_signing_roundtrip(self):
with self.subTest(msg="RSA Signing Roundtrip using algo p", p=p):
rsa = RSA.new_private_key_from_pem_data(RSA_PRIVATE_KEY_PEM)
signature = rsa.sign(p, digest)
self.assertEqual(rsa.verify(p, digest, signature), True)
self.assertTrue(rsa.verify(p, digest, signature))

rsa_pub = RSA.new_private_key_from_pem_data(RSA_PRIVATE_KEY_PEM)
self.assertEqual(rsa_pub.verify(p, digest, signature), True)
self.assertTrue(rsa_pub.verify(p, digest, signature))

def test_rsa_load_error(self):
with self.assertRaises(ValueError):
Expand All @@ -169,8 +169,8 @@ def test_rsa_signing_verify_fail(self):

rsa = RSA.new_private_key_from_pem_data(RSA_PRIVATE_KEY_PEM)
signature = rsa.sign(RSASignatureAlgorithm.PKCS1_5_SHA256, digest)
self.assertEqual(rsa.verify(RSASignatureAlgorithm.PKCS1_5_SHA256, digest2, signature), False)
self.assertEqual(rsa.verify(RSASignatureAlgorithm.PKCS1_5_SHA256, digest, b'bad signature'), False)
self.assertFalse(rsa.verify(RSASignatureAlgorithm.PKCS1_5_SHA256, digest2, signature))
self.assertFalse(rsa.verify(RSASignatureAlgorithm.PKCS1_5_SHA256, digest, b'bad signature'))


if __name__ == '__main__':
Expand Down

0 comments on commit 094851a

Please sign in to comment.