diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2016-01-30 20:44:00 -0600 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2016-01-30 20:47:28 -0600 |
commit | a83913fd5b54cfc04c3f2b1e4a4adee5ee601ac1 (patch) | |
tree | 8436744eed23565cb0a1e98099b737824fcf6e5c /tests/hazmat/primitives/test_rsa.py | |
parent | 2c1458eca6afd83fd58c3e0929dec898a35a0c69 (diff) | |
download | cryptography-a83913fd5b54cfc04c3f2b1e4a4adee5ee601ac1.tar.gz cryptography-a83913fd5b54cfc04c3f2b1e4a4adee5ee601ac1.tar.bz2 cryptography-a83913fd5b54cfc04c3f2b1e4a4adee5ee601ac1.zip |
support rsa key generation testing when key is not serializable
Diffstat (limited to 'tests/hazmat/primitives/test_rsa.py')
-rw-r--r-- | tests/hazmat/primitives/test_rsa.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/hazmat/primitives/test_rsa.py b/tests/hazmat/primitives/test_rsa.py index c432db82..c0b8923f 100644 --- a/tests/hazmat/primitives/test_rsa.py +++ b/tests/hazmat/primitives/test_rsa.py @@ -60,6 +60,15 @@ class DummyHashAlgorithm(object): block_size = 64 +def _check_rsa_private_numbers_if_serializable(key): + if isinstance(key, rsa.RSAPrivateKeyWithSerialization): + _check_rsa_private_numbers(key.private_numbers()) + + +def test_check_rsa_private_numbers_if_serializable(): + _check_rsa_private_numbers_if_serializable("notserializable") + + def _flatten_pkcs1_examples(vectors): flattened_vectors = [] for vector in vectors: @@ -123,7 +132,7 @@ class TestRSA(object): skey = rsa.generate_private_key(public_exponent, key_size, backend) assert skey.key_size == key_size - _check_rsa_private_numbers(skey.private_numbers()) + _check_rsa_private_numbers_if_serializable(skey) pkey = skey.public_key() assert isinstance(pkey.public_numbers(), rsa.RSAPublicNumbers) |