diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2017-07-25 18:36:04 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2017-07-29 23:04:10 +0100 |
commit | e1631f510882c9e7600d42ed789462a8e6c91ce7 (patch) | |
tree | f9e8a7a6034e6a570ccb9756ec7a864b6628f865 /apps | |
parent | 48ed9c23b052d3fed465967eb4193a7c87d0a24d (diff) | |
download | openssl-e1631f510882c9e7600d42ed789462a8e6c91ce7.tar.gz |
Add list -public-key-methods
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4015)
Diffstat (limited to 'apps')
-rw-r--r-- | apps/openssl.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/apps/openssl.c b/apps/openssl.c index 866c00e90b..0518ee6787 100644 --- a/apps/openssl.c +++ b/apps/openssl.c @@ -51,6 +51,7 @@ static LHASH_OF(FUNCTION) *prog_init(void); static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[]); static void list_pkey(void); +static void list_pkey_meth(void); static void list_type(FUNC_TYPE ft); static void list_disabled(void); char *default_config_file = NULL; @@ -308,7 +309,7 @@ typedef enum HELPLIST_CHOICE { OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_COMMANDS, OPT_DIGEST_COMMANDS, 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; const OPTIONS list_options[] = { @@ -323,6 +324,8 @@ const OPTIONS list_options[] = { "List of cipher algorithms"}, {"public-key-algorithms", OPT_PK_ALGORITHMS, '-', "List of public key algorithms"}, + {"public-key-methods", OPT_PK_METHOD, '-', + "List of public key methods"}, {"disabled", OPT_DISABLED, '-', "List of disabled features"}, {"missing-help", OPT_MISSING_HELP, '-', @@ -364,6 +367,9 @@ int list_main(int argc, char **argv) case OPT_PK_ALGORITHMS: list_pkey(); break; + case OPT_PK_METHOD: + list_pkey_meth(); + break; case OPT_DISABLED: list_disabled(); break; @@ -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) { return strncmp(a->name, b->name, 8); |