diff options
author | Alex Stapleton <alexs@prol.etari.at> | 2014-02-07 07:49:17 +0000 |
---|---|---|
committer | Alex Stapleton <alexs@prol.etari.at> | 2014-02-07 07:55:05 +0000 |
commit | a3b85506a5ca19d4469679e2cbc665f423066baf (patch) | |
tree | db55f6e962fae04770880e892ae9271fc85012ee /tests/hazmat/primitives | |
parent | e237637231018ce571ab336e9885438902ece99e (diff) | |
download | cryptography-a3b85506a5ca19d4469679e2cbc665f423066baf.tar.gz cryptography-a3b85506a5ca19d4469679e2cbc665f423066baf.tar.bz2 cryptography-a3b85506a5ca19d4469679e2cbc665f423066baf.zip |
Check that public_exponent is odd
Diffstat (limited to 'tests/hazmat/primitives')
-rw-r--r-- | tests/hazmat/primitives/test_rsa.py | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/tests/hazmat/primitives/test_rsa.py b/tests/hazmat/primitives/test_rsa.py index 50b3f7a7..b89daac3 100644 --- a/tests/hazmat/primitives/test_rsa.py +++ b/tests/hazmat/primitives/test_rsa.py @@ -69,46 +69,54 @@ class TestRSA(object): def test_invalid_argument_values(self): # tiny example key - rsa.RSAPrivateKey(3, 5, 14, 8, 15) + rsa.RSAPrivateKey(3, 5, 14, 7, 15) # modulus too small with pytest.raises(ValueError): - rsa.RSAPrivateKey(3, 5, 14, 8, 2) + rsa.RSAPrivateKey(3, 5, 14, 7, 2) # modulus wrong with pytest.raises(ValueError): - rsa.RSAPrivateKey(3, 5, 14, 8, 16) + rsa.RSAPrivateKey(3, 5, 14, 7, 16) # p too high with pytest.raises(ValueError): - rsa.RSAPrivateKey(16, 5, 14, 8, 15) + rsa.RSAPrivateKey(16, 5, 14, 7, 15) # q too high with pytest.raises(ValueError): - rsa.RSAPrivateKey(3, 16, 14, 8, 15) + rsa.RSAPrivateKey(3, 16, 14, 7, 15) # private exp too high with pytest.raises(ValueError): - rsa.RSAPrivateKey(3, 5, 16, 8, 15) + rsa.RSAPrivateKey(3, 5, 16, 7, 15) # public exp too low with pytest.raises(ValueError): - rsa.RSAPrivateKey(3, 5, 14, 2, 15) + rsa.RSAPrivateKey(3, 5, 14, 1, 15) # public exp too high with pytest.raises(ValueError): - rsa.RSAPrivateKey(3, 5, 14, 16, 15) + rsa.RSAPrivateKey(3, 5, 14, 17, 15) - rsa.RSAPublicKey(8, 15) + # public exp not odd + with pytest.raises(ValueError): + rsa.RSAPrivateKey(3, 5, 14, 8, 15) + + rsa.RSAPublicKey(7, 15) # modulus too small with pytest.raises(ValueError): - rsa.RSAPublicKey(8, 2) + rsa.RSAPublicKey(7, 2) # public exp too low with pytest.raises(ValueError): - rsa.RSAPublicKey(2, 15) + rsa.RSAPublicKey(1, 15) # public exp too high with pytest.raises(ValueError): - rsa.RSAPublicKey(16, 15) + rsa.RSAPublicKey(17, 15) + + # public exp not odd + with pytest.raises(ValueError): + rsa.RSAPublicKey(8, 15) |