aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-10-19 17:52:02 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2014-10-19 18:12:12 -0700
commiteccf37f6fe6b3af4c75ac6f2f432947c858fddcb (patch)
tree8b646fc6b5f490e0e5605c3fcab14f0e643e24d3 /tests
parent0123d4ca3c4a6b2da4a577b9943ec5bf4544246c (diff)
downloadcryptography-eccf37f6fe6b3af4c75ac6f2f432947c858fddcb.tar.gz
cryptography-eccf37f6fe6b3af4c75ac6f2f432947c858fddcb.tar.bz2
cryptography-eccf37f6fe6b3af4c75ac6f2f432947c858fddcb.zip
Fixes #1416 -- replaced assertions with error checking in EC key from numbers.
Includes tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/hazmat/primitives/test_ec.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/hazmat/primitives/test_ec.py b/tests/hazmat/primitives/test_ec.py
index 887520de..1b3bb9b3 100644
--- a/tests/hazmat/primitives/test_ec.py
+++ b/tests/hazmat/primitives/test_ec.py
@@ -274,6 +274,28 @@ class TestECDSAVectors(object):
with pytest.raises(ValueError):
numbers.private_key(backend)
+ numbers = ec.EllipticCurvePrivateNumbers(
+ 357646505660320080863666618182642070958081774038609089496899025506,
+ ec.EllipticCurvePublicNumbers(
+ -4725080841032702313157360200834589492768638177232556118553296,
+ 1120253292479243545483756778742719537373113335231773536789915,
+ ec.SECP256R1(),
+ )
+ )
+ with pytest.raises(ValueError):
+ numbers.private_key(backend)
+
+ numbers = ec.EllipticCurvePrivateNumbers(
+ 357646505660320080863666618182642070958081774038609089496899025506,
+ ec.EllipticCurvePublicNumbers(
+ 47250808410327023131573602008345894927686381772325561185532964,
+ -1120253292479243545483756778742719537373113335231773536789915,
+ ec.SECP256R1(),
+ )
+ )
+ with pytest.raises(ValueError):
+ numbers.private_key(backend)
+
@pytest.mark.parametrize(
"vector",
load_vectors_from_file(