diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-04-15 14:16:35 -0400 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-04-20 16:53:03 -0500 |
commit | 7bdcdc175675bc78edaa7e0f931676652ab7a427 (patch) | |
tree | f33ccfc69cb384debea40eef14454667a15bd620 /tests | |
parent | 4d7d44e1be9f4bfe0aae9e395b231f34d431aaaf (diff) | |
download | cryptography-7bdcdc175675bc78edaa7e0f931676652ab7a427.tar.gz cryptography-7bdcdc175675bc78edaa7e0f931676652ab7a427.tar.bz2 cryptography-7bdcdc175675bc78edaa7e0f931676652ab7a427.zip |
remove OAEP decryption to simplify review
Diffstat (limited to 'tests')
-rw-r--r-- | tests/hazmat/backends/test_openssl.py | 51 | ||||
-rw-r--r-- | tests/hazmat/primitives/test_rsa.py | 59 |
2 files changed, 0 insertions, 110 deletions
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py index 46feae46..c589506f 100644 --- a/tests/hazmat/backends/test_openssl.py +++ b/tests/hazmat/backends/test_openssl.py @@ -291,54 +291,3 @@ class TestOpenSSLRSA(object): def test_unsupported_mgf1_hash_algorithm(self): assert backend.mgf1_hash_supported(DummyHash()) is False - - def test_unsupported_mgf1_hash_algorithm_decrypt(self): - private_key = rsa.RSAPrivateKey.generate( - public_exponent=65537, - key_size=512, - backend=backend - ) - with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_HASH): - private_key.decrypt( - b"ciphertext", - padding.OAEP( - mgf=padding.MGF1(algorithm=hashes.SHA256()), - algorithm=hashes.SHA1(), - label=None - ), - backend - ) - - def test_unsupported_oaep_hash_algorithm_decrypt(self): - private_key = rsa.RSAPrivateKey.generate( - public_exponent=65537, - key_size=512, - backend=backend - ) - with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_HASH): - private_key.decrypt( - b"ciphertext", - padding.OAEP( - mgf=padding.MGF1(algorithm=hashes.SHA1()), - algorithm=hashes.SHA256(), - label=None - ), - backend - ) - - def test_unsupported_oaep_label_decrypt(self): - private_key = rsa.RSAPrivateKey.generate( - public_exponent=65537, - key_size=512, - backend=backend - ) - with pytest.raises(ValueError): - private_key.decrypt( - b"ciphertext", - padding.OAEP( - mgf=padding.MGF1(algorithm=hashes.SHA1()), - algorithm=hashes.SHA1(), - label=b"label" - ), - backend - ) diff --git a/tests/hazmat/primitives/test_rsa.py b/tests/hazmat/primitives/test_rsa.py index c43fd0b5..74a0c111 100644 --- a/tests/hazmat/primitives/test_rsa.py +++ b/tests/hazmat/primitives/test_rsa.py @@ -1227,54 +1227,12 @@ class TestMGF1(object): assert mgf._salt_length == padding.MGF1.MAX_LENGTH -class TestOAEP(object): - def test_invalid_algorithm(self): - mgf = padding.MGF1(hashes.SHA1()) - with pytest.raises(TypeError): - padding.OAEP( - mgf=mgf, - algorithm=b"", - label=None - ) - - @pytest.mark.rsa class TestRSADecryption(object): @pytest.mark.parametrize( "vector", _flatten_pkcs1_examples(load_vectors_from_file( os.path.join( - "asymmetric", "RSA", "pkcs-1v2-1d2-vec", "oaep-vect.txt"), - load_pkcs1_vectors - )) - ) - def test_decrypt_oaep_vectors(self, vector, backend): - private, public, example = vector - skey = rsa.RSAPrivateKey( - p=private["p"], - q=private["q"], - private_exponent=private["private_exponent"], - dmp1=private["dmp1"], - dmq1=private["dmq1"], - iqmp=private["iqmp"], - public_exponent=private["public_exponent"], - modulus=private["modulus"] - ) - message = skey.decrypt( - binascii.unhexlify(example["encryption"]), - padding.OAEP( - mgf=padding.MGF1(algorithm=hashes.SHA1()), - algorithm=hashes.SHA1(), - label=None - ), - backend - ) - assert message == binascii.unhexlify(example["message"]) - - @pytest.mark.parametrize( - "vector", - _flatten_pkcs1_examples(load_vectors_from_file( - os.path.join( "asymmetric", "RSA", "pkcs1v15crypt-vectors.txt"), load_pkcs1_vectors )) @@ -1307,23 +1265,6 @@ class TestRSADecryption(object): with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_PADDING): private_key.decrypt(b"somedata", DummyPadding(), backend) - def test_unsupported_oaep_mgf(self, backend): - private_key = rsa.RSAPrivateKey.generate( - public_exponent=65537, - key_size=512, - backend=backend - ) - with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_MGF): - private_key.decrypt( - b"ciphertext", - padding.OAEP( - mgf=DummyMGF(), - algorithm=hashes.SHA1(), - label=None - ), - backend - ) - def test_decrypt_invalid_decrypt(self, backend): private_key = rsa.RSAPrivateKey.generate( public_exponent=65537, |