From 0cdec3baa5bf46a71f3ca8b511b5e628275e491a Mon Sep 17 00:00:00 2001 From: Andreas Steffen Date: Sat, 24 Feb 2007 00:33:48 +0000 Subject: [PATCH] addin get_keyid() method --- src/libstrongswan/crypto/x509.c | 11 ++++++++++- src/libstrongswan/crypto/x509.h | 8 ++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/libstrongswan/crypto/x509.c b/src/libstrongswan/crypto/x509.c index 4de5885bf7..fcbd5dc959 100755 --- a/src/libstrongswan/crypto/x509.c +++ b/src/libstrongswan/crypto/x509.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include "x509.h" @@ -988,6 +988,14 @@ static chunk_t get_subjectKeyID(const private_x509_t *this) return this->subjectKeyID; } +/** + * 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 */ @@ -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 f17d086bd5..fd129149bf 100755 --- a/src/libstrongswan/crypto/x509.h +++ b/src/libstrongswan/crypto/x509.h @@ -110,6 +110,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. * -- 2.47.2