aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2019-01-17 15:52:36 -0600
committerAlex Gaynor <alex.gaynor@gmail.com>2019-01-17 16:52:36 -0500
commit7f63e5b65d14dca6c4783d62fa5937a5a5c705e7 (patch)
treeebc9bf53582a508b4c674901367b8e5ff60dff73 /tests/hazmat
parent5b4c81e39622fc13895bf5df7d0f4f6bd067e7a0 (diff)
downloadcryptography-7f63e5b65d14dca6c4783d62fa5937a5a5c705e7.tar.gz
cryptography-7f63e5b65d14dca6c4783d62fa5937a5a5c705e7.tar.bz2
cryptography-7f63e5b65d14dca6c4783d62fa5937a5a5c705e7.zip
support bytes-like for X25519PrivateKey.from_private_bytes (#4698)
yuck.
Diffstat (limited to 'tests/hazmat')
-rw-r--r--tests/hazmat/primitives/test_x25519.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/hazmat/primitives/test_x25519.py b/tests/hazmat/primitives/test_x25519.py
index f412f2e8..17a91154 100644
--- a/tests/hazmat/primitives/test_x25519.py
+++ b/tests/hazmat/primitives/test_x25519.py
@@ -258,3 +258,12 @@ class TestX25519Exchange(object):
serialized = key.private_bytes(encoding, fmt, encryption)
loaded_key = load_func(serialized, passwd, backend)
assert isinstance(loaded_key, X25519PrivateKey)
+
+ def test_buffer_protocol(self, backend):
+ private_bytes = bytearray(os.urandom(32))
+ key = X25519PrivateKey.from_private_bytes(private_bytes)
+ assert key.private_bytes(
+ serialization.Encoding.Raw,
+ serialization.PrivateFormat.Raw,
+ serialization.NoEncryption()
+ ) == private_bytes