diff options
| author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2017-06-02 07:51:09 -1000 | 
|---|---|---|
| committer | Alex Gaynor <alex.gaynor@gmail.com> | 2017-06-02 13:51:09 -0400 | 
| commit | 26fcc5c24d7ef7e905181ba044447ed15746c73b (patch) | |
| tree | 00d9d9d22f28434f57dab94fa03bd357558d6db0 /tests/hazmat/primitives/test_ec.py | |
| parent | a7e9a22886418b43ecdebd4ea3b5acba5425e822 (diff) | |
| download | cryptography-26fcc5c24d7ef7e905181ba044447ed15746c73b.tar.gz cryptography-26fcc5c24d7ef7e905181ba044447ed15746c73b.tar.bz2 cryptography-26fcc5c24d7ef7e905181ba044447ed15746c73b.zip | |
make signature and verification contexts error better re: prehashed (#3658)
* make signature and verification contexts error better re: prehashed
* code review feedback
Diffstat (limited to 'tests/hazmat/primitives/test_ec.py')
| -rw-r--r-- | tests/hazmat/primitives/test_ec.py | 16 | 
1 files changed, 16 insertions, 0 deletions
| diff --git a/tests/hazmat/primitives/test_ec.py b/tests/hazmat/primitives/test_ec.py index d5db52ab..d9177045 100644 --- a/tests/hazmat/primitives/test_ec.py +++ b/tests/hazmat/primitives/test_ec.py @@ -629,6 +629,22 @@ class TestECDSAVectors(object):                  b"\x00" * 32, data, ec.ECDSA(Prehashed(hashes.SHA256()))              ) +    def test_prehashed_unsupported_in_signer_ctx(self, backend): +        _skip_curve_unsupported(backend, ec.SECP256R1()) +        private_key = ec.generate_private_key(ec.SECP256R1(), backend) +        with pytest.raises(TypeError): +            private_key.signer(ec.ECDSA(Prehashed(hashes.SHA1()))) + +    def test_prehashed_unsupported_in_verifier_ctx(self, backend): +        _skip_curve_unsupported(backend, ec.SECP256R1()) +        private_key = ec.generate_private_key(ec.SECP256R1(), backend) +        public_key = private_key.public_key() +        with pytest.raises(TypeError): +            public_key.verifier( +                b"0" * 64, +                ec.ECDSA(Prehashed(hashes.SHA1())) +            ) +  class TestECNumbersEquality(object):      def test_public_numbers_eq(self): | 
