Added a final flag to builder registration to enumerate the actually supported algorithms
This commit is contained in:
@@ -64,18 +64,21 @@ struct entry_t {
|
|||||||
credential_type_t type;
|
credential_type_t type;
|
||||||
/** subtype of credential, e.g. certificate_type_t */
|
/** subtype of credential, e.g. certificate_type_t */
|
||||||
int subtype;
|
int subtype;
|
||||||
|
/** registered with final flag? */
|
||||||
|
bool final;
|
||||||
/** builder function */
|
/** builder function */
|
||||||
builder_function_t constructor;
|
builder_function_t constructor;
|
||||||
};
|
};
|
||||||
|
|
||||||
METHOD(credential_factory_t, add_builder, void,
|
METHOD(credential_factory_t, add_builder, void,
|
||||||
private_credential_factory_t *this, credential_type_t type, int subtype,
|
private_credential_factory_t *this, credential_type_t type, int subtype,
|
||||||
builder_function_t constructor)
|
bool final, builder_function_t constructor)
|
||||||
{
|
{
|
||||||
entry_t *entry = malloc_thing(entry_t);
|
entry_t *entry = malloc_thing(entry_t);
|
||||||
|
|
||||||
entry->type = type;
|
entry->type = type;
|
||||||
entry->subtype = subtype;
|
entry->subtype = subtype;
|
||||||
|
entry->final = final;
|
||||||
entry->constructor = constructor;
|
entry->constructor = constructor;
|
||||||
this->lock->write_lock(this->lock);
|
this->lock->write_lock(this->lock);
|
||||||
this->constructors->insert_last(this->constructors, entry);
|
this->constructors->insert_last(this->constructors, entry);
|
||||||
@@ -153,16 +156,15 @@ METHOD(credential_factory_t, create, void*,
|
|||||||
* Filter function for builder enumerator
|
* Filter function for builder enumerator
|
||||||
*/
|
*/
|
||||||
static bool builder_filter(void *null, entry_t **entry, credential_type_t *type,
|
static bool builder_filter(void *null, entry_t **entry, credential_type_t *type,
|
||||||
void *dummy1, int *subtype,
|
void *dummy1, int *subtype)
|
||||||
void *dummy2, builder_function_t *constructor)
|
|
||||||
{
|
{
|
||||||
*type = (*entry)->type;
|
if ((*entry)->final)
|
||||||
*subtype = (*entry)->subtype;
|
|
||||||
if (constructor)
|
|
||||||
{
|
{
|
||||||
*constructor = (*entry)->constructor;
|
*type = (*entry)->type;
|
||||||
|
*subtype = (*entry)->subtype;
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(credential_factory_t, create_builder_enumerator, enumerator_t*,
|
METHOD(credential_factory_t, create_builder_enumerator, enumerator_t*,
|
||||||
|
|||||||
@@ -64,21 +64,21 @@ struct credential_factory_t {
|
|||||||
*/
|
*/
|
||||||
void* (*create)(credential_factory_t *this, credential_type_t type,
|
void* (*create)(credential_factory_t *this, credential_type_t type,
|
||||||
int subtype, ...);
|
int subtype, ...);
|
||||||
/**
|
|
||||||
* Create an enumerator over registered builder functions.
|
|
||||||
*
|
|
||||||
* @return enumerator (credential_type_t, int, build_function_t)
|
|
||||||
*/
|
|
||||||
enumerator_t* (*create_builder_enumerator)(credential_factory_t *this);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a credential builder function.
|
* Register a credential builder function.
|
||||||
*
|
*
|
||||||
|
* The final flag indicates if the registered builder can build such
|
||||||
|
* a credential itself the most common encoding, without the need
|
||||||
|
* for an additional builder.
|
||||||
|
*
|
||||||
* @param type type of credential the builder creates
|
* @param type type of credential the builder creates
|
||||||
|
* @param subtype subtype of the credential, type specific
|
||||||
|
* @param final TRUE if this build does not invoke other builders
|
||||||
* @param constructor builder constructor function to register
|
* @param constructor builder constructor function to register
|
||||||
*/
|
*/
|
||||||
void (*add_builder)(credential_factory_t *this,
|
void (*add_builder)(credential_factory_t *this,
|
||||||
credential_type_t type, int subtype,
|
credential_type_t type, int subtype, bool final,
|
||||||
builder_function_t constructor);
|
builder_function_t constructor);
|
||||||
/**
|
/**
|
||||||
* Unregister a credential builder function.
|
* Unregister a credential builder function.
|
||||||
@@ -88,6 +88,16 @@ struct credential_factory_t {
|
|||||||
void (*remove_builder)(credential_factory_t *this,
|
void (*remove_builder)(credential_factory_t *this,
|
||||||
builder_function_t constructor);
|
builder_function_t constructor);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an enumerator over registered builder types.
|
||||||
|
*
|
||||||
|
* The enumerator returns only builder types registered with the final
|
||||||
|
* flag set.
|
||||||
|
*
|
||||||
|
* @return enumerator (credential_type_t, int subtype)
|
||||||
|
*/
|
||||||
|
enumerator_t* (*create_builder_enumerator)(credential_factory_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy a credential_factory instance.
|
* Destroy a credential_factory instance.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ plugin_t *agent_plugin_create()
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_RSA,
|
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_RSA, FALSE,
|
||||||
(builder_function_t)agent_private_key_open);
|
(builder_function_t)agent_private_key_open);
|
||||||
return &this->public.plugin;
|
return &this->public.plugin;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,9 +50,9 @@ plugin_t *dnskey_plugin_create()
|
|||||||
|
|
||||||
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
||||||
|
|
||||||
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_ANY,
|
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_ANY, FALSE,
|
||||||
(builder_function_t)dnskey_public_key_load);
|
(builder_function_t)dnskey_public_key_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_RSA,
|
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_RSA, FALSE,
|
||||||
(builder_function_t)dnskey_public_key_load);
|
(builder_function_t)dnskey_public_key_load);
|
||||||
|
|
||||||
return &this->public.plugin;
|
return &this->public.plugin;
|
||||||
|
|||||||
@@ -224,11 +224,11 @@ plugin_t *gcrypt_plugin_create()
|
|||||||
(dh_constructor_t)gcrypt_dh_create_custom);
|
(dh_constructor_t)gcrypt_dh_create_custom);
|
||||||
|
|
||||||
/* RSA */
|
/* RSA */
|
||||||
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_RSA,
|
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_RSA, FALSE,
|
||||||
(builder_function_t)gcrypt_rsa_private_key_gen);
|
(builder_function_t)gcrypt_rsa_private_key_gen);
|
||||||
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_RSA,
|
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_RSA, TRUE,
|
||||||
(builder_function_t)gcrypt_rsa_private_key_load);
|
(builder_function_t)gcrypt_rsa_private_key_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_RSA,
|
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_RSA, TRUE,
|
||||||
(builder_function_t)gcrypt_rsa_public_key_load);
|
(builder_function_t)gcrypt_rsa_public_key_load);
|
||||||
|
|
||||||
return &this->public.plugin;
|
return &this->public.plugin;
|
||||||
|
|||||||
@@ -90,11 +90,11 @@ plugin_t *gmp_plugin_create()
|
|||||||
lib->crypto->add_dh(lib->crypto, MODP_CUSTOM,
|
lib->crypto->add_dh(lib->crypto, MODP_CUSTOM,
|
||||||
(dh_constructor_t)gmp_diffie_hellman_create_custom);
|
(dh_constructor_t)gmp_diffie_hellman_create_custom);
|
||||||
|
|
||||||
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_RSA,
|
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_RSA, FALSE,
|
||||||
(builder_function_t)gmp_rsa_private_key_gen);
|
(builder_function_t)gmp_rsa_private_key_gen);
|
||||||
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_RSA,
|
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_RSA, TRUE,
|
||||||
(builder_function_t)gmp_rsa_private_key_load);
|
(builder_function_t)gmp_rsa_private_key_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_RSA,
|
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_RSA, TRUE,
|
||||||
(builder_function_t)gmp_rsa_public_key_load);
|
(builder_function_t)gmp_rsa_public_key_load);
|
||||||
|
|
||||||
return &this->public.plugin;
|
return &this->public.plugin;
|
||||||
|
|||||||
@@ -353,31 +353,31 @@ plugin_t *openssl_plugin_create()
|
|||||||
(dh_constructor_t)openssl_diffie_hellman_create);
|
(dh_constructor_t)openssl_diffie_hellman_create);
|
||||||
|
|
||||||
/* rsa */
|
/* rsa */
|
||||||
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_RSA,
|
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_RSA, TRUE,
|
||||||
(builder_function_t)openssl_rsa_private_key_load);
|
(builder_function_t)openssl_rsa_private_key_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_RSA,
|
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_RSA, FALSE,
|
||||||
(builder_function_t)openssl_rsa_private_key_gen);
|
(builder_function_t)openssl_rsa_private_key_gen);
|
||||||
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_ANY,
|
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_ANY, FALSE,
|
||||||
(builder_function_t)openssl_rsa_private_key_connect);
|
(builder_function_t)openssl_rsa_private_key_connect);
|
||||||
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_RSA,
|
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_RSA, TRUE,
|
||||||
(builder_function_t)openssl_rsa_public_key_load);
|
(builder_function_t)openssl_rsa_public_key_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_ANY,
|
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_ANY, FALSE,
|
||||||
(builder_function_t)openssl_rsa_public_key_load);
|
(builder_function_t)openssl_rsa_public_key_load);
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_EC
|
#ifndef OPENSSL_NO_EC
|
||||||
/* ecdsa */
|
/* ecdsa */
|
||||||
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_ECDSA,
|
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_ECDSA, TRUE,
|
||||||
(builder_function_t)openssl_ec_private_key_load);
|
(builder_function_t)openssl_ec_private_key_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_ECDSA,
|
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_ECDSA, FALSE,
|
||||||
(builder_function_t)openssl_ec_private_key_gen);
|
(builder_function_t)openssl_ec_private_key_gen);
|
||||||
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_ECDSA,
|
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_ECDSA, TRUE,
|
||||||
(builder_function_t)openssl_ec_public_key_load);
|
(builder_function_t)openssl_ec_public_key_load);
|
||||||
#endif /* OPENSSL_NO_EC */
|
#endif /* OPENSSL_NO_EC */
|
||||||
|
|
||||||
/* X509 certificates */
|
/* X509 certificates */
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509, TRUE,
|
||||||
(builder_function_t)openssl_x509_load);
|
(builder_function_t)openssl_x509_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_CRL,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_CRL, TRUE,
|
||||||
(builder_function_t)openssl_crl_load);
|
(builder_function_t)openssl_crl_load);
|
||||||
|
|
||||||
return &this->public.plugin;
|
return &this->public.plugin;
|
||||||
|
|||||||
@@ -57,49 +57,49 @@ plugin_t *pem_plugin_create()
|
|||||||
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
||||||
|
|
||||||
/* register private key PEM decoding builders */
|
/* register private key PEM decoding builders */
|
||||||
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_ANY,
|
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_ANY, FALSE,
|
||||||
(builder_function_t)pem_private_key_load);
|
(builder_function_t)pem_private_key_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_RSA,
|
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_RSA, FALSE,
|
||||||
(builder_function_t)pem_private_key_load);
|
(builder_function_t)pem_private_key_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_ECDSA,
|
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_ECDSA, FALSE,
|
||||||
(builder_function_t)pem_private_key_load);
|
(builder_function_t)pem_private_key_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_DSA,
|
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_DSA, FALSE,
|
||||||
(builder_function_t)pem_private_key_load);
|
(builder_function_t)pem_private_key_load);
|
||||||
|
|
||||||
/* register public key PEM decoding builders */
|
/* register public key PEM decoding builders */
|
||||||
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_ANY,
|
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_ANY, FALSE,
|
||||||
(builder_function_t)pem_public_key_load);
|
(builder_function_t)pem_public_key_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_RSA,
|
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_RSA, FALSE,
|
||||||
(builder_function_t)pem_public_key_load);
|
(builder_function_t)pem_public_key_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_ECDSA,
|
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_ECDSA, FALSE,
|
||||||
(builder_function_t)pem_public_key_load);
|
(builder_function_t)pem_public_key_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_DSA,
|
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_DSA, FALSE,
|
||||||
(builder_function_t)pem_public_key_load);
|
(builder_function_t)pem_public_key_load);
|
||||||
|
|
||||||
/* register certificate PEM decoding builders */
|
/* register certificate PEM decoding builders */
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_ANY,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_ANY, FALSE,
|
||||||
(builder_function_t)pem_certificate_load);
|
(builder_function_t)pem_certificate_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509, FALSE,
|
||||||
(builder_function_t)pem_certificate_load);
|
(builder_function_t)pem_certificate_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_CRL,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_CRL, FALSE,
|
||||||
(builder_function_t)pem_certificate_load);
|
(builder_function_t)pem_certificate_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_OCSP_REQUEST,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_OCSP_REQUEST, FALSE,
|
||||||
(builder_function_t)pem_certificate_load);
|
(builder_function_t)pem_certificate_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_OCSP_RESPONSE,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_OCSP_RESPONSE, FALSE,
|
||||||
(builder_function_t)pem_certificate_load);
|
(builder_function_t)pem_certificate_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_AC,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_AC, FALSE,
|
||||||
(builder_function_t)pem_certificate_load);
|
(builder_function_t)pem_certificate_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_PKCS10_REQUEST,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_PKCS10_REQUEST, FALSE,
|
||||||
(builder_function_t)pem_certificate_load);
|
(builder_function_t)pem_certificate_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_TRUSTED_PUBKEY,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_TRUSTED_PUBKEY, FALSE,
|
||||||
(builder_function_t)pem_certificate_load);
|
(builder_function_t)pem_certificate_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_GPG,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_GPG, FALSE,
|
||||||
(builder_function_t)pem_certificate_load);
|
(builder_function_t)pem_certificate_load);
|
||||||
|
|
||||||
/* register pluto specific certificate formats */
|
/* register pluto specific certificate formats */
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_PLUTO_CERT,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_PLUTO_CERT, FALSE,
|
||||||
(builder_function_t)pem_certificate_load);
|
(builder_function_t)pem_certificate_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_PLUTO_CRL,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_PLUTO_CRL, FALSE,
|
||||||
(builder_function_t)pem_certificate_load);
|
(builder_function_t)pem_certificate_load);
|
||||||
|
|
||||||
/* register PEM encoder */
|
/* register PEM encoder */
|
||||||
|
|||||||
@@ -60,16 +60,16 @@ plugin_t *pgp_plugin_create()
|
|||||||
|
|
||||||
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
||||||
|
|
||||||
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_ANY,
|
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_ANY, FALSE,
|
||||||
(builder_function_t)pgp_public_key_load);
|
(builder_function_t)pgp_public_key_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_RSA,
|
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_RSA, FALSE,
|
||||||
(builder_function_t)pgp_public_key_load);
|
(builder_function_t)pgp_public_key_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_ANY,
|
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_ANY, FALSE,
|
||||||
(builder_function_t)pgp_private_key_load);
|
(builder_function_t)pgp_private_key_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_RSA,
|
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_RSA, FALSE,
|
||||||
(builder_function_t)pgp_private_key_load);
|
(builder_function_t)pgp_private_key_load);
|
||||||
|
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_GPG,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_GPG, FALSE,
|
||||||
(builder_function_t)pgp_cert_load);
|
(builder_function_t)pgp_cert_load);
|
||||||
|
|
||||||
lib->encoding->add_encoder(lib->encoding, pgp_encoder_encode);
|
lib->encoding->add_encoder(lib->encoding, pgp_encoder_encode);
|
||||||
|
|||||||
@@ -56,11 +56,11 @@ plugin_t *pkcs1_plugin_create()
|
|||||||
|
|
||||||
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
||||||
|
|
||||||
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_ANY,
|
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_ANY, FALSE,
|
||||||
(builder_function_t)pkcs1_public_key_load);
|
(builder_function_t)pkcs1_public_key_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_RSA,
|
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_RSA, FALSE,
|
||||||
(builder_function_t)pkcs1_public_key_load);
|
(builder_function_t)pkcs1_public_key_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_RSA,
|
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_RSA, FALSE,
|
||||||
(builder_function_t)pkcs1_private_key_load);
|
(builder_function_t)pkcs1_private_key_load);
|
||||||
|
|
||||||
lib->encoding->add_encoder(lib->encoding, pkcs1_encoder_encode);
|
lib->encoding->add_encoder(lib->encoding, pkcs1_encoder_encode);
|
||||||
|
|||||||
@@ -160,9 +160,9 @@ plugin_t *pkcs11_plugin_create()
|
|||||||
(hasher_constructor_t)pkcs11_hasher_create);
|
(hasher_constructor_t)pkcs11_hasher_create);
|
||||||
}
|
}
|
||||||
|
|
||||||
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_ANY,
|
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_ANY, FALSE,
|
||||||
(builder_function_t)pkcs11_private_key_connect);
|
(builder_function_t)pkcs11_private_key_connect);
|
||||||
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_RSA,
|
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY, KEY_RSA, TRUE,
|
||||||
(builder_function_t)pkcs11_public_key_load);
|
(builder_function_t)pkcs11_public_key_load);
|
||||||
|
|
||||||
enumerator = this->manager->create_token_enumerator(this->manager);
|
enumerator = this->manager->create_token_enumerator(this->manager);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ plugin_t *pubkey_plugin_create()
|
|||||||
|
|
||||||
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
||||||
|
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_TRUSTED_PUBKEY,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_TRUSTED_PUBKEY, FALSE,
|
||||||
(builder_function_t)pubkey_cert_wrap);
|
(builder_function_t)pubkey_cert_wrap);
|
||||||
|
|
||||||
return &this->public.plugin;
|
return &this->public.plugin;
|
||||||
|
|||||||
@@ -73,25 +73,25 @@ plugin_t *x509_plugin_create()
|
|||||||
|
|
||||||
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
|
||||||
|
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509, FALSE,
|
||||||
(builder_function_t)x509_cert_gen);
|
(builder_function_t)x509_cert_gen);
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509, TRUE,
|
||||||
(builder_function_t)x509_cert_load);
|
(builder_function_t)x509_cert_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_AC,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_AC, FALSE,
|
||||||
(builder_function_t)x509_ac_gen);
|
(builder_function_t)x509_ac_gen);
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_AC,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_AC, TRUE,
|
||||||
(builder_function_t)x509_ac_load);
|
(builder_function_t)x509_ac_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_CRL,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_CRL, TRUE,
|
||||||
(builder_function_t)x509_crl_load);
|
(builder_function_t)x509_crl_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_CRL,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_CRL, FALSE,
|
||||||
(builder_function_t)x509_crl_gen);
|
(builder_function_t)x509_crl_gen);
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_OCSP_REQUEST,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_OCSP_REQUEST, FALSE,
|
||||||
(builder_function_t)x509_ocsp_request_gen);
|
(builder_function_t)x509_ocsp_request_gen);
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_OCSP_RESPONSE,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_OCSP_RESPONSE, TRUE,
|
||||||
(builder_function_t)x509_ocsp_response_load);
|
(builder_function_t)x509_ocsp_response_load);
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_PKCS10_REQUEST,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_PKCS10_REQUEST, FALSE,
|
||||||
(builder_function_t)x509_pkcs10_gen);
|
(builder_function_t)x509_pkcs10_gen);
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_PKCS10_REQUEST,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_PKCS10_REQUEST, TRUE,
|
||||||
(builder_function_t)x509_pkcs10_load);
|
(builder_function_t)x509_pkcs10_load);
|
||||||
|
|
||||||
return &this->public.plugin;
|
return &this->public.plugin;
|
||||||
|
|||||||
+2
-2
@@ -136,9 +136,9 @@ static x509crl_t *builder_load_crl(certificate_type_t type, va_list args)
|
|||||||
|
|
||||||
void init_builder(void)
|
void init_builder(void)
|
||||||
{
|
{
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_PLUTO_CERT,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_PLUTO_CERT, FALSE,
|
||||||
(builder_function_t)builder_load_cert);
|
(builder_function_t)builder_load_cert);
|
||||||
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_PLUTO_CRL,
|
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_PLUTO_CRL, FALSE,
|
||||||
(builder_function_t)builder_load_crl);
|
(builder_function_t)builder_load_crl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user