Skip to content

Commit

Permalink
add exact byte test
Browse files Browse the repository at this point in the history
  • Loading branch information
reaperhulk committed Feb 28, 2015
1 parent 6177cbe commit 20456e9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/hazmat/primitives/test_rsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -1798,6 +1798,23 @@ def test_as_bytes_unencrypted_pem(self, backend, fmt):
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)
Expand Down

0 comments on commit 20456e9

Please sign in to comment.