diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptography/hazmat/primitives/asymmetric/x25519.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cryptography/hazmat/primitives/asymmetric/x25519.py b/src/cryptography/hazmat/primitives/asymmetric/x25519.py index e0329f9d..f4bdf3db 100644 --- a/src/cryptography/hazmat/primitives/asymmetric/x25519.py +++ b/src/cryptography/hazmat/primitives/asymmetric/x25519.py @@ -21,6 +21,10 @@ class X25519PublicKey(object): "X25519 is not supported by this version of OpenSSL.", _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM ) + + if len(data) != 32: + raise ValueError("An X25519 public key is 32 bytes long") + return backend.x25519_load_public_bytes(data) @abc.abstractmethod |