diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-12-07 11:44:04 -0600 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-12-07 11:44:04 -0600 |
commit | a43964a0e90d7788b81521c9e7b949cdc2b555a0 (patch) | |
tree | 137b67f9ca66d141e51060001a810f613a5e9331 /src/cryptography/hazmat/primitives/asymmetric | |
parent | ae6db32351447bf41b809ea4b18f17641724dac1 (diff) | |
download | cryptography-a43964a0e90d7788b81521c9e7b949cdc2b555a0.tar.gz cryptography-a43964a0e90d7788b81521c9e7b949cdc2b555a0.tar.bz2 cryptography-a43964a0e90d7788b81521c9e7b949cdc2b555a0.zip |
catch PyAsn1Error for encoding signature as well
Diffstat (limited to 'src/cryptography/hazmat/primitives/asymmetric')
-rw-r--r-- | src/cryptography/hazmat/primitives/asymmetric/utils.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/cryptography/hazmat/primitives/asymmetric/utils.py b/src/cryptography/hazmat/primitives/asymmetric/utils.py index 08bb40c7..cf5973a0 100644 --- a/src/cryptography/hazmat/primitives/asymmetric/utils.py +++ b/src/cryptography/hazmat/primitives/asymmetric/utils.py @@ -32,7 +32,11 @@ def decode_rfc6979_signature(signature): def encode_rfc6979_signature(r, s): - sig = _DSSSigValue() - sig.setComponentByName('r', r) - sig.setComponentByName('s', s) + try: + sig = _DSSSigValue() + sig.setComponentByName('r', r) + sig.setComponentByName('s', s) + except PyAsn1Error: + raise ValueError("Both r and s must be integers") + return encoder.encode(sig) |