diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2016-11-22 10:49:42 +0800 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2016-11-21 21:49:42 -0500 |
commit | 191e6e90bf6e37404bb65a4bf9b8a3211d77395d (patch) | |
tree | c7887edbdde244db184fd88b41432589f1ed2096 /src | |
parent | ca4f79ede7483148ba6869ea7fdc514b4051633b (diff) | |
download | cryptography-191e6e90bf6e37404bb65a4bf9b8a3211d77395d.tar.gz cryptography-191e6e90bf6e37404bb65a4bf9b8a3211d77395d.tar.bz2 cryptography-191e6e90bf6e37404bb65a4bf9b8a3211d77395d.zip |
error if private_value is <= 0 in ec.derive_private_key (#3273)
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptography/hazmat/primitives/asymmetric/ec.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cryptography/hazmat/primitives/asymmetric/ec.py b/src/cryptography/hazmat/primitives/asymmetric/ec.py index 023a2d15..a527387b 100644 --- a/src/cryptography/hazmat/primitives/asymmetric/ec.py +++ b/src/cryptography/hazmat/primitives/asymmetric/ec.py @@ -257,6 +257,9 @@ def derive_private_key(private_value, curve, backend): if not isinstance(private_value, six.integer_types): raise TypeError("private_value must be an integer type.") + if private_value <= 0: + raise ValueError("private_value must be a positive integer.") + if not isinstance(curve, EllipticCurve): raise TypeError("curve must provide the EllipticCurve interface.") |