diff options
author | Alex Orange <crazycasta@gmail.com> | 2016-04-25 13:53:06 -0600 |
---|---|---|
committer | Alex Orange <crazycasta@gmail.com> | 2016-04-25 14:56:51 -0600 |
commit | 39244216e4b8b1e0ef684473b9387dca7256bc37 (patch) | |
tree | 8abe3ac609c8ba18c61ff2743dd9df9423ddd596 /tests/test_ecdsa_256.key | |
parent | 86645149c9d066d5fe9222525c8bdf91df7f7de9 (diff) |
Add support for ECDSA key sizes 384 and 521 alongside the existing 256.
Previously only 256-bit was handled and in certain cases (private key
reading) 384- and 521-bit keys were treated as 256-bit keys causing
silent errors.
Tests have been added to specifically test the 384 and 521 keysizes. As
RFC 5656 defines 256, 384, and 521 as the required keysizes this seems a
good set to test. Also, this will cover the branches at ecdsakey.py:55.
Test keys were renamed and test_client.py was modified as a result.
This also fixes two bugs in ecdsakey.py. First, when calculating bytes
needed to store a key, the assumption was made that the key size (in
bits) was divisible by 8 (see line 137). This has been fixed by rounding
up (wasn't an issue as only 256-bit keys were used before). Another bug
was that the key padding in asbytes was being done backwards (was
padding on current_length - needed_length bytes).
Diffstat (limited to 'tests/test_ecdsa_256.key')
-rw-r--r-- | tests/test_ecdsa_256.key | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/test_ecdsa_256.key b/tests/test_ecdsa_256.key new file mode 100644 index 00000000..42d44734 --- /dev/null +++ b/tests/test_ecdsa_256.key @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIKB6ty3yVyKEnfF/zprx0qwC76MsMlHY4HXCnqho2eKioAoGCCqGSM49 +AwEHoUQDQgAElI9mbdlaS+T9nHxY/59lFnn80EEecZDBHq4gLpccY8Mge5ZTMiMD +ADRvOqQ5R98Sxst765CAqXmRtz8vwoD96g== +-----END EC PRIVATE KEY----- |