openssl: Add default fallback when calculating fingerprints of RSA keys
We still try to calculate these directly as it can avoid a dependency on the pkcs1 or other plugins. But for e.g. PGPv3 keys we need to delegate the actual fingerprint calculation to the pgp plugin.
This commit is contained in:
parent
22e1aa51f9
commit
01632eccf3
|
@ -222,7 +222,21 @@ bool openssl_rsa_fingerprint(RSA *rsa, cred_encoding_type_t type, chunk_t *fp)
|
|||
i2d_RSA_PUBKEY(rsa, &p);
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
{
|
||||
chunk_t n = chunk_empty, e = chunk_empty;
|
||||
bool success = FALSE;
|
||||
|
||||
if (openssl_bn2chunk(rsa->n, &n) &&
|
||||
openssl_bn2chunk(rsa->e, &e))
|
||||
{
|
||||
success = lib->encoding->encode(lib->encoding, type, rsa, fp,
|
||||
CRED_PART_RSA_MODULUS, n,
|
||||
CRED_PART_RSA_PUB_EXP, e, CRED_PART_END);
|
||||
}
|
||||
chunk_free(&n);
|
||||
chunk_free(&e);
|
||||
return success;
|
||||
}
|
||||
}
|
||||
hasher = lib->crypto->create_hasher(lib->crypto, HASH_SHA1);
|
||||
if (!hasher || !hasher->allocate_hash(hasher, key, fp))
|
||||
|
|
Loading…
Reference in New Issue