aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives/test_asym_utils.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2014-11-30 09:51:10 -1000
committerPaul Kehrer <paul.l.kehrer@gmail.com>2014-11-30 09:51:10 -1000
commit94a0713e3aa1b2ec4f98fe1eb690ef2160d70fdf (patch)
tree377d423482faa4d32d9b6f3cacca162155d0a463 /tests/hazmat/primitives/test_asym_utils.py
parentb3a3e5c78650f0bbcaa5386e2185381156032d56 (diff)
downloadcryptography-94a0713e3aa1b2ec4f98fe1eb690ef2160d70fdf.tar.gz
cryptography-94a0713e3aa1b2ec4f98fe1eb690ef2160d70fdf.tar.bz2
cryptography-94a0713e3aa1b2ec4f98fe1eb690ef2160d70fdf.zip
error if signature has trailing bytes
Diffstat (limited to 'tests/hazmat/primitives/test_asym_utils.py')
-rw-r--r--tests/hazmat/primitives/test_asym_utils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/hazmat/primitives/test_asym_utils.py b/tests/hazmat/primitives/test_asym_utils.py
index f2f8850f..f8a67b68 100644
--- a/tests/hazmat/primitives/test_asym_utils.py
+++ b/tests/hazmat/primitives/test_asym_utils.py
@@ -4,6 +4,8 @@
from __future__ import absolute_import, division, print_function
+import pytest
+
from cryptography.hazmat.primitives.asymmetric.utils import (
decode_rfc6979_signature, encode_rfc6979_signature
)
@@ -32,3 +34,8 @@ def test_rfc6979_signature():
sig4 = encode_rfc6979_signature(-1, 0)
assert sig4 == b"0\x06\x02\x01\xFF\x02\x01\x00"
assert decode_rfc6979_signature(sig4) == (-1, 0)
+
+
+def test_decode_rfc6979_trailing_bytes():
+ with pytest.raises(ValueError):
+ decode_rfc6979_signature(b"0\x06\x02\x01\x01\x02\x01\x01\x00\x00\x00")