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 /src/cryptography/hazmat/backends/openssl/utils.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 'src/cryptography/hazmat/backends/openssl/utils.py')
-rw-r--r-- | src/cryptography/hazmat/backends/openssl/utils.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/utils.py b/src/cryptography/hazmat/backends/openssl/utils.py index e8b4a307..f71a62a5 100644 --- a/src/cryptography/hazmat/backends/openssl/utils.py +++ b/src/cryptography/hazmat/backends/openssl/utils.py @@ -23,3 +23,11 @@ def _calculate_digest_and_algorithm(backend, data, algorithm): ) return (data, algorithm) + + +def _check_not_prehashed(signature_algorithm): + if isinstance(signature_algorithm, Prehashed): + raise TypeError( + "Prehashed is only supported in the sign and verify methods. " + "It cannot be used with signer or verifier." + ) |