From 9c2f3d6a05b117247b37323e1f8ed1cf6fa263d1 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Tue, 15 Jan 2019 21:52:08 -0600 Subject: support byteslike in X448PrivateKey.from_private_bytes (#4694) --- tests/hazmat/primitives/test_x448.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/hazmat') diff --git a/tests/hazmat/primitives/test_x448.py b/tests/hazmat/primitives/test_x448.py index 1833b03d..51be0e10 100644 --- a/tests/hazmat/primitives/test_x448.py +++ b/tests/hazmat/primitives/test_x448.py @@ -218,3 +218,15 @@ class TestX448Exchange(object): serialization.Encoding.PEM, serialization.PublicFormat.Raw ) + + def test_buffer_protocol(self, backend): + private_bytes = binascii.unhexlify( + b"9a8f4925d1519f5775cf46b04b5800d4ee9ee8bae8bc5565d498c28d" + b"d9c9baf574a9419744897391006382a6f127ab1d9ac2d8c0a598726b" + ) + key = X448PrivateKey.from_private_bytes(bytearray(private_bytes)) + assert key.private_bytes( + serialization.Encoding.Raw, + serialization.PrivateFormat.Raw, + serialization.NoEncryption() + ) == private_bytes -- cgit v1.2.3