1 /* $OpenBSD: ssh-rsa.c,v 1.79 2023/03/05 05:34:09 dtucker Exp $ */
3 * Copyright (c) 2000, 2003 Markus Friedl <markus@openbsd.org>
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 #include <sys/types.h>
24 #include <openssl/evp.h>
25 #include <openssl/err.h>
32 #define SSHKEY_INTERNAL
37 #include "openbsd-compat/openssl-compat.h"
39 static int openssh_RSA_verify(int, u_char *, size_t, u_char *, size_t, RSA *);
42 ssh_rsa_size(const struct sshkey *key)
48 RSA_get0_key(key->rsa, &rsa_n, NULL, NULL);
49 return BN_num_bits(rsa_n);
53 ssh_rsa_alloc(struct sshkey *k)
55 if ((k->rsa = RSA_new()) == NULL)
56 return SSH_ERR_ALLOC_FAIL;
61 ssh_rsa_cleanup(struct sshkey *k)
68 ssh_rsa_equal(const struct sshkey *a, const struct sshkey *b)
70 const BIGNUM *rsa_e_a, *rsa_n_a;
71 const BIGNUM *rsa_e_b, *rsa_n_b;
73 if (a->rsa == NULL || b->rsa == NULL)
75 RSA_get0_key(a->rsa, &rsa_n_a, &rsa_e_a, NULL);
76 RSA_get0_key(b->rsa, &rsa_n_b, &rsa_e_b, NULL);
77 if (rsa_e_a == NULL || rsa_e_b == NULL)
79 if (rsa_n_a == NULL || rsa_n_b == NULL)
81 if (BN_cmp(rsa_e_a, rsa_e_b) != 0)
83 if (BN_cmp(rsa_n_a, rsa_n_b) != 0)
89 ssh_rsa_serialize_public(const struct sshkey *key, struct sshbuf *b,
90 enum sshkey_serialize_rep opts)
93 const BIGNUM *rsa_n, *rsa_e;
96 return SSH_ERR_INVALID_ARGUMENT;
97 RSA_get0_key(key->rsa, &rsa_n, &rsa_e, NULL);
98 if ((r = sshbuf_put_bignum2(b, rsa_e)) != 0 ||
99 (r = sshbuf_put_bignum2(b, rsa_n)) != 0)
106 ssh_rsa_serialize_private(const struct sshkey *key, struct sshbuf *b,
107 enum sshkey_serialize_rep opts)
110 const BIGNUM *rsa_n, *rsa_e, *rsa_d, *rsa_iqmp, *rsa_p, *rsa_q;
112 RSA_get0_key(key->rsa, &rsa_n, &rsa_e, &rsa_d);
113 RSA_get0_factors(key->rsa, &rsa_p, &rsa_q);
114 RSA_get0_crt_params(key->rsa, NULL, NULL, &rsa_iqmp);
116 if (!sshkey_is_cert(key)) {
117 /* Note: can't reuse ssh_rsa_serialize_public: e, n vs. n, e */
118 if ((r = sshbuf_put_bignum2(b, rsa_n)) != 0 ||
119 (r = sshbuf_put_bignum2(b, rsa_e)) != 0)
122 if ((r = sshbuf_put_bignum2(b, rsa_d)) != 0 ||
123 (r = sshbuf_put_bignum2(b, rsa_iqmp)) != 0 ||
124 (r = sshbuf_put_bignum2(b, rsa_p)) != 0 ||
125 (r = sshbuf_put_bignum2(b, rsa_q)) != 0)
132 ssh_rsa_generate(struct sshkey *k, int bits)
136 int ret = SSH_ERR_INTERNAL_ERROR;
138 if (bits < SSH_RSA_MINIMUM_MODULUS_SIZE ||
139 bits > SSHBUF_MAX_BIGNUM * 8)
140 return SSH_ERR_KEY_LENGTH;
141 if ((private = RSA_new()) == NULL || (f4 = BN_new()) == NULL) {
142 ret = SSH_ERR_ALLOC_FAIL;
145 if (!BN_set_word(f4, RSA_F4) ||
146 !RSA_generate_key_ex(private, bits, f4, NULL)) {
147 ret = SSH_ERR_LIBCRYPTO_ERROR;
160 ssh_rsa_copy_public(const struct sshkey *from, struct sshkey *to)
162 const BIGNUM *rsa_n, *rsa_e;
163 BIGNUM *rsa_n_dup = NULL, *rsa_e_dup = NULL;
164 int r = SSH_ERR_INTERNAL_ERROR;
166 RSA_get0_key(from->rsa, &rsa_n, &rsa_e, NULL);
167 if ((rsa_n_dup = BN_dup(rsa_n)) == NULL ||
168 (rsa_e_dup = BN_dup(rsa_e)) == NULL) {
169 r = SSH_ERR_ALLOC_FAIL;
172 if (!RSA_set0_key(to->rsa, rsa_n_dup, rsa_e_dup, NULL)) {
173 r = SSH_ERR_LIBCRYPTO_ERROR;
176 rsa_n_dup = rsa_e_dup = NULL; /* transferred */
180 BN_clear_free(rsa_n_dup);
181 BN_clear_free(rsa_e_dup);
186 ssh_rsa_deserialize_public(const char *ktype, struct sshbuf *b,
189 int ret = SSH_ERR_INTERNAL_ERROR;
190 BIGNUM *rsa_n = NULL, *rsa_e = NULL;
192 if (sshbuf_get_bignum2(b, &rsa_e) != 0 ||
193 sshbuf_get_bignum2(b, &rsa_n) != 0) {
194 ret = SSH_ERR_INVALID_FORMAT;
197 if (!RSA_set0_key(key->rsa, rsa_n, rsa_e, NULL)) {
198 ret = SSH_ERR_LIBCRYPTO_ERROR;
201 rsa_n = rsa_e = NULL; /* transferred */
202 if ((ret = sshkey_check_rsa_length(key, 0)) != 0)
205 RSA_print_fp(stderr, key->rsa, 8);
210 BN_clear_free(rsa_n);
211 BN_clear_free(rsa_e);
216 ssh_rsa_deserialize_private(const char *ktype, struct sshbuf *b,
220 BIGNUM *rsa_n = NULL, *rsa_e = NULL, *rsa_d = NULL;
221 BIGNUM *rsa_iqmp = NULL, *rsa_p = NULL, *rsa_q = NULL;
223 /* Note: can't reuse ssh_rsa_deserialize_public: e, n vs. n, e */
224 if (!sshkey_is_cert(key)) {
225 if ((r = sshbuf_get_bignum2(b, &rsa_n)) != 0 ||
226 (r = sshbuf_get_bignum2(b, &rsa_e)) != 0)
228 if (!RSA_set0_key(key->rsa, rsa_n, rsa_e, NULL)) {
229 r = SSH_ERR_LIBCRYPTO_ERROR;
232 rsa_n = rsa_e = NULL; /* transferred */
234 if ((r = sshbuf_get_bignum2(b, &rsa_d)) != 0 ||
235 (r = sshbuf_get_bignum2(b, &rsa_iqmp)) != 0 ||
236 (r = sshbuf_get_bignum2(b, &rsa_p)) != 0 ||
237 (r = sshbuf_get_bignum2(b, &rsa_q)) != 0)
239 if (!RSA_set0_key(key->rsa, NULL, NULL, rsa_d)) {
240 r = SSH_ERR_LIBCRYPTO_ERROR;
243 rsa_d = NULL; /* transferred */
244 if (!RSA_set0_factors(key->rsa, rsa_p, rsa_q)) {
245 r = SSH_ERR_LIBCRYPTO_ERROR;
248 rsa_p = rsa_q = NULL; /* transferred */
249 if ((r = sshkey_check_rsa_length(key, 0)) != 0)
251 if ((r = ssh_rsa_complete_crt_parameters(key, rsa_iqmp)) != 0)
253 if (RSA_blinding_on(key->rsa, NULL) != 1) {
254 r = SSH_ERR_LIBCRYPTO_ERROR;
260 BN_clear_free(rsa_n);
261 BN_clear_free(rsa_e);
262 BN_clear_free(rsa_d);
263 BN_clear_free(rsa_p);
264 BN_clear_free(rsa_q);
265 BN_clear_free(rsa_iqmp);
270 rsa_hash_alg_ident(int hash_alg)
273 case SSH_DIGEST_SHA1:
275 case SSH_DIGEST_SHA256:
276 return "rsa-sha2-256";
277 case SSH_DIGEST_SHA512:
278 return "rsa-sha2-512";
284 * Returns the hash algorithm ID for a given algorithm identifier as used
285 * inside the signature blob,
288 rsa_hash_id_from_ident(const char *ident)
290 if (strcmp(ident, "ssh-rsa") == 0)
291 return SSH_DIGEST_SHA1;
292 if (strcmp(ident, "rsa-sha2-256") == 0)
293 return SSH_DIGEST_SHA256;
294 if (strcmp(ident, "rsa-sha2-512") == 0)
295 return SSH_DIGEST_SHA512;
300 * Return the hash algorithm ID for the specified key name. This includes
301 * all the cases of rsa_hash_id_from_ident() but also the certificate key
305 rsa_hash_id_from_keyname(const char *alg)
309 if ((r = rsa_hash_id_from_ident(alg)) != -1)
311 if (strcmp(alg, "ssh-rsa-cert-v01@openssh.com") == 0)
312 return SSH_DIGEST_SHA1;
313 if (strcmp(alg, "rsa-sha2-256-cert-v01@openssh.com") == 0)
314 return SSH_DIGEST_SHA256;
315 if (strcmp(alg, "rsa-sha2-512-cert-v01@openssh.com") == 0)
316 return SSH_DIGEST_SHA512;
321 rsa_hash_alg_nid(int type)
324 case SSH_DIGEST_SHA1:
326 case SSH_DIGEST_SHA256:
328 case SSH_DIGEST_SHA512:
336 ssh_rsa_complete_crt_parameters(struct sshkey *key, const BIGNUM *iqmp)
338 const BIGNUM *rsa_p, *rsa_q, *rsa_d;
339 BIGNUM *aux = NULL, *d_consttime = NULL;
340 BIGNUM *rsa_dmq1 = NULL, *rsa_dmp1 = NULL, *rsa_iqmp = NULL;
344 if (key == NULL || key->rsa == NULL ||
345 sshkey_type_plain(key->type) != KEY_RSA)
346 return SSH_ERR_INVALID_ARGUMENT;
348 RSA_get0_key(key->rsa, NULL, NULL, &rsa_d);
349 RSA_get0_factors(key->rsa, &rsa_p, &rsa_q);
351 if ((ctx = BN_CTX_new()) == NULL)
352 return SSH_ERR_ALLOC_FAIL;
353 if ((aux = BN_new()) == NULL ||
354 (rsa_dmq1 = BN_new()) == NULL ||
355 (rsa_dmp1 = BN_new()) == NULL)
356 return SSH_ERR_ALLOC_FAIL;
357 if ((d_consttime = BN_dup(rsa_d)) == NULL ||
358 (rsa_iqmp = BN_dup(iqmp)) == NULL) {
359 r = SSH_ERR_ALLOC_FAIL;
362 BN_set_flags(aux, BN_FLG_CONSTTIME);
363 BN_set_flags(d_consttime, BN_FLG_CONSTTIME);
365 if ((BN_sub(aux, rsa_q, BN_value_one()) == 0) ||
366 (BN_mod(rsa_dmq1, d_consttime, aux, ctx) == 0) ||
367 (BN_sub(aux, rsa_p, BN_value_one()) == 0) ||
368 (BN_mod(rsa_dmp1, d_consttime, aux, ctx) == 0)) {
369 r = SSH_ERR_LIBCRYPTO_ERROR;
372 if (!RSA_set0_crt_params(key->rsa, rsa_dmp1, rsa_dmq1, rsa_iqmp)) {
373 r = SSH_ERR_LIBCRYPTO_ERROR;
376 rsa_dmp1 = rsa_dmq1 = rsa_iqmp = NULL; /* transferred */
381 BN_clear_free(d_consttime);
382 BN_clear_free(rsa_dmp1);
383 BN_clear_free(rsa_dmq1);
384 BN_clear_free(rsa_iqmp);
389 /* RSASSA-PKCS1-v1_5 (PKCS #1 v2.0 signature) with SHA1 */
391 ssh_rsa_sign(struct sshkey *key,
392 u_char **sigp, size_t *lenp,
393 const u_char *data, size_t datalen,
394 const char *alg, const char *sk_provider, const char *sk_pin, u_int compat)
397 u_char digest[SSH_DIGEST_MAX_LENGTH], *sig = NULL;
400 int nid, hash_alg, ret = SSH_ERR_INTERNAL_ERROR;
401 struct sshbuf *b = NULL;
408 if (alg == NULL || strlen(alg) == 0)
409 hash_alg = SSH_DIGEST_SHA1;
411 hash_alg = rsa_hash_id_from_keyname(alg);
412 if (key == NULL || key->rsa == NULL || hash_alg == -1 ||
413 sshkey_type_plain(key->type) != KEY_RSA)
414 return SSH_ERR_INVALID_ARGUMENT;
415 RSA_get0_key(key->rsa, &rsa_n, NULL, NULL);
416 if (BN_num_bits(rsa_n) < SSH_RSA_MINIMUM_MODULUS_SIZE)
417 return SSH_ERR_KEY_LENGTH;
418 slen = RSA_size(key->rsa);
419 if (slen <= 0 || slen > SSHBUF_MAX_BIGNUM)
420 return SSH_ERR_INVALID_ARGUMENT;
423 nid = rsa_hash_alg_nid(hash_alg);
424 if ((hlen = ssh_digest_bytes(hash_alg)) == 0)
425 return SSH_ERR_INTERNAL_ERROR;
426 if ((ret = ssh_digest_memory(hash_alg, data, datalen,
427 digest, sizeof(digest))) != 0)
430 if ((sig = malloc(slen)) == NULL) {
431 ret = SSH_ERR_ALLOC_FAIL;
435 if (RSA_sign(nid, digest, hlen, sig, &len, key->rsa) != 1) {
436 ret = SSH_ERR_LIBCRYPTO_ERROR;
440 size_t diff = slen - len;
441 memmove(sig + diff, sig, len);
442 explicit_bzero(sig, diff);
443 } else if (len > slen) {
444 ret = SSH_ERR_INTERNAL_ERROR;
447 /* encode signature */
448 if ((b = sshbuf_new()) == NULL) {
449 ret = SSH_ERR_ALLOC_FAIL;
452 if ((ret = sshbuf_put_cstring(b, rsa_hash_alg_ident(hash_alg))) != 0 ||
453 (ret = sshbuf_put_string(b, sig, slen)) != 0)
457 if ((*sigp = malloc(len)) == NULL) {
458 ret = SSH_ERR_ALLOC_FAIL;
461 memcpy(*sigp, sshbuf_ptr(b), len);
467 explicit_bzero(digest, sizeof(digest));
474 ssh_rsa_verify(const struct sshkey *key,
475 const u_char *sig, size_t siglen,
476 const u_char *data, size_t dlen, const char *alg, u_int compat,
477 struct sshkey_sig_details **detailsp)
480 char *sigtype = NULL;
481 int hash_alg, want_alg, ret = SSH_ERR_INTERNAL_ERROR;
482 size_t len = 0, diff, modlen, hlen;
483 struct sshbuf *b = NULL;
484 u_char digest[SSH_DIGEST_MAX_LENGTH], *osigblob, *sigblob = NULL;
486 if (key == NULL || key->rsa == NULL ||
487 sshkey_type_plain(key->type) != KEY_RSA ||
488 sig == NULL || siglen == 0)
489 return SSH_ERR_INVALID_ARGUMENT;
490 RSA_get0_key(key->rsa, &rsa_n, NULL, NULL);
491 if (BN_num_bits(rsa_n) < SSH_RSA_MINIMUM_MODULUS_SIZE)
492 return SSH_ERR_KEY_LENGTH;
494 if ((b = sshbuf_from(sig, siglen)) == NULL)
495 return SSH_ERR_ALLOC_FAIL;
496 if (sshbuf_get_cstring(b, &sigtype, NULL) != 0) {
497 ret = SSH_ERR_INVALID_FORMAT;
500 if ((hash_alg = rsa_hash_id_from_ident(sigtype)) == -1) {
501 ret = SSH_ERR_KEY_TYPE_MISMATCH;
505 * Allow ssh-rsa-cert-v01 certs to generate SHA2 signatures for
506 * legacy reasons, but otherwise the signature type should match.
508 if (alg != NULL && strcmp(alg, "ssh-rsa-cert-v01@openssh.com") != 0) {
509 if ((want_alg = rsa_hash_id_from_keyname(alg)) == -1) {
510 ret = SSH_ERR_INVALID_ARGUMENT;
513 if (hash_alg != want_alg) {
514 ret = SSH_ERR_SIGNATURE_INVALID;
518 if (sshbuf_get_string(b, &sigblob, &len) != 0) {
519 ret = SSH_ERR_INVALID_FORMAT;
522 if (sshbuf_len(b) != 0) {
523 ret = SSH_ERR_UNEXPECTED_TRAILING_DATA;
526 /* RSA_verify expects a signature of RSA_size */
527 modlen = RSA_size(key->rsa);
529 ret = SSH_ERR_KEY_BITS_MISMATCH;
531 } else if (len < modlen) {
534 if ((sigblob = realloc(sigblob, modlen)) == NULL) {
535 sigblob = osigblob; /* put it back for clear/free */
536 ret = SSH_ERR_ALLOC_FAIL;
539 memmove(sigblob + diff, sigblob, len);
540 explicit_bzero(sigblob, diff);
543 if ((hlen = ssh_digest_bytes(hash_alg)) == 0) {
544 ret = SSH_ERR_INTERNAL_ERROR;
547 if ((ret = ssh_digest_memory(hash_alg, data, dlen,
548 digest, sizeof(digest))) != 0)
551 ret = openssh_RSA_verify(hash_alg, digest, hlen, sigblob, len,
554 freezero(sigblob, len);
557 explicit_bzero(digest, sizeof(digest));
563 * http://www.rsasecurity.com/rsalabs/pkcs/pkcs-1/
564 * ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1.asn
568 * id-sha1 OBJECT IDENTIFIER ::= { iso(1) identified-organization(3)
569 * oiw(14) secsig(3) algorithms(2) 26 }
571 static const u_char id_sha1[] = {
572 0x30, 0x21, /* type Sequence, length 0x21 (33) */
573 0x30, 0x09, /* type Sequence, length 0x09 */
574 0x06, 0x05, /* type OID, length 0x05 */
575 0x2b, 0x0e, 0x03, 0x02, 0x1a, /* id-sha1 OID */
576 0x05, 0x00, /* NULL */
577 0x04, 0x14 /* Octet string, length 0x14 (20), followed by sha1 hash */
581 * See http://csrc.nist.gov/groups/ST/crypto_apps_infra/csor/algorithms.html
582 * id-sha256 OBJECT IDENTIFIER ::= { joint-iso-itu-t(2) country(16) us(840)
583 * organization(1) gov(101) csor(3) nistAlgorithm(4) hashAlgs(2)
586 static const u_char id_sha256[] = {
587 0x30, 0x31, /* type Sequence, length 0x31 (49) */
588 0x30, 0x0d, /* type Sequence, length 0x0d (13) */
589 0x06, 0x09, /* type OID, length 0x09 */
590 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, /* id-sha256 */
591 0x05, 0x00, /* NULL */
592 0x04, 0x20 /* Octet string, length 0x20 (32), followed by sha256 hash */
596 * See http://csrc.nist.gov/groups/ST/crypto_apps_infra/csor/algorithms.html
597 * id-sha512 OBJECT IDENTIFIER ::= { joint-iso-itu-t(2) country(16) us(840)
598 * organization(1) gov(101) csor(3) nistAlgorithm(4) hashAlgs(2)
601 static const u_char id_sha512[] = {
602 0x30, 0x51, /* type Sequence, length 0x51 (81) */
603 0x30, 0x0d, /* type Sequence, length 0x0d (13) */
604 0x06, 0x09, /* type OID, length 0x09 */
605 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, /* id-sha512 */
606 0x05, 0x00, /* NULL */
607 0x04, 0x40 /* Octet string, length 0x40 (64), followed by sha512 hash */
611 rsa_hash_alg_oid(int hash_alg, const u_char **oidp, size_t *oidlenp)
614 case SSH_DIGEST_SHA1:
616 *oidlenp = sizeof(id_sha1);
618 case SSH_DIGEST_SHA256:
620 *oidlenp = sizeof(id_sha256);
622 case SSH_DIGEST_SHA512:
624 *oidlenp = sizeof(id_sha512);
627 return SSH_ERR_INVALID_ARGUMENT;
633 openssh_RSA_verify(int hash_alg, u_char *hash, size_t hashlen,
634 u_char *sigbuf, size_t siglen, RSA *rsa)
636 size_t rsasize = 0, oidlen = 0, hlen = 0;
637 int ret, len, oidmatch, hashmatch;
638 const u_char *oid = NULL;
639 u_char *decrypted = NULL;
641 if ((ret = rsa_hash_alg_oid(hash_alg, &oid, &oidlen)) != 0)
643 ret = SSH_ERR_INTERNAL_ERROR;
644 hlen = ssh_digest_bytes(hash_alg);
645 if (hashlen != hlen) {
646 ret = SSH_ERR_INVALID_ARGUMENT;
649 rsasize = RSA_size(rsa);
650 if (rsasize <= 0 || rsasize > SSHBUF_MAX_BIGNUM ||
651 siglen == 0 || siglen > rsasize) {
652 ret = SSH_ERR_INVALID_ARGUMENT;
655 if ((decrypted = malloc(rsasize)) == NULL) {
656 ret = SSH_ERR_ALLOC_FAIL;
659 if ((len = RSA_public_decrypt(siglen, sigbuf, decrypted, rsa,
660 RSA_PKCS1_PADDING)) < 0) {
661 ret = SSH_ERR_LIBCRYPTO_ERROR;
664 if (len < 0 || (size_t)len != hlen + oidlen) {
665 ret = SSH_ERR_INVALID_FORMAT;
668 oidmatch = timingsafe_bcmp(decrypted, oid, oidlen) == 0;
669 hashmatch = timingsafe_bcmp(decrypted + oidlen, hash, hlen) == 0;
670 if (!oidmatch || !hashmatch) {
671 ret = SSH_ERR_SIGNATURE_INVALID;
676 freezero(decrypted, rsasize);
680 static const struct sshkey_impl_funcs sshkey_rsa_funcs = {
681 /* .size = */ ssh_rsa_size,
682 /* .alloc = */ ssh_rsa_alloc,
683 /* .cleanup = */ ssh_rsa_cleanup,
684 /* .equal = */ ssh_rsa_equal,
685 /* .ssh_serialize_public = */ ssh_rsa_serialize_public,
686 /* .ssh_deserialize_public = */ ssh_rsa_deserialize_public,
687 /* .ssh_serialize_private = */ ssh_rsa_serialize_private,
688 /* .ssh_deserialize_private = */ ssh_rsa_deserialize_private,
689 /* .generate = */ ssh_rsa_generate,
690 /* .copy_public = */ ssh_rsa_copy_public,
691 /* .sign = */ ssh_rsa_sign,
692 /* .verify = */ ssh_rsa_verify,
695 const struct sshkey_impl sshkey_rsa_impl = {
696 /* .name = */ "ssh-rsa",
697 /* .shortname = */ "RSA",
698 /* .sigalg = */ NULL,
699 /* .type = */ KEY_RSA,
704 /* .funcs = */ &sshkey_rsa_funcs,
707 const struct sshkey_impl sshkey_rsa_cert_impl = {
708 /* .name = */ "ssh-rsa-cert-v01@openssh.com",
709 /* .shortname = */ "RSA-CERT",
710 /* .sigalg = */ NULL,
711 /* .type = */ KEY_RSA_CERT,
716 /* .funcs = */ &sshkey_rsa_funcs,
719 /* SHA2 signature algorithms */
721 const struct sshkey_impl sshkey_rsa_sha256_impl = {
722 /* .name = */ "rsa-sha2-256",
723 /* .shortname = */ "RSA",
724 /* .sigalg = */ NULL,
725 /* .type = */ KEY_RSA,
730 /* .funcs = */ &sshkey_rsa_funcs,
733 const struct sshkey_impl sshkey_rsa_sha512_impl = {
734 /* .name = */ "rsa-sha2-512",
735 /* .shortname = */ "RSA",
736 /* .sigalg = */ NULL,
737 /* .type = */ KEY_RSA,
742 /* .funcs = */ &sshkey_rsa_funcs,
745 const struct sshkey_impl sshkey_rsa_sha256_cert_impl = {
746 /* .name = */ "rsa-sha2-256-cert-v01@openssh.com",
747 /* .shortname = */ "RSA-CERT",
748 /* .sigalg = */ "rsa-sha2-256",
749 /* .type = */ KEY_RSA_CERT,
754 /* .funcs = */ &sshkey_rsa_funcs,
757 const struct sshkey_impl sshkey_rsa_sha512_cert_impl = {
758 /* .name = */ "rsa-sha2-512-cert-v01@openssh.com",
759 /* .shortname = */ "RSA-CERT",
760 /* .sigalg = */ "rsa-sha2-512",
761 /* .type = */ KEY_RSA_CERT,
766 /* .funcs = */ &sshkey_rsa_funcs,
768 #endif /* WITH_OPENSSL */