pubkey: Don't assume blobs are only ASN.1 DER
Also forward the blob's type when parsing pubkeys.
This commit is contained in:
@@ -264,15 +264,20 @@ pubkey_cert_t *pubkey_cert_wrap(certificate_type_t type, va_list args)
|
||||
{
|
||||
public_key_t *key = NULL;
|
||||
chunk_t blob = chunk_empty;
|
||||
builder_part_t part, blob_type = BUILD_END;
|
||||
identification_t *subject = NULL;
|
||||
time_t notBefore = UNDEFINED_TIME, notAfter = UNDEFINED_TIME;
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
switch (va_arg(args, builder_part_t))
|
||||
part = va_arg(args, builder_part_t);
|
||||
switch (part)
|
||||
{
|
||||
case BUILD_BLOB:
|
||||
case BUILD_BLOB_PEM:
|
||||
case BUILD_BLOB_ASN1_DER:
|
||||
blob = va_arg(args, chunk_t);
|
||||
blob_type = part;
|
||||
continue;
|
||||
case BUILD_PUBLIC_KEY:
|
||||
key = va_arg(args, public_key_t*);
|
||||
@@ -300,7 +305,7 @@ pubkey_cert_t *pubkey_cert_wrap(certificate_type_t type, va_list args)
|
||||
else if (blob.ptr)
|
||||
{
|
||||
key = lib->creds->create(lib->creds, CRED_PUBLIC_KEY, KEY_ANY,
|
||||
BUILD_BLOB_ASN1_DER, blob, BUILD_END);
|
||||
blob_type, blob, BUILD_END);
|
||||
}
|
||||
if (key)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user