version 1.141, 2023/12/20 00:06:25 |
version 1.142, 2024/01/11 01:45:36 |
|
|
extern const struct sshkey_impl sshkey_rsa_sha256_cert_impl; |
extern const struct sshkey_impl sshkey_rsa_sha256_cert_impl; |
extern const struct sshkey_impl sshkey_rsa_sha512_impl; |
extern const struct sshkey_impl sshkey_rsa_sha512_impl; |
extern const struct sshkey_impl sshkey_rsa_sha512_cert_impl; |
extern const struct sshkey_impl sshkey_rsa_sha512_cert_impl; |
|
# ifdef WITH_DSA |
extern const struct sshkey_impl sshkey_dss_impl; |
extern const struct sshkey_impl sshkey_dss_impl; |
extern const struct sshkey_impl sshkey_dsa_cert_impl; |
extern const struct sshkey_impl sshkey_dsa_cert_impl; |
|
# endif |
#endif /* WITH_OPENSSL */ |
#endif /* WITH_OPENSSL */ |
#ifdef WITH_XMSS |
#ifdef WITH_XMSS |
extern const struct sshkey_impl sshkey_xmss_impl; |
extern const struct sshkey_impl sshkey_xmss_impl; |
|
|
&sshkey_ecdsa_sk_impl, |
&sshkey_ecdsa_sk_impl, |
&sshkey_ecdsa_sk_cert_impl, |
&sshkey_ecdsa_sk_cert_impl, |
&sshkey_ecdsa_sk_webauthn_impl, |
&sshkey_ecdsa_sk_webauthn_impl, |
|
# ifdef WITH_DSA |
&sshkey_dss_impl, |
&sshkey_dss_impl, |
&sshkey_dsa_cert_impl, |
&sshkey_dsa_cert_impl, |
|
# endif |
&sshkey_rsa_impl, |
&sshkey_rsa_impl, |
&sshkey_rsa_cert_impl, |
&sshkey_rsa_cert_impl, |
&sshkey_rsa_sha256_impl, |
&sshkey_rsa_sha256_impl, |
|
|
goto out; |
goto out; |
|
|
switch (key->type) { |
switch (key->type) { |
|
#ifdef WITH_DSA |
case KEY_DSA: |
case KEY_DSA: |
if (format == SSHKEY_PRIVATE_PEM) { |
if (format == SSHKEY_PRIVATE_PEM) { |
success = PEM_write_bio_DSAPrivateKey(bio, key->dsa, |
success = PEM_write_bio_DSAPrivateKey(bio, key->dsa, |
|
|
success = EVP_PKEY_set1_DSA(pkey, key->dsa); |
success = EVP_PKEY_set1_DSA(pkey, key->dsa); |
} |
} |
break; |
break; |
|
#endif |
case KEY_ECDSA: |
case KEY_ECDSA: |
if (format == SSHKEY_PRIVATE_PEM) { |
if (format == SSHKEY_PRIVATE_PEM) { |
success = PEM_write_bio_ECPrivateKey(bio, key->ecdsa, |
success = PEM_write_bio_ECPrivateKey(bio, key->ecdsa, |
|
|
} |
} |
if ((r = sshkey_check_rsa_length(prv, 0)) != 0) |
if ((r = sshkey_check_rsa_length(prv, 0)) != 0) |
goto out; |
goto out; |
|
#ifdef WITH_DSA |
} else if (EVP_PKEY_base_id(pk) == EVP_PKEY_DSA && |
} else if (EVP_PKEY_base_id(pk) == EVP_PKEY_DSA && |
(type == KEY_UNSPEC || type == KEY_DSA)) { |
(type == KEY_UNSPEC || type == KEY_DSA)) { |
if ((prv = sshkey_new(KEY_UNSPEC)) == NULL) { |
if ((prv = sshkey_new(KEY_UNSPEC)) == NULL) { |
|
|
prv->type = KEY_DSA; |
prv->type = KEY_DSA; |
#ifdef DEBUG_PK |
#ifdef DEBUG_PK |
DSA_print_fp(stderr, prv->dsa, 8); |
DSA_print_fp(stderr, prv->dsa, 8); |
|
#endif |
#endif |
#endif |
} else if (EVP_PKEY_base_id(pk) == EVP_PKEY_EC && |
} else if (EVP_PKEY_base_id(pk) == EVP_PKEY_EC && |
(type == KEY_UNSPEC || type == KEY_ECDSA)) { |
(type == KEY_UNSPEC || type == KEY_ECDSA)) { |