(cert == CERT_X509_CRL)? (void*)crl_filter : (void*)ac_filter,
data, (void*)id_data_destroy);
}
- if (cert != CERT_X509 && cert != CERT_ANY)
- { /* we only have X509 certificates. TODO: ACs? */
+ if (cert != CERT_X509 && cert != CERT_GPG && cert != CERT_ANY)
+ { /* we have X509/PGP certificates. TODO: ACs? */
return NULL;
}
data = malloc_thing(id_data_t);
}
cert = lib->creds->create(lib->creds,
- CRED_CERTIFICATE, CERT_X509,
+ CRED_CERTIFICATE, CERT_ANY,
BUILD_FROM_FILE, path,
- BUILD_X509_FLAG, 0,
BUILD_END);
if (cert)
{
* RSA for PGP keys, which is actually wrong. */
subtype = KEY_ANY;
}
+ /* if CERT_ANY is given, ASN1 encoded blob is handled as X509 */
+ if (type == CRED_CERTIFICATE && subtype == CERT_ANY)
+ {
+ subtype = pgp ? CERT_GPG : CERT_X509;
+ }
}
cred = lib->creds->create(lib->creds, type, subtype,
pgp ? BUILD_BLOB_PGP : BUILD_BLOB_ASN1_DER, blob,
/**
* See header.
*/
-pgp_cert_t *pgp_cert_load(certificate_t type, va_list args)
+pgp_cert_t *pgp_cert_load(certificate_type_t type, va_list args)
{
chunk_t packet, blob = chunk_empty;
pgp_packet_tag_t tag;
* @param args builder_part_t argument list
* @return builder instance
*/
-pgp_cert_t *pgp_cert_load(certificate_t type, va_list args);
+pgp_cert_t *pgp_cert_load(certificate_type_t type, va_list args);
#endif /* PGP_CERT_ @}*/
#include <library.h>
#include "pgp_builder.h"
#include "pgp_encoder.h"
+#include "pgp_cert.h"
typedef struct private_pgp_plugin_t private_pgp_plugin_t;
lib->creds->remove_builder(lib->creds,
(builder_function_t)pgp_private_key_load);
+ lib->creds->remove_builder(lib->creds,
+ (builder_function_t)pgp_cert_load);
+
lib->encoding->remove_encoder(lib->encoding, pgp_encoder_encode);
free(this);
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY, KEY_RSA,
(builder_function_t)pgp_private_key_load);
+ lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_GPG,
+ (builder_function_t)pgp_cert_load);
+
lib->encoding->add_encoder(lib->encoding, pgp_encoder_encode);
return &this->public.plugin;