aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2009-08-21 13:53:19 +0200
committerMartin Willi <martin@strongswan.org>2009-08-26 11:23:52 +0200
commit64e77e8fbbfa9885d6fa3757a8f2b809237af63d (patch)
treefa03c4aa6c79d5c48328fe6a1f329dfbf18e145f /src
parentd1b3e8607e249692ea84c7b7856eeb4ee354de49 (diff)
downloadstrongswan-64e77e8fbbfa9885d6fa3757a8f2b809237af63d.tar.bz2
strongswan-64e77e8fbbfa9885d6fa3757a8f2b809237af63d.tar.xz
use credential builder API to parse trusted public keys
Diffstat (limited to 'src')
-rw-r--r--src/libstrongswan/plugins/pubkey/pubkey_cert.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/libstrongswan/plugins/pubkey/pubkey_cert.c b/src/libstrongswan/plugins/pubkey/pubkey_cert.c
index 863a8a1d4..78705d21f 100644
--- a/src/libstrongswan/plugins/pubkey/pubkey_cert.c
+++ b/src/libstrongswan/plugins/pubkey/pubkey_cert.c
@@ -87,7 +87,7 @@ static id_match_t has_subject(private_pubkey_cert_t *this,
{
return id->matches(id, subject);
}
- return ID_MATCH_NONE;
+ return ID_MATCH_NONE;
}
/**
@@ -214,13 +214,6 @@ static pubkey_cert_t *pubkey_cert_create(public_key_t *key)
return &this->public;
}
-static pubkey_cert_t *pubkey_cert_create_from_chunk(chunk_t blob)
-{
- public_key_t *key = pubkey_public_key_load(chunk_clone(blob));
-
- return (key)? pubkey_cert_create(key) : NULL;
-}
-
typedef struct private_builder_t private_builder_t;
/**
* Builder implementation for key loading
@@ -250,21 +243,28 @@ static void add(private_builder_t *this, builder_part_t part, ...)
{
if (!this->key)
{
+ public_key_t *key;
va_list args;
-
+
switch (part)
{
case BUILD_BLOB_ASN1_DER:
{
va_start(args, part);
- this->key = pubkey_cert_create_from_chunk(va_arg(args, chunk_t));
+ key = lib->creds->create(lib->creds, CRED_PUBLIC_KEY, KEY_ANY,
+ va_arg(args, chunk_t));
+ if (key)
+ {
+ this->key = pubkey_cert_create(key);
+ }
va_end(args);
return;
}
case BUILD_PUBLIC_KEY:
{
va_start(args, part);
- this->key = pubkey_cert_create(va_arg(args, public_key_t*));
+ key = va_arg(args, public_key_t*);
+ pubkey_cert_create(key->get_ref(key));
va_end(args);
return;
}