aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-01-09 21:44:24 +0100
committerAndreas Schneider <asn@cryptomilk.org>2018-01-10 22:31:02 +0100
commit3c65057fadacbc309b3780828818b50895fd8838 (patch)
tree7ff0ad32273103ca8446cf0afa61b0cd40dbc53d
parentf9b1dece418ec418493fb063ec5b70d52b06b2c2 (diff)
downloadlibssh-3c65057fadacbc309b3780828818b50895fd8838.tar.gz
libssh-3c65057fadacbc309b3780828818b50895fd8838.tar.xz
libssh-3c65057fadacbc309b3780828818b50895fd8838.zip
torture_key: Add ecdsa keys with passphrase
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--tests/torture_key.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/tests/torture_key.c b/tests/torture_key.c
index 1c8052f5..a52fcdac 100644
--- a/tests/torture_key.c
+++ b/tests/torture_key.c
@@ -213,6 +213,16 @@ static const char torture_ecdsa256_private_testkey[] =
"89Mlr7AUxcFPd+kCo+NE6yq/mNQcL7E6iQ==\n"
"-----END EC PRIVATE KEY-----\n";
+static const char torture_ecdsa256_private_testkey_passphrase[] =
+ "-----BEGIN EC PRIVATE KEY-----\n"
+ "Proc-Type: 4,ENCRYPTED\n"
+ "DEK-Info: AES-128-CBC,5C825E6FE821D0DE99D8403F4B4020CB\n"
+ "\n"
+ "TaUq8Qenb52dKAYcQGIYfdT7Z2DroySk38w51kw/gd8o79ZHaAQv60GtaNoy0203\n"
+ "2X1o29E6c0WsY9DKhSHKm/zzvZmL+ChZYqqh3sd1gp55aJsHNN4axiIu2YCbCavh\n"
+ "8VZn2VJDaitLy8ARqA/lMGQfqHSa3EOqti9FzWG/P6s=\n"
+ "-----END EC PRIVATE KEY-----\n";
+
static const char torture_ecdsa256_public_testkey[] =
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNT"
"YAAABBBMfvbnfPEORlrS3fsjLWGmqQvOYPtmS6e1bRRwNBGzR6gVEMaIfiJPPTJa+w"
@@ -226,6 +236,16 @@ static const char torture_ecdsa384_private_testkey[] =
"jkXlc5YbYHjueBbp0oeNXqsXHNAWQZo=\n"
"-----END EC PRIVATE KEY-----\n";
+static const char torture_ecdsa384_private_testkey_passphrase[] =
+ "-----BEGIN EC PRIVATE KEY-----\n"
+ "Proc-Type: 4,ENCRYPTED\n"
+ "DEK-Info: AES-128-CBC,5C825E6FE821D0DE99D8403F4B4020CB\n"
+ "\n"
+ "TaUq8Qenb52dKAYcQGIYfdT7Z2DroySk38w51kw/gd8o79ZHaAQv60GtaNoy0203\n"
+ "2X1o29E6c0WsY9DKhSHKm/zzvZmL+ChZYqqh3sd1gp55aJsHNN4axiIu2YCbCavh\n"
+ "8VZn2VJDaitLy8ARqA/lMGQfqHSa3EOqti9FzWG/P6s=\n"
+ "-----END EC PRIVATE KEY-----\n";
+
static const char torture_ecdsa384_public_testkey[] =
"ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzOD"
"QAAABhBFdzgE3oGtWjVAyLf6L8Hzku7tIy7MGL7U9sm2LzHP5LOCrriBoEY4r2j5Y5"
@@ -241,6 +261,18 @@ static const char torture_ecdsa521_private_testkey[] =
"KATU3h8gzTMkbrx8DJTFHEIjXBShs44HsSYVl3Xy\n"
"-----END EC PRIVATE KEY-----\n";
+static const char torture_ecdsa521_private_testkey_passphrase[] =
+ "-----BEGIN EC PRIVATE KEY-----\n"
+ "Proc-Type: 4,ENCRYPTED\n"
+ "DEK-Info: AES-128-CBC,24C4F383915BC07D9C63209BF6AD3DEE\n"
+ "\n"
+ "M+JGfpGfoH3Wn6XWSoHrGGevaS6p2vJGQdkFEIgUfh16s+U/LcRhAhRnhX/MV6Ds\n"
+ "OZTpusrjInlZXNUR97fJbmjr/600qUlh4y3U9ikiX3IXE+RI80TPNdishOOjKRF7\n"
+ "aWDW8UxTlFfU2Zc1Ew0pTvMXXcuTpozW1NNVY+6S9uWfHwq1/EcR35dbnEmG0gId\n"
+ "qsiEdVKh7p+9Qto8jcVWzMh7ANMcIwmxQ4zbvnqypwgAgpMbamWqBZ9q4egsVZKd\n"
+ "uRzL95L05ctOBGYNYqpPNIX3UdQU07kzwNC+yaHOb2s=\n"
+ "-----END EC PRIVATE KEY-----\n";
+
static const char torture_ecdsa521_public_testkey[] =
"ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1Mj"
"EAAACFBAHOg+9vHW2kJB50j7c7WkcCcOtwgZdeXMpAeEl17sFnTTrT8wYo1FCzE07w"
@@ -299,14 +331,14 @@ static const char *torture_get_testkey_internal(enum ssh_keytypes_e type,
if (pubkey) {
return torture_ecdsa521_public_testkey;
} else if (with_passphrase) {
- return NULL;
+ return torture_ecdsa521_private_testkey_passphrase;
}
return torture_ecdsa521_private_testkey;
} else if (bits == 384) {
if (pubkey) {
return torture_ecdsa384_public_testkey;
} else if (with_passphrase){
- return NULL;
+ return torture_ecdsa384_private_testkey_passphrase;
}
return torture_ecdsa384_private_testkey;
}
@@ -314,7 +346,7 @@ static const char *torture_get_testkey_internal(enum ssh_keytypes_e type,
if (pubkey) {
return torture_ecdsa256_public_testkey;
} else if (with_passphrase){
- return NULL;
+ return torture_ecdsa256_private_testkey_passphrase;
}
return torture_ecdsa256_private_testkey;
case SSH_KEYTYPE_ED25519: