tests: Add ecdsa publickey_from_privatekey test.
Этот коммит содержится в:
родитель
ecbdc589f4
Коммит
0e1992a9cc
@ -360,6 +360,29 @@ static void torture_pki_pki_publickey_from_privatekey_DSA(void **state) {
|
|||||||
ssh_key_free(pubkey);
|
ssh_key_free(pubkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void torture_pki_publickey_from_privatekey_ECDSA(void **state) {
|
||||||
|
int rc;
|
||||||
|
char *key_str;
|
||||||
|
ssh_key key;
|
||||||
|
ssh_key pubkey;
|
||||||
|
const char *passphrase = NULL;
|
||||||
|
|
||||||
|
(void) state; /* unused */
|
||||||
|
|
||||||
|
key_str = read_file(LIBSSH_ECDSA_TESTKEY);
|
||||||
|
assert_true(key_str != NULL);
|
||||||
|
|
||||||
|
rc = ssh_pki_import_privkey_base64(key_str, passphrase, NULL, NULL, &key);
|
||||||
|
assert_true(rc == 0);
|
||||||
|
|
||||||
|
rc = ssh_pki_export_privkey_to_pubkey(key, &pubkey);
|
||||||
|
assert_true(rc == SSH_OK);
|
||||||
|
|
||||||
|
free(key_str);
|
||||||
|
ssh_key_free(key);
|
||||||
|
ssh_key_free(pubkey);
|
||||||
|
}
|
||||||
|
|
||||||
static void torture_pki_publickey_dsa_base64(void **state)
|
static void torture_pki_publickey_dsa_base64(void **state)
|
||||||
{
|
{
|
||||||
enum ssh_keytypes_e type;
|
enum ssh_keytypes_e type;
|
||||||
@ -811,6 +834,9 @@ int torture_run_tests(void) {
|
|||||||
unit_test_setup_teardown(torture_pki_pki_publickey_from_privatekey_DSA,
|
unit_test_setup_teardown(torture_pki_pki_publickey_from_privatekey_DSA,
|
||||||
setup_dsa_key,
|
setup_dsa_key,
|
||||||
teardown),
|
teardown),
|
||||||
|
unit_test_setup_teardown(torture_pki_publickey_from_privatekey_ECDSA,
|
||||||
|
setup_ecdsa_key,
|
||||||
|
teardown),
|
||||||
/* public key */
|
/* public key */
|
||||||
unit_test_setup_teardown(torture_pki_publickey_dsa_base64,
|
unit_test_setup_teardown(torture_pki_publickey_dsa_base64,
|
||||||
setup_dsa_key,
|
setup_dsa_key,
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user