added support for certificate requests for not yet known CAs

This commit is contained in:
Martin Willi
2008-03-20 10:09:56 +00:00
parent 2b522ab450
commit 36524c4844
4 changed files with 31 additions and 5 deletions
+4
View File
@@ -25,6 +25,7 @@
ENUM(auth_item_names, AUTHN_CA_CERT, AUTHZ_AC_GROUP,
"AUTHN_CA_CERT",
"AUTHN_CA_CERT_KEYID",
"AUTHN_IM_CERT",
"AUTHN_SUBJECT_CERT",
"AUTHZ_PUBKEY",
@@ -162,6 +163,7 @@ static void add_item(private_auth_info_t *this, auth_item_t type, void *value)
item->value = method;
break;
}
case AUTHN_CA_CERT_KEYID:
case AUTHZ_AC_GROUP:
{
identification_t *id = (identification_t*)value;
@@ -189,6 +191,7 @@ static bool complies(private_auth_info_t *this, auth_info_t *constraints)
{
switch (type)
{
case AUTHN_CA_CERT_KEYID:
case AUTHN_CA_CERT:
case AUTHN_IM_CERT:
case AUTHN_SUBJECT_CERT:
@@ -322,6 +325,7 @@ static void destroy(private_auth_info_t *this)
free(item->value);
break;
}
case AUTHN_CA_CERT_KEYID:
case AUTHZ_AC_GROUP:
{
identification_t *id = (identification_t*)item->value;
+2
View File
@@ -61,6 +61,8 @@ enum auth_item_t {
/** CA certificate to use for authentication, value is certificate_t* */
AUTHN_CA_CERT,
/** Keyid of a CA certificate to use, value is identification_t* */
AUTHN_CA_CERT_KEYID,
/** intermediate certificate, value is certificate_t* */
AUTHN_IM_CERT,
/** certificate for trustchain verification, value is certificate_t* */
@@ -1064,6 +1064,25 @@ static bool auth_contains_cacert(auth_info_t *auth, certificate_t *cert)
found = TRUE;
break;
}
if (type == AUTHN_CA_CERT_KEYID)
{
public_key_t *public;
identification_t *certid, *keyid;
public = cert->get_public_key(cert);
if (public)
{
keyid = (identification_t*)value;
certid = public->get_id(public, keyid->get_type(keyid));
if (certid && certid->equals(certid, keyid))
{
public->destroy(public);
found = TRUE;
break;
}
public->destroy(public);
}
}
}
enumerator->destroy(enumerator);
return found;