aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2007-02-24 00:33:48 +0000
committerAndreas Steffen <andreas.steffen@strongswan.org>2007-02-24 00:33:48 +0000
commit0cdec3baa5bf46a71f3ca8b511b5e628275e491a (patch)
tree290b9ccc1eb00cfc8d3fe7b7d6378daabcee0884 /src
parent182d20e94efe66cc884649c2afe978d17002e4b0 (diff)
downloadstrongswan-0cdec3baa5bf46a71f3ca8b511b5e628275e491a.tar.bz2
strongswan-0cdec3baa5bf46a71f3ca8b511b5e628275e491a.tar.xz
addin get_keyid() method
Diffstat (limited to 'src')
-rwxr-xr-xsrc/libstrongswan/crypto/x509.c11
-rwxr-xr-xsrc/libstrongswan/crypto/x509.h8
2 files changed, 18 insertions, 1 deletions
diff --git a/src/libstrongswan/crypto/x509.c b/src/libstrongswan/crypto/x509.c
index 4de5885bf..fcbd5dc95 100755
--- a/src/libstrongswan/crypto/x509.c
+++ b/src/libstrongswan/crypto/x509.c
@@ -24,7 +24,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
-#include <printf.h>
+#include <stdio.h>
#include "x509.h"
@@ -989,6 +989,14 @@ static chunk_t get_subjectKeyID(const private_x509_t *this)
}
/**
+ * Implements x509_t.get_keyid
+ */
+static chunk_t get_keyid(const private_x509_t *this)
+{
+ return this->public_key->get_keyid(this->public_key);
+}
+
+/**
* Implements x509_t.get_issuer
*/
static identification_t *get_issuer(const private_x509_t *this)
@@ -1213,6 +1221,7 @@ x509_t *x509_create_from_chunk(chunk_t chunk)
this->public.get_public_key = (rsa_public_key_t* (*) (const x509_t*))get_public_key;
this->public.get_serialNumber = (chunk_t (*) (const x509_t*))get_serialNumber;
this->public.get_subjectKeyID = (chunk_t (*) (const x509_t*))get_subjectKeyID;
+ this->public.get_keyid = (chunk_t (*) (const x509_t*))get_keyid;
this->public.get_issuer = (identification_t* (*) (const x509_t*))get_issuer;
this->public.get_subject = (identification_t* (*) (const x509_t*))get_subject;
this->public.set_until = (void (*) (x509_t*,time_t))set_until;
diff --git a/src/libstrongswan/crypto/x509.h b/src/libstrongswan/crypto/x509.h
index f17d086bd..fd129149b 100755
--- a/src/libstrongswan/crypto/x509.h
+++ b/src/libstrongswan/crypto/x509.h
@@ -111,6 +111,14 @@ struct x509_t {
chunk_t (*get_subjectKeyID) (const x509_t *this);
/**
+ * @brief Get keyid from the certificate's public key.
+ *
+ * @param this calling object
+ * @return keyid
+ */
+ chunk_t (*get_keyid) (const x509_t *this);
+
+ /**
* @brief Get the certificate issuer's ID.
*
* The resulting ID is always a identification_t