diff options
author | Damien Miller <djm@mindrot.org> | 2018-09-13 12:12:42 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2018-09-13 12:12:42 +1000 |
commit | 86112951d63d48839f035b5795be62635a463f99 (patch) | |
tree | d37a03940bedac4aefda3f63b8e99b378c42e07a /regress/unittests | |
parent | 482d23bcacdd3664f21cc82a5135f66fc598275f (diff) |
forgot to stage these test files in commit d70d061
Diffstat (limited to 'regress/unittests')
-rwxr-xr-x | regress/unittests/sshkey/mktestdata.sh | 14 | ||||
-rw-r--r-- | regress/unittests/sshkey/test_file.c | 20 |
2 files changed, 32 insertions, 2 deletions
diff --git a/regress/unittests/sshkey/mktestdata.sh b/regress/unittests/sshkey/mktestdata.sh index 8047bc62f..93da34c64 100755 --- a/regress/unittests/sshkey/mktestdata.sh +++ b/regress/unittests/sshkey/mktestdata.sh | |||
@@ -1,5 +1,5 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # $OpenBSD: mktestdata.sh,v 1.6 2017/04/30 23:33:48 djm Exp $ | 2 | # $OpenBSD: mktestdata.sh,v 1.7 2018/09/12 01:36:45 djm Exp $ |
3 | 3 | ||
4 | PW=mekmitasdigoat | 4 | PW=mekmitasdigoat |
5 | 5 | ||
@@ -128,6 +128,18 @@ ssh-keygen -s rsa_2 -I hugo -n user1,user2 \ | |||
128 | -Oforce-command=/bin/ls -Ono-port-forwarding -Osource-address=10.0.0.0/8 \ | 128 | -Oforce-command=/bin/ls -Ono-port-forwarding -Osource-address=10.0.0.0/8 \ |
129 | -V 19990101:20110101 -z 4 ed25519_1.pub | 129 | -V 19990101:20110101 -z 4 ed25519_1.pub |
130 | 130 | ||
131 | # Make a few RSA variant signature too. | ||
132 | cp rsa_1 rsa_1_sha1 | ||
133 | cp rsa_1 rsa_1_sha512 | ||
134 | cp rsa_1.pub rsa_1_sha1.pub | ||
135 | cp rsa_1.pub rsa_1_sha512.pub | ||
136 | ssh-keygen -s rsa_2 -I hugo -n user1,user2 -t ssh-rsa \ | ||
137 | -Oforce-command=/bin/ls -Ono-port-forwarding -Osource-address=10.0.0.0/8 \ | ||
138 | -V 19990101:20110101 -z 1 rsa_1_sha1.pub | ||
139 | ssh-keygen -s rsa_2 -I hugo -n user1,user2 -t rsa-sha2-512 \ | ||
140 | -Oforce-command=/bin/ls -Ono-port-forwarding -Osource-address=10.0.0.0/8 \ | ||
141 | -V 19990101:20110101 -z 1 rsa_1_sha512.pub | ||
142 | |||
131 | ssh-keygen -s ed25519_1 -I julius -n host1,host2 -h \ | 143 | ssh-keygen -s ed25519_1 -I julius -n host1,host2 -h \ |
132 | -V 19990101:20110101 -z 5 rsa_1.pub | 144 | -V 19990101:20110101 -z 5 rsa_1.pub |
133 | ssh-keygen -s ed25519_1 -I julius -n host1,host2 -h \ | 145 | ssh-keygen -s ed25519_1 -I julius -n host1,host2 -h \ |
diff --git a/regress/unittests/sshkey/test_file.c b/regress/unittests/sshkey/test_file.c index 99b7e21c0..0636e84bb 100644 --- a/regress/unittests/sshkey/test_file.c +++ b/regress/unittests/sshkey/test_file.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: test_file.c,v 1.6 2017/04/30 23:33:48 djm Exp $ */ | 1 | /* $OpenBSD: test_file.c,v 1.7 2018/09/12 01:36:45 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Regress test for sshkey.h key management API | 3 | * Regress test for sshkey.h key management API |
4 | * | 4 | * |
@@ -105,6 +105,24 @@ sshkey_file_tests(void) | |||
105 | sshkey_free(k2); | 105 | sshkey_free(k2); |
106 | TEST_DONE(); | 106 | TEST_DONE(); |
107 | 107 | ||
108 | TEST_START("load RSA cert with SHA1 signature"); | ||
109 | ASSERT_INT_EQ(sshkey_load_cert(test_data_file("rsa_1_sha1"), &k2), 0); | ||
110 | ASSERT_PTR_NE(k2, NULL); | ||
111 | ASSERT_INT_EQ(k2->type, KEY_RSA_CERT); | ||
112 | ASSERT_INT_EQ(sshkey_equal_public(k1, k2), 1); | ||
113 | ASSERT_STRING_EQ(k2->cert->signature_type, "ssh-rsa"); | ||
114 | sshkey_free(k2); | ||
115 | TEST_DONE(); | ||
116 | |||
117 | TEST_START("load RSA cert with SHA512 signature"); | ||
118 | ASSERT_INT_EQ(sshkey_load_cert(test_data_file("rsa_1_sha512"), &k2), 0); | ||
119 | ASSERT_PTR_NE(k2, NULL); | ||
120 | ASSERT_INT_EQ(k2->type, KEY_RSA_CERT); | ||
121 | ASSERT_INT_EQ(sshkey_equal_public(k1, k2), 1); | ||
122 | ASSERT_STRING_EQ(k2->cert->signature_type, "rsa-sha2-512"); | ||
123 | sshkey_free(k2); | ||
124 | TEST_DONE(); | ||
125 | |||
108 | TEST_START("load RSA cert"); | 126 | TEST_START("load RSA cert"); |
109 | ASSERT_INT_EQ(sshkey_load_cert(test_data_file("rsa_1"), &k2), 0); | 127 | ASSERT_INT_EQ(sshkey_load_cert(test_data_file("rsa_1"), &k2), 0); |
110 | ASSERT_PTR_NE(k2, NULL); | 128 | ASSERT_PTR_NE(k2, NULL); |