aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat
diff options
context:
space:
mode:
authorAviv Palivoda <palaviv@gmail.com>2016-07-02 19:43:06 +0300
committerAlex Gaynor <alex.gaynor@gmail.com>2016-07-02 12:43:06 -0400
commit2120a8e090ff8974d727f76aae5f2f9eac56656c (patch)
treec79d3eaac5584d05bead50f516e5f5dac0cd4bea /tests/hazmat
parent14a9ad4c35a625088339e2e142907243adfffa99 (diff)
downloadcryptography-2120a8e090ff8974d727f76aae5f2f9eac56656c.tar.gz
cryptography-2120a8e090ff8974d727f76aae5f2f9eac56656c.tar.bz2
cryptography-2120a8e090ff8974d727f76aae5f2f9eac56656c.zip
One shot sign/verification ECDSA (#3029)
* Add sign and verify methods to ECDSA * Documented ECDSA sign/verify methods * Added CHANGELOG entry * Skipping test verify and sign if curve is not supported * Fixed typo in documentation return type * Removed provider language from EllipticCurvePrivateKey and EllipticCurvePublicKey
Diffstat (limited to 'tests/hazmat')
-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 8705f79c..dff2f3e1 100644
--- a/tests/hazmat/primitives/test_ec.py
+++ b/tests/hazmat/primitives/test_ec.py
@@ -503,6 +503,28 @@ class TestECDSAVectors(object):
else:
verifier.verify()
+ def test_sign(self, backend):
+ _skip_curve_unsupported(backend, ec.SECP256R1())
+ message = b"one little message"
+ algorithm = ec.ECDSA(hashes.SHA1())
+ private_key = ec.generate_private_key(ec.SECP256R1(), backend)
+ signature = private_key.sign(message, algorithm)
+ public_key = private_key.public_key()
+ verifier = public_key.verifier(signature, algorithm)
+ verifier.update(message)
+ verifier.verify()
+
+ def test_verify(self, backend):
+ _skip_curve_unsupported(backend, ec.SECP256R1())
+ message = b"one little message"
+ algorithm = ec.ECDSA(hashes.SHA1())
+ private_key = ec.generate_private_key(ec.SECP256R1(), backend)
+ signer = private_key.signer(algorithm)
+ signer.update(message)
+ signature = signer.finalize()
+ public_key = private_key.public_key()
+ public_key.verify(signature, message, algorithm)
+
class TestECNumbersEquality(object):
def test_public_numbers_eq(self):