summaryrefslogtreecommitdiffhomepage
path: root/tests/test_ecdsa_password_384.key
diff options
context:
space:
mode:
authorAlex Orange <crazycasta@gmail.com>2016-04-25 13:53:06 -0600
committerAlex Orange <crazycasta@gmail.com>2016-04-25 14:56:51 -0600
commit39244216e4b8b1e0ef684473b9387dca7256bc37 (patch)
tree8abe3ac609c8ba18c61ff2743dd9df9423ddd596 /tests/test_ecdsa_password_384.key
parent86645149c9d066d5fe9222525c8bdf91df7f7de9 (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_password_384.key')
-rw-r--r--tests/test_ecdsa_password_384.key9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_ecdsa_password_384.key b/tests/test_ecdsa_password_384.key
new file mode 100644
index 00000000..eba33c14
--- /dev/null
+++ b/tests/test_ecdsa_password_384.key
@@ -0,0 +1,9 @@
+-----BEGIN EC PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: AES-128-CBC,7F7B5DBE4CE040D822441AFE7A023A1D
+
+y/d6tGonAXYgJniQoFCdto+CuT1y1s41qzwNLN9YdNq/+R/dtQvZAaOuGtHJRFE6
+wWabhY1bSjavVPT2z1Zw1jhDJX5HGrf9LDoyORKtUWtUJoUvGdYLHbcg8Q+//WRf
+R0A01YuSw1SJX0a225S1aRcsDAk1k5F8EMb8QzSSDgjAOI8ldQF35JI+ofNSGjgS
+BPOlorQXTJxDOGmokw/Wql6MbhajXKPO39H2Z53W88U=
+-----END EC PRIVATE KEY-----