updated load-tester plugin to new fingerprinting API

This commit is contained in:
Martin Willi
2009-08-26 11:23:53 +02:00
parent 8eefe4617f
commit 1cd0d7969a
@@ -195,10 +195,11 @@ static enumerator_t* create_private_enumerator(private_load_tester_creds_t *this
} }
if (id) if (id)
{ {
identification_t *keyid; chunk_t keyid;
keyid = this->private->get_id(this->private, id->get_type(id)); if (!this->private->get_fingerprint(this->private,
if (!keyid || !keyid->equals(keyid, id)) KEY_ID_PUBKEY_SHA1, &keyid) ||
!chunk_equals(keyid, id->get_encoding(id)))
{ {
return NULL; return NULL;
} }
@@ -217,7 +218,7 @@ static enumerator_t* create_cert_enumerator(private_load_tester_creds_t *this,
public_key_t *peer_key, *ca_key; public_key_t *peer_key, *ca_key;
u_int32_t serial; u_int32_t serial;
time_t now; time_t now;
identification_t *keyid = NULL; chunk_t keyid;
if (this->ca == NULL) if (this->ca == NULL)
{ {
@@ -231,18 +232,25 @@ static enumerator_t* create_cert_enumerator(private_load_tester_creds_t *this,
{ {
return NULL; return NULL;
} }
if (!id)
{
return enumerator_create_single(this->ca, NULL);
}
ca_key = this->ca->get_public_key(this->ca); ca_key = this->ca->get_public_key(this->ca);
if (ca_key && id) if (ca_key)
{
if (ca_key->get_fingerprint(ca_key, KEY_ID_PUBKEY_SHA1, &keyid) &&
chunk_equals(keyid, id->get_encoding(id)))
{
ca_key->destroy(ca_key);
return enumerator_create_single(this->ca, NULL);
}
ca_key->destroy(ca_key);
}
if (this->ca->has_subject(this->ca, id))
{ {
keyid = ca_key->get_id(ca_key, id->get_type(id));
}
if (!id || this->ca->has_subject(this->ca, id) ||
(keyid && id->equals(id, keyid)))
{ /* ca certificate */
DESTROY_IF(ca_key);
return enumerator_create_single(this->ca, NULL); return enumerator_create_single(this->ca, NULL);
} }
DESTROY_IF(ca_key);
if (!trusted) if (!trusted)
{ {
/* peer certificate, generate on demand */ /* peer certificate, generate on demand */