diff options
| author | Jon Simons <jon@jonsimons.org> | 2014-04-04 15:37:43 -0700 |
|---|---|---|
| committer | Andreas Schneider <asn@cryptomilk.org> | 2014-05-07 09:35:06 +0200 |
| commit | 8fe36e3d074d06065003394eb51106ea719b952d (patch) | |
| tree | 98a1ba493c80480bd49c5084c9859be09ae51fc3 /src | |
| parent | f2e9ce68e773dfa87253d911ee696993e2fca851 (diff) | |
pki crypto: expose new ssh_pki_key_ecdsa_name API
Enable retrieving the "ecdsa-sha2-nistpNNN" name of ECDSA keys with a
new 'ssh_pki_key_ecdsa_name' API. This gives more information than the
'ssh_key_type_to_char' API, which yields "ssh-ecdsa" for ECDSA keys.
The motivation is that this info is useful to have in a server context.
The torture_pki unit test is updated to include the new API, and a few
more passes are added to additionally test 384 and 521-bit keys.
Signed-off-by: Jon Simons <jon@jonsimons.org>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/pki_crypto.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/pki_crypto.c b/src/pki_crypto.c index 5e2585da..a81055e6 100644 --- a/src/pki_crypto.c +++ b/src/pki_crypto.c @@ -105,6 +105,20 @@ const char *pki_key_ecdsa_nid_to_name(int nid) return "unknown"; } +/** + * @brief returns the ECDSA key name ("ecdsa-sha2-nistp256" for example) + * + * @param[in] key the ssh_key whose ECDSA name to get + * + * @returns the ECDSA key name ("ecdsa-sha2-nistp256" for example) + * + * @returns "unknown" if the ECDSA key name is not known + */ +const char *ssh_pki_key_ecdsa_name(const ssh_key key) +{ + return pki_key_ecdsa_nid_to_name(key->ecdsa_nid); +} + static const char *pki_key_ecdsa_nid_to_char(int nid) { switch (nid) { |
