Skip to content

Commit 8ef3bcb

Browse files
committed
tool: add keyinfo applet
1 parent 8e2fc46 commit 8ef3bcb

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tool/main.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,33 @@ static int tool_pubkey(int argc, const char *argv[])
7171
return EXIT_SUCCESS;
7272
}
7373

74+
static int tool_keyinfo(int argc, const char *argv[])
75+
{
76+
libecdsaauth_key_t *key;
77+
char *pubkey;
78+
79+
if (argv[1] == NULL)
80+
{
81+
fprintf(stderr, "usage: ecdsatool pubkey privatekey.pem\n");
82+
return EXIT_FAILURE;
83+
}
84+
85+
key = libecdsaauth_key_load(argv[1]);
86+
87+
printf("Information on %s:\n", argv[1]);
88+
EC_KEY_print_fp(stdout, key->eckey, 4);
89+
90+
libecdsaauth_key_free(key);
91+
92+
return EXIT_SUCCESS;
93+
}
94+
7495
/**************************************************************************************/
7596

7697
static tool_applet_t tool_applets[] = {
7798
{"keygen", tool_keygen},
7899
{"pubkey", tool_pubkey},
100+
{"keyinfo", tool_keyinfo},
79101
{NULL, NULL}
80102
};
81103

0 commit comments

Comments
 (0)