IKEv1 support for PKCS#7 wrapped certificates

This commit is contained in:
Volker Rümelin
2013-01-11 10:21:56 +01:00
committed by Martin Willi
parent 10eee5fcba
commit 6d3e7a64a0
3 changed files with 96 additions and 0 deletions
@@ -234,6 +234,23 @@ METHOD(cert_payload_t, get_cert, certificate_t*,
BUILD_BLOB_ASN1_DER, this->data, BUILD_END);
}
METHOD(cert_payload_t, get_container, container_t*,
private_cert_payload_t *this)
{
int type;
switch (this->encoding)
{
case ENC_PKCS7_WRAPPED_X509:
type = CONTAINER_PKCS7;
break;
default:
return NULL;
}
return lib->creds->create(lib->creds, CRED_CONTAINER, type,
BUILD_BLOB_ASN1_DER, this->data, BUILD_END);
}
METHOD(cert_payload_t, get_hash, chunk_t,
private_cert_payload_t *this)
{
@@ -289,6 +306,7 @@ cert_payload_t *cert_payload_create(payload_type_t type)
.destroy = _destroy,
},
.get_cert = _get_cert,
.get_container = _get_container,
.get_cert_encoding = _get_cert_encoding,
.get_hash = _get_hash,
.get_url = _get_url,
@@ -28,6 +28,7 @@ typedef enum cert_encoding_t cert_encoding_t;
#include <library.h>
#include <credentials/certificates/certificate.h>
#include <credentials/containers/container.h>
#include <encoding/payloads/payload.h>
/**
@@ -71,6 +72,13 @@ struct cert_payload_t {
*/
certificate_t *(*get_cert)(cert_payload_t *this);
/**
* Get the payloads certificate container.
*
* @return container copy
*/
container_t *(*get_container)(cert_payload_t *this);
/**
* Get the encoding of the certificate.
*