aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2007-10-12 21:57:20 +0000
committerAndreas Steffen <andreas.steffen@strongswan.org>2007-10-12 21:57:20 +0000
commit0fa2c4fadae380beece52489d917b972c334b159 (patch)
tree5ce840e6910c82164d61992973eed5bcbf0a9765 /src
parent92a0b9d5ec3fb52b8c83cdb8ee6692d34db57710 (diff)
downloadstrongswan-0fa2c4fadae380beece52489d917b972c334b159.tar.bz2
strongswan-0fa2c4fadae380beece52489d917b972c334b159.tar.xz
added create_certificate_iterator() method
Diffstat (limited to 'src')
-rw-r--r--src/libstrongswan/crypto/pkcs7.c11
-rw-r--r--src/libstrongswan/crypto/pkcs7.h14
2 files changed, 20 insertions, 5 deletions
diff --git a/src/libstrongswan/crypto/pkcs7.c b/src/libstrongswan/crypto/pkcs7.c
index 7fbc1e36f..6ccb0ef56 100644
--- a/src/libstrongswan/crypto/pkcs7.c
+++ b/src/libstrongswan/crypto/pkcs7.c
@@ -619,11 +619,19 @@ static chunk_t get_data(private_pkcs7_t *this)
}
/**
+ * Implements pkcs_t.create_crluri_iterator
+ */
+static iterator_t *create_certificate_iterator(const private_pkcs7_t *this)
+{
+ return this->certs->create_iterator(this->certs, TRUE);
+}
+
+/**
* Implements pkcs7_t.destroy
*/
static void destroy(private_pkcs7_t *this)
{
- this->certs->destroy(this->certs);
+ this->certs->destroy_offset(this->certs, offsetof(x509_t, destroy));
free(this->data.ptr);
free(this);
}
@@ -690,6 +698,7 @@ pkcs7_t *pkcs7_create_from_chunk(chunk_t chunk, u_int level)
this->public.parse_signedData = (bool (*) (pkcs7_t*,x509_t*))parse_signedData;
this->public.parse_envelopedData = (bool (*) (pkcs7_t*,chunk_t,rsa_private_key_t*))parse_envelopedData;
this->public.get_data = (chunk_t (*) (pkcs7_t*))get_data;
+ this->public.create_certificate_iterator = (iterator_t* (*) (pkcs7_t*))create_certificate_iterator;
this->public.destroy = (void (*) (pkcs7_t*))destroy;
if (!parse_contentInfo(chunk, level, this))
diff --git a/src/libstrongswan/crypto/pkcs7.h b/src/libstrongswan/crypto/pkcs7.h
index c8473c529..9886e7779 100644
--- a/src/libstrongswan/crypto/pkcs7.h
+++ b/src/libstrongswan/crypto/pkcs7.h
@@ -32,12 +32,10 @@ typedef struct pkcs7_t pkcs7_t;
#include <library.h>
#include <crypto/x509.h>
#include <crypto/rsa/rsa_private_key.h>
-
-/* Access structure for a PKCS#7 ContentInfo object */
-
+#include <utils/iterator.h>
/**
- * @brief PKCS#7 ContentInfo object.
+ * @brief PKCS#7 contentInfo object.
*
* @b Constructors:
* -pkcs7_create_from_chunk()
@@ -105,6 +103,14 @@ struct pkcs7_t {
chunk_t (*get_data) (pkcs7_t *this);
/**
+ * @brief Create an iterator for the certificates.
+ *
+ * @param this calling object
+ * @return iterator for the certificates
+ */
+ iterator_t *(*create_certificate_iterator) (pkcs7_t *this);
+
+ /**
* @brief Destroys the contentInfo object.
*
* @param this PKCS#7 contentInfo object to destroy