From f2c2dfd7ce179b1763a98747282ea2ce019d6c1a Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Tue, 19 Mar 2019 09:23:54 +0800 Subject: add new branch for unsupported openssh serialization (#4813) we don't support ed448 openssh keys so we'll use that to test this branch. if we ever do support ed448 keys we can always just call this private method directly to keep coverage. --- tests/hazmat/primitives/test_serialization.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/hazmat/primitives/test_serialization.py b/tests/hazmat/primitives/test_serialization.py index f7d186e8..6c86927a 100644 --- a/tests/hazmat/primitives/test_serialization.py +++ b/tests/hazmat/primitives/test_serialization.py @@ -16,7 +16,9 @@ from cryptography.hazmat.backends.interfaces import ( DERSerializationBackend, DSABackend, EllipticCurveBackend, PEMSerializationBackend, RSABackend ) -from cryptography.hazmat.primitives.asymmetric import dsa, ec, ed25519, rsa +from cryptography.hazmat.primitives.asymmetric import ( + dsa, ec, ed25519, ed448, rsa +) from cryptography.hazmat.primitives.serialization import ( BestAvailableEncryption, Encoding, NoEncryption, PrivateFormat, PublicFormat, @@ -1585,3 +1587,10 @@ class TestEd448Serialization(object): assert public_key.public_bytes( encoding, PublicFormat.SubjectPublicKeyInfo ) == data + + def test_openssh_serialization_unsupported(self, backend): + key = ed448.Ed448PrivateKey.generate().public_key() + with pytest.raises(ValueError): + key.public_bytes( + Encoding.OpenSSH, PublicFormat.OpenSSH + ) -- cgit v1.2.3