diff options
author | Jakub Jelen <jjelen@redhat.com> | 2019-05-29 16:04:42 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2019-06-13 11:00:56 +0200 |
commit | a3ddc48cb02c5e5835e24a9280da3bbfe7f30e5d (patch) | |
tree | e70fc4e29801e6da8fa48407238d8646ebaa58f5 /src | |
parent | 132ed59d3f2e39a2a4a6669bc58ec657aa0a5ad1 (diff) | |
download | libssh-a3ddc48cb02c5e5835e24a9280da3bbfe7f30e5d.tar.gz libssh-a3ddc48cb02c5e5835e24a9280da3bbfe7f30e5d.tar.xz libssh-a3ddc48cb02c5e5835e24a9280da3bbfe7f30e5d.zip |
pki: Derive correct algorithm identification for certificate authentication with SHA2 extension
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/pki.c | 41 |
1 files changed, 28 insertions, 13 deletions
@@ -213,20 +213,35 @@ const char * ssh_key_signature_to_char(enum ssh_keytypes_e type, enum ssh_digest_e hash_type) { - if (type != SSH_KEYTYPE_RSA) { - return ssh_key_type_to_char(type); - } - - switch (hash_type) { - case SSH_DIGEST_SHA256: - return "rsa-sha2-256"; - case SSH_DIGEST_SHA512: - return "rsa-sha2-512"; - case SSH_DIGEST_SHA1: - case SSH_DIGEST_AUTO: - return "ssh-rsa"; + switch (type) { + case SSH_KEYTYPE_RSA: + switch (hash_type) { + case SSH_DIGEST_SHA256: + return "rsa-sha2-256"; + case SSH_DIGEST_SHA512: + return "rsa-sha2-512"; + case SSH_DIGEST_SHA1: + case SSH_DIGEST_AUTO: + return "ssh-rsa"; + default: + return NULL; + } + break; + case SSH_KEYTYPE_RSA_CERT01: + switch (hash_type) { + case SSH_DIGEST_SHA256: + return "rsa-sha2-256-cert-v01@openssh.com"; + case SSH_DIGEST_SHA512: + return "rsa-sha2-512-cert-v01@openssh.com"; + case SSH_DIGEST_SHA1: + case SSH_DIGEST_AUTO: + return "ssh-rsa-cert-v01@openssh.com"; + default: + return NULL; + } + break; default: - return NULL; + return ssh_key_type_to_char(type); } /* We should never reach this */ |