aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives/test_serialization.py
diff options
context:
space:
mode:
authorAlex Stapleton <alexs@prol.etari.at>2015-03-01 16:02:23 +0000
committerAlex Stapleton <alexs@prol.etari.at>2015-03-01 16:02:23 +0000
commit6bb9624186f3546dd203e3a20e7785dad71c6256 (patch)
treece9d0ea0d2e821557aac3abf0f01966a125a801e /tests/hazmat/primitives/test_serialization.py
parente8f12f833f14c55b18919a55db52d24cc8880ae9 (diff)
parent223a8f02a37a87b3c7366441647013cf9a18b061 (diff)
downloadcryptography-6bb9624186f3546dd203e3a20e7785dad71c6256.tar.gz
cryptography-6bb9624186f3546dd203e3a20e7785dad71c6256.tar.bz2
cryptography-6bb9624186f3546dd203e3a20e7785dad71c6256.zip
Merge pull request #1503 from reaperhulk/serialize-some-keys
Support for traditional OpenSSL and PKCS8 RSA private key serialization
Diffstat (limited to 'tests/hazmat/primitives/test_serialization.py')
-rw-r--r--tests/hazmat/primitives/test_serialization.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/hazmat/primitives/test_serialization.py b/tests/hazmat/primitives/test_serialization.py
index a17aac4b..fc8f8664 100644
--- a/tests/hazmat/primitives/test_serialization.py
+++ b/tests/hazmat/primitives/test_serialization.py
@@ -18,8 +18,8 @@ from cryptography.hazmat.backends.interfaces import (
)
from cryptography.hazmat.primitives.asymmetric import dsa, ec, rsa
from cryptography.hazmat.primitives.serialization import (
- load_der_private_key, load_der_public_key, load_pem_private_key,
- load_pem_public_key, load_ssh_public_key
+ BestAvailableEncryption, load_der_private_key, load_der_public_key,
+ load_pem_private_key, load_pem_public_key, load_ssh_public_key
)
@@ -1159,3 +1159,13 @@ class TestECDSASSHSerialization(object):
)
with pytest.raises(ValueError):
load_ssh_public_key(ssh_key, backend)
+
+
+class TestKeySerializationEncryptionTypes(object):
+ def test_non_bytes_password(self):
+ with pytest.raises(ValueError):
+ BestAvailableEncryption(object())
+
+ def test_encryption_with_zero_length_password(self):
+ with pytest.raises(ValueError):
+ BestAvailableEncryption(b"")