summaryrefslogtreecommitdiffhomepage
path: root/tests/test_ecdsa_password_256.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_256.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_256.key')
-rw-r--r--tests/test_ecdsa_password_256.key8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test_ecdsa_password_256.key b/tests/test_ecdsa_password_256.key
new file mode 100644
index 00000000..eb7910ed
--- /dev/null
+++ b/tests/test_ecdsa_password_256.key
@@ -0,0 +1,8 @@
+-----BEGIN EC PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: AES-128-CBC,EEB56BC745EDB2DE04FC3FE1F8DA387E
+
+wdt7QTCa6ahTJLaEPH7NhHyBcxhzrzf93d4UwQOuAhkM6//jKD4lF9fErHBW0f3B
+ExberCU3UxfEF3xX2thXiLw47JgeOCeQUlqRFx92p36k6YmfNGX6W8CsZ3d+XodF
+Z+pb6m285CiSX+W95NenFMexXFsIpntiCvTifTKJ8os=
+-----END EC PRIVATE KEY-----