pluto uses KEY_ANY builder to parse PGP public keys
This commit is contained in:
+4
-23
@@ -172,36 +172,17 @@ static bool parse_pgp_pubkey_version_validity(chunk_t *packet, pgpcert_t *cert)
|
|||||||
static bool parse_pgp_pubkey_packet(chunk_t *packet, pgpcert_t *cert)
|
static bool parse_pgp_pubkey_packet(chunk_t *packet, pgpcert_t *cert)
|
||||||
{
|
{
|
||||||
chunk_t pubkey_packet = *packet;
|
chunk_t pubkey_packet = *packet;
|
||||||
pgp_pubkey_alg_t pubkey_alg;
|
|
||||||
|
|
||||||
if (!parse_pgp_pubkey_version_validity(packet, cert))
|
if (!parse_pgp_pubkey_version_validity(packet, cert))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* public key algorithm - 1 byte */
|
cert->public_key = lib->creds->create(lib->creds, CRED_PUBLIC_KEY, KEY_ANY,
|
||||||
pubkey_alg = pgp_length(packet, 1);
|
BUILD_BLOB_PGP, *packet, BUILD_END);
|
||||||
DBG(DBG_PARSING,
|
if (cert->public_key == NULL)
|
||||||
DBG_log("L3 - public key algorithm:");
|
|
||||||
DBG_log(" %N", pgp_pubkey_alg_names, pubkey_alg)
|
|
||||||
)
|
|
||||||
|
|
||||||
switch (pubkey_alg)
|
|
||||||
{
|
{
|
||||||
case PGP_PUBKEY_ALG_RSA:
|
return FALSE;
|
||||||
case PGP_PUBKEY_ALG_RSA_SIGN_ONLY:
|
|
||||||
cert->public_key = lib->creds->create(lib->creds,
|
|
||||||
CRED_PUBLIC_KEY, KEY_RSA,
|
|
||||||
BUILD_BLOB_PGP, *packet,
|
|
||||||
BUILD_END);
|
|
||||||
if (cert->public_key == NULL)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
plog(" non RSA public keys not supported");
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* compute V4 or V3 fingerprint according to section 12.2 of RFC 4880 */
|
/* compute V4 or V3 fingerprint according to section 12.2 of RFC 4880 */
|
||||||
|
|||||||
Reference in New Issue
Block a user