use a pluto specific credential builder to build pluto cert_t's
This commit is contained in:
@@ -24,6 +24,7 @@ ENUM(credential_type_names, CRED_PRIVATE_KEY, CRED_CERTIFICATE,
|
||||
"CRED_PRIVATE_KEY",
|
||||
"CRED_PUBLIC_KEY",
|
||||
"CRED_CERTIFICATE",
|
||||
"CRED_PLUTO_CERT",
|
||||
);
|
||||
|
||||
typedef struct private_credential_factory_t private_credential_factory_t;
|
||||
|
||||
@@ -36,6 +36,8 @@ enum credential_type_t {
|
||||
CRED_PUBLIC_KEY,
|
||||
/** certificates, implemented in certificate_t */
|
||||
CRED_CERTIFICATE,
|
||||
/** deprecated pluto style certificates */
|
||||
CRED_PLUTO_CERT,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -47,7 +49,7 @@ extern enum_name_t *credential_type_names;
|
||||
* Manages credential construction functions and creates instances.
|
||||
*/
|
||||
struct credential_factory_t {
|
||||
|
||||
|
||||
/**
|
||||
* Create a credential using a list of builder_part_t's.
|
||||
*
|
||||
@@ -96,9 +98,9 @@ struct credential_factory_t {
|
||||
builder_constructor_t constructor);
|
||||
|
||||
/**
|
||||
* Destroy a credential_factory instance.
|
||||
*/
|
||||
void (*destroy)(credential_factory_t *this);
|
||||
* Destroy a credential_factory instance.
|
||||
*/
|
||||
void (*destroy)(credential_factory_t *this);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -561,3 +561,11 @@ builder_t *certificate_pem_builder(certificate_type_t type)
|
||||
return pem_builder(CRED_CERTIFICATE, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pluto specific cert builder.
|
||||
*/
|
||||
builder_t *pluto_pem_builder(certificate_type_t type)
|
||||
{
|
||||
return pem_builder(CRED_PLUTO_CERT, type);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,5 +48,13 @@ builder_t *public_key_pem_builder(key_type_t type);
|
||||
*/
|
||||
builder_t *certificate_pem_builder(certificate_type_t type);
|
||||
|
||||
/**
|
||||
* Builder for PEM encoded pluto certificates of all kind.
|
||||
*
|
||||
* @param type type of the key
|
||||
* @return builder instance
|
||||
*/
|
||||
builder_t *pluto_pem_builder(certificate_type_t type);
|
||||
|
||||
#endif /** PEM_PRIVATE_KEY_H_ @}*/
|
||||
|
||||
|
||||
@@ -42,6 +42,8 @@ static void destroy(private_pem_plugin_t *this)
|
||||
(builder_constructor_t)public_key_pem_builder);
|
||||
lib->creds->remove_builder(lib->creds,
|
||||
(builder_constructor_t)certificate_pem_builder);
|
||||
lib->creds->remove_builder(lib->creds,
|
||||
(builder_constructor_t)pluto_pem_builder);
|
||||
free(this);
|
||||
}
|
||||
|
||||
@@ -92,6 +94,14 @@ plugin_t *plugin_create()
|
||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_PGP,
|
||||
(builder_constructor_t)certificate_pem_builder);
|
||||
|
||||
/* pluto specific credentials formats */
|
||||
lib->creds->add_builder(lib->creds, CRED_PLUTO_CERT, 0,
|
||||
(builder_constructor_t)pluto_cert_pem_builder);
|
||||
lib->creds->add_builder(lib->creds, CRED_PLUTO_CRL, 0,
|
||||
(builder_constructor_t)pluto_crl_pem_builder);
|
||||
lib->creds->add_builder(lib->creds, CRED_PLUTO_AC, 0,
|
||||
(builder_constructor_t)pluto_ac_pem_builder);
|
||||
|
||||
return &this->public.plugin;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user