]> git.ipfire.org Git - people/ms/strongswan.git/commitdiff
PEM plugin loads PKCS#12 containers from (DER-encoded) files
authorTobias Brunner <tobias@strongswan.org>
Fri, 12 Apr 2013 17:00:15 +0000 (19:00 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 8 May 2013 13:02:40 +0000 (15:02 +0200)
It is not actually able to handle PEM encoded PKCS#12 files produced
by OpenSSL.

src/libstrongswan/plugins/pem/pem_builder.c
src/libstrongswan/plugins/pem/pem_builder.h
src/libstrongswan/plugins/pem/pem_plugin.c

index 08e81b3c5811664b668e972e2c94e526926be588..e9d55f3b879435dc055811270abe2258b0f64749 100644 (file)
@@ -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);
+}
index 87f5a2c6922e32e79bfb8369c9defd6b1cbb0eb8..b1bfc6d4d61ac229f2d0204e27d30596894f5db6 100644 (file)
@@ -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_ @}*/
 
index 9b0795f69581c9fd90956f889922931647c84ba8..e7edd7b890b512b6c404ba86d4e0dce12c508c96 100644 (file)
@@ -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);