aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives/test_rsa.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2015-02-27 22:45:24 -0600
committerPaul Kehrer <paul.l.kehrer@gmail.com>2015-02-27 22:45:24 -0600
commit20456e96ed510f96c5bdc24b799b89200e3dba4c (patch)
treebccdd9d9bf2f7afb7ddaa3f941e3598d8409ae55 /tests/hazmat/primitives/test_rsa.py
parent6177cbe2fad1422899a2c26cb53abbbf97886485 (diff)
downloadcryptography-20456e96ed510f96c5bdc24b799b89200e3dba4c.tar.gz
cryptography-20456e96ed510f96c5bdc24b799b89200e3dba4c.tar.bz2
cryptography-20456e96ed510f96c5bdc24b799b89200e3dba4c.zip
add exact byte test
Diffstat (limited to 'tests/hazmat/primitives/test_rsa.py')
-rw-r--r--tests/hazmat/primitives/test_rsa.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/hazmat/primitives/test_rsa.py b/tests/hazmat/primitives/test_rsa.py
index 8dcb6450..dde73b06 100644
--- a/tests/hazmat/primitives/test_rsa.py
+++ b/tests/hazmat/primitives/test_rsa.py
@@ -1798,6 +1798,23 @@ class TestRSAPEMWriter(object):
priv_num = key.private_numbers()
assert loaded_priv_num == priv_num
+ def test_as_bytes_traditional_openssl_unencrypted_pem(self, backend):
+ key_bytes = load_vectors_from_file(
+ os.path.join(
+ "asymmetric",
+ "Traditional_OpenSSL_Serialization",
+ "testrsa.pem"
+ ),
+ lambda pemfile: pemfile.read().encode()
+ )
+ key = serialization.load_pem_private_key(key_bytes, None, backend)
+ serialized = key.as_bytes(
+ serialization.Encoding.PEM,
+ serialization.Format.TraditionalOpenSSL,
+ serialization.NoEncryption()
+ )
+ assert serialized == key_bytes
+
def test_as_bytes_invalid_encoding(self, backend):
key = RSA_KEY_2048.private_key(backend)
_skip_if_no_serialization(key, backend)