diff options
author | Tobias Brunner <tobias@strongswan.org> | 2013-04-12 19:00:15 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2013-05-08 15:02:40 +0200 |
commit | 3bd498284ef27e7dfd41db06447918d544c6ea70 (patch) | |
tree | 501dd8092e4bd736d232096951c0dd8244b79e66 | |
parent | abc04e6b3f50e036450b8444100e005a5ff5c754 (diff) | |
download | strongswan-3bd498284ef27e7dfd41db06447918d544c6ea70.tar.bz2 strongswan-3bd498284ef27e7dfd41db06447918d544c6ea70.tar.xz |
PEM plugin loads PKCS#12 containers from (DER-encoded) files
It is not actually able to handle PEM encoded PKCS#12 files produced
by OpenSSL.
-rw-r--r-- | src/libstrongswan/plugins/pem/pem_builder.c | 8 | ||||
-rw-r--r-- | src/libstrongswan/plugins/pem/pem_builder.h | 11 | ||||
-rw-r--r-- | src/libstrongswan/plugins/pem/pem_plugin.c | 5 |
3 files changed, 24 insertions, 0 deletions
diff --git a/src/libstrongswan/plugins/pem/pem_builder.c b/src/libstrongswan/plugins/pem/pem_builder.c index 08e81b3c5..e9d55f3b8 100644 --- a/src/libstrongswan/plugins/pem/pem_builder.c +++ b/src/libstrongswan/plugins/pem/pem_builder.c @@ -1,4 +1,5 @@ /* + * Copyright (C) 2013 Tobias Brunner * Copyright (C) 2009 Martin Willi * Copyright (C) 2001-2008 Andreas Steffen * Hochschule fuer Technik Rapperswil @@ -564,3 +565,10 @@ certificate_t *pem_certificate_load(certificate_type_t type, va_list args) return pem_load(CRED_CERTIFICATE, type, args); } +/** + * Container PEM loader. + */ +container_t *pem_container_load(container_type_t type, va_list args) +{ + return pem_load(CRED_CONTAINER, type, args); +} diff --git a/src/libstrongswan/plugins/pem/pem_builder.h b/src/libstrongswan/plugins/pem/pem_builder.h index 87f5a2c69..b1bfc6d4d 100644 --- a/src/libstrongswan/plugins/pem/pem_builder.h +++ b/src/libstrongswan/plugins/pem/pem_builder.h @@ -1,4 +1,5 @@ /* + * Copyright (C) 2013 Tobias Brunner * Copyright (C) 2009 Martin Willi * Hochschule fuer Technik Rapperswil * @@ -25,6 +26,7 @@ #include <credentials/credential_factory.h> #include <credentials/keys/private_key.h> #include <credentials/certificates/certificate.h> +#include <credentials/containers/container.h> /** * Load PEM encoded private keys. @@ -53,5 +55,14 @@ public_key_t *pem_public_key_load(key_type_t type, va_list args); */ certificate_t *pem_certificate_load(certificate_type_t type, va_list args); +/** + * Build PEM encoded containers. + * + * @param type type of the container + * @param args builder_part_t argument list + * @return container, NULL if failed + */ +container_t *pem_container_load(container_type_t type, va_list args); + #endif /** PEM_BUILDER_H_ @}*/ diff --git a/src/libstrongswan/plugins/pem/pem_plugin.c b/src/libstrongswan/plugins/pem/pem_plugin.c index 9b0795f69..e7edd7b89 100644 --- a/src/libstrongswan/plugins/pem/pem_plugin.c +++ b/src/libstrongswan/plugins/pem/pem_plugin.c @@ -104,6 +104,11 @@ METHOD(plugin_t, get_features, int, PLUGIN_REGISTER(CERT_DECODE, pem_certificate_load, FALSE), PLUGIN_PROVIDE(CERT_DECODE, CERT_GPG), PLUGIN_DEPENDS(CERT_DECODE, CERT_GPG), + + /* container PEM decoding */ + PLUGIN_REGISTER(CONTAINER_DECODE, pem_container_load, FALSE), + PLUGIN_PROVIDE(CONTAINER_DECODE, CONTAINER_PKCS12), + PLUGIN_DEPENDS(CONTAINER_DECODE, CONTAINER_PKCS12), }; *features = f; return countof(f); |