提交 e1631f51 编写于 作者: D Dr. Stephen Henson

Add list -public-key-methods

Reviewed-by: NRich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4015)
上级 48ed9c23
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
static LHASH_OF(FUNCTION) *prog_init(void); static LHASH_OF(FUNCTION) *prog_init(void);
static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[]); static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[]);
static void list_pkey(void); static void list_pkey(void);
static void list_pkey_meth(void);
static void list_type(FUNC_TYPE ft); static void list_type(FUNC_TYPE ft);
static void list_disabled(void); static void list_disabled(void);
char *default_config_file = NULL; char *default_config_file = NULL;
...@@ -308,7 +309,7 @@ typedef enum HELPLIST_CHOICE { ...@@ -308,7 +309,7 @@ typedef enum HELPLIST_CHOICE {
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
OPT_COMMANDS, OPT_DIGEST_COMMANDS, OPT_COMMANDS, OPT_DIGEST_COMMANDS,
OPT_DIGEST_ALGORITHMS, OPT_CIPHER_COMMANDS, OPT_CIPHER_ALGORITHMS, OPT_DIGEST_ALGORITHMS, OPT_CIPHER_COMMANDS, OPT_CIPHER_ALGORITHMS,
OPT_PK_ALGORITHMS, OPT_DISABLED, OPT_MISSING_HELP OPT_PK_ALGORITHMS, OPT_PK_METHOD, OPT_DISABLED, OPT_MISSING_HELP
} HELPLIST_CHOICE; } HELPLIST_CHOICE;
const OPTIONS list_options[] = { const OPTIONS list_options[] = {
...@@ -323,6 +324,8 @@ const OPTIONS list_options[] = { ...@@ -323,6 +324,8 @@ const OPTIONS list_options[] = {
"List of cipher algorithms"}, "List of cipher algorithms"},
{"public-key-algorithms", OPT_PK_ALGORITHMS, '-', {"public-key-algorithms", OPT_PK_ALGORITHMS, '-',
"List of public key algorithms"}, "List of public key algorithms"},
{"public-key-methods", OPT_PK_METHOD, '-',
"List of public key methods"},
{"disabled", OPT_DISABLED, '-', {"disabled", OPT_DISABLED, '-',
"List of disabled features"}, "List of disabled features"},
{"missing-help", OPT_MISSING_HELP, '-', {"missing-help", OPT_MISSING_HELP, '-',
...@@ -364,6 +367,9 @@ int list_main(int argc, char **argv) ...@@ -364,6 +367,9 @@ int list_main(int argc, char **argv)
case OPT_PK_ALGORITHMS: case OPT_PK_ALGORITHMS:
list_pkey(); list_pkey();
break; break;
case OPT_PK_METHOD:
list_pkey_meth();
break;
case OPT_DISABLED: case OPT_DISABLED:
list_disabled(); list_disabled();
break; break;
...@@ -540,6 +546,22 @@ static void list_pkey(void) ...@@ -540,6 +546,22 @@ static void list_pkey(void)
} }
} }
static void list_pkey_meth(void)
{
size_t i;
size_t meth_count = EVP_PKEY_meth_get_count();
for (i = 0; i < meth_count; i++) {
const EVP_PKEY_METHOD *pmeth = EVP_PKEY_meth_get0(i);
int pkey_id, pkey_flags;
EVP_PKEY_meth_get0_info(&pkey_id, &pkey_flags, pmeth);
BIO_printf(bio_out, "%s\n", OBJ_nid2ln(pkey_id));
BIO_printf(bio_out, "\tType: %s Algorithm\n",
pkey_flags & ASN1_PKEY_DYNAMIC ? "External" : "Builtin");
}
}
static int function_cmp(const FUNCTION * a, const FUNCTION * b) static int function_cmp(const FUNCTION * a, const FUNCTION * b)
{ {
return strncmp(a->name, b->name, 8); return strncmp(a->name, b->name, 8);
......
...@@ -14,6 +14,7 @@ B<openssl list> ...@@ -14,6 +14,7 @@ B<openssl list>
[B<-cipher-commands>] [B<-cipher-commands>]
[B<-cipher-algorithms>] [B<-cipher-algorithms>]
[B<-public-key-algorithms>] [B<-public-key-algorithms>]
[B<-public-key-methods>]
[B<-disabled>] [B<-disabled>]
=head1 DESCRIPTION =head1 DESCRIPTION
...@@ -62,6 +63,11 @@ then B<foo> is an alias for the official algorithm name, B<bar>. ...@@ -62,6 +63,11 @@ then B<foo> is an alias for the official algorithm name, B<bar>.
Display a list of public key algorithms, with each algorithm as Display a list of public key algorithms, with each algorithm as
a block of multiple lines, all but the first are indented. a block of multiple lines, all but the first are indented.
=item B<-public-key-methods>
Display a list of public key method OIDs: this also includes public key methods
without an associated ASN.1 method, for example, KDF algorithms.
=item B<-disabled> =item B<-disabled>
Display a list of disabled features, those that were compiled out Display a list of disabled features, those that were compiled out
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册