diff options
Diffstat (limited to 'regress/unittests/sshkey/test_file.c')
-rw-r--r-- | regress/unittests/sshkey/test_file.c | 51 |
1 files changed, 1 insertions, 50 deletions
diff --git a/regress/unittests/sshkey/test_file.c b/regress/unittests/sshkey/test_file.c index 906491f2b..99b7e21c0 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.5 2015/10/06 01:20:59 djm Exp $ */ | 1 | /* $OpenBSD: test_file.c,v 1.6 2017/04/30 23:33:48 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Regress test for sshkey.h key management API | 3 | * Regress test for sshkey.h key management API |
4 | * | 4 | * |
@@ -51,55 +51,6 @@ sshkey_file_tests(void) | |||
51 | pw = load_text_file("pw"); | 51 | pw = load_text_file("pw"); |
52 | TEST_DONE(); | 52 | TEST_DONE(); |
53 | 53 | ||
54 | #ifdef WITH_SSH1 | ||
55 | TEST_START("parse RSA1 from private"); | ||
56 | buf = load_file("rsa1_1"); | ||
57 | ASSERT_INT_EQ(sshkey_parse_private_fileblob(buf, "", &k1, NULL), 0); | ||
58 | sshbuf_free(buf); | ||
59 | ASSERT_PTR_NE(k1, NULL); | ||
60 | a = load_bignum("rsa1_1.param.n"); | ||
61 | ASSERT_BIGNUM_EQ(k1->rsa->n, a); | ||
62 | BN_free(a); | ||
63 | TEST_DONE(); | ||
64 | |||
65 | TEST_START("parse RSA1 from private w/ passphrase"); | ||
66 | buf = load_file("rsa1_1_pw"); | ||
67 | ASSERT_INT_EQ(sshkey_parse_private_fileblob(buf, | ||
68 | (const char *)sshbuf_ptr(pw), &k2, NULL), 0); | ||
69 | sshbuf_free(buf); | ||
70 | ASSERT_PTR_NE(k2, NULL); | ||
71 | ASSERT_INT_EQ(sshkey_equal(k1, k2), 1); | ||
72 | sshkey_free(k2); | ||
73 | TEST_DONE(); | ||
74 | |||
75 | TEST_START("load RSA1 from public"); | ||
76 | ASSERT_INT_EQ(sshkey_load_public(test_data_file("rsa1_1.pub"), &k2, | ||
77 | NULL), 0); | ||
78 | ASSERT_PTR_NE(k2, NULL); | ||
79 | ASSERT_INT_EQ(sshkey_equal(k1, k2), 1); | ||
80 | sshkey_free(k2); | ||
81 | TEST_DONE(); | ||
82 | |||
83 | TEST_START("RSA1 key hex fingerprint"); | ||
84 | buf = load_text_file("rsa1_1.fp"); | ||
85 | cp = sshkey_fingerprint(k1, SSH_DIGEST_SHA256, SSH_FP_BASE64); | ||
86 | ASSERT_PTR_NE(cp, NULL); | ||
87 | ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf)); | ||
88 | sshbuf_free(buf); | ||
89 | free(cp); | ||
90 | TEST_DONE(); | ||
91 | |||
92 | TEST_START("RSA1 key bubblebabble fingerprint"); | ||
93 | buf = load_text_file("rsa1_1.fp.bb"); | ||
94 | cp = sshkey_fingerprint(k1, SSH_DIGEST_SHA1, SSH_FP_BUBBLEBABBLE); | ||
95 | ASSERT_PTR_NE(cp, NULL); | ||
96 | ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf)); | ||
97 | sshbuf_free(buf); | ||
98 | free(cp); | ||
99 | TEST_DONE(); | ||
100 | |||
101 | sshkey_free(k1); | ||
102 | #endif | ||
103 | 54 | ||
104 | TEST_START("parse RSA from private"); | 55 | TEST_START("parse RSA from private"); |
105 | buf = load_file("rsa_1"); | 56 | buf = load_file("rsa_1"); |