diff options
Diffstat (limited to 'src/cryptography/hazmat/primitives/asymmetric')
-rw-r--r-- | src/cryptography/hazmat/primitives/asymmetric/utils.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/cryptography/hazmat/primitives/asymmetric/utils.py b/src/cryptography/hazmat/primitives/asymmetric/utils.py index 43d5b9bf..14d2abee 100644 --- a/src/cryptography/hazmat/primitives/asymmetric/utils.py +++ b/src/cryptography/hazmat/primitives/asymmetric/utils.py @@ -12,11 +12,10 @@ from cryptography.hazmat.primitives import hashes def decode_dss_signature(signature): - seq = DERReader(signature).read_single_element(SEQUENCE) - r = seq.read_element(INTEGER).as_integer() - s = seq.read_element(INTEGER).as_integer() - seq.check_empty() - return r, s + with DERReader(signature).read_single_element(SEQUENCE) as seq: + r = seq.read_element(INTEGER).as_integer() + s = seq.read_element(INTEGER).as_integer() + return r, s def encode_dss_signature(r, s): |