mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-08 00:02:03 -04:00
updated medsrv and test to new fingerprint/encoding API
This commit is contained in:
parent
1cd0d7969a
commit
9c3d2b3d60
@ -30,8 +30,8 @@ bool test_med_db()
|
|||||||
0x68,0x97,0x99,0x24,0x22,0xe0,0xde,0x21,
|
0x68,0x97,0x99,0x24,0x22,0xe0,0xde,0x21,
|
||||||
0xb9,0xd6,0x26,0x29
|
0xb9,0xd6,0x26,0x29
|
||||||
};
|
};
|
||||||
chunk_t keyid = chunk_from_buf(keyid_buf);
|
chunk_t found, keyid = chunk_from_buf(keyid_buf);
|
||||||
identification_t *id, *found;
|
identification_t *id;
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
public_key_t *public;
|
public_key_t *public;
|
||||||
auth_cfg_t *auth;
|
auth_cfg_t *auth;
|
||||||
@ -42,8 +42,11 @@ bool test_med_db()
|
|||||||
charon->credentials, KEY_ANY, id, NULL);
|
charon->credentials, KEY_ANY, id, NULL);
|
||||||
while (enumerator->enumerate(enumerator, &public, &auth))
|
while (enumerator->enumerate(enumerator, &public, &auth))
|
||||||
{
|
{
|
||||||
found = public->get_id(public, ID_PUBKEY_SHA1);
|
good = public->get_fingerprint(public, KEY_ID_PUBKEY_SHA1, &found);
|
||||||
good = chunk_equals(id->get_encoding(id), found->get_encoding(found));
|
if (good)
|
||||||
|
{
|
||||||
|
good = chunk_equals(id->get_encoding(id), found);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
id->destroy(id);
|
id->destroy(id);
|
||||||
|
@ -121,8 +121,7 @@ static bool parse_public_key(private_peer_controller_t *this,
|
|||||||
chunk_t *encoding, chunk_t *keyid)
|
chunk_t *encoding, chunk_t *keyid)
|
||||||
{
|
{
|
||||||
public_key_t *public;
|
public_key_t *public;
|
||||||
identification_t *id;
|
chunk_t blob, id;
|
||||||
chunk_t blob;
|
|
||||||
|
|
||||||
if (!public_key || *public_key == '\0')
|
if (!public_key || *public_key == '\0')
|
||||||
{
|
{
|
||||||
@ -140,11 +139,16 @@ static bool parse_public_key(private_peer_controller_t *this,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
/* TODO: use get_encoding() with an encoding type */
|
/* TODO: use get_encoding() with an encoding type */
|
||||||
|
if (!public->get_fingerprint(public, KEY_ID_PUBKEY_SHA1, &id) ||
|
||||||
|
!public->get_encoding(public, KEY_PUB_ASN1_DER, &blob))
|
||||||
|
{
|
||||||
|
request->setf(request, "error=Encoding public key failed.");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
*keyid = chunk_clone(id);
|
||||||
*encoding = asn1_wrap(ASN1_SEQUENCE, "cm",
|
*encoding = asn1_wrap(ASN1_SEQUENCE, "cm",
|
||||||
asn1_algorithmIdentifier(OID_RSA_ENCRYPTION),
|
asn1_algorithmIdentifier(OID_RSA_ENCRYPTION),
|
||||||
asn1_bitstring("m", public->get_encoding(public)));
|
asn1_bitstring("m", blob));
|
||||||
id = public->get_id(public, ID_PUBKEY_SHA1);
|
|
||||||
*keyid = chunk_clone(id->get_encoding(id));
|
|
||||||
public->destroy(public);
|
public->destroy(public);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user