From 27432db6038df71b143be1ba5f17902ea58b501a Mon Sep 17 00:00:00 2001 From: Andreas Steffen Date: Fri, 18 May 2007 10:15:23 +0000 Subject: [PATCH] added set_ca_info() and get_ca_info() methods --- src/libstrongswan/crypto/x509.c | 24 ++++++++++++++++++++++++ src/libstrongswan/crypto/x509.h | 25 +++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/libstrongswan/crypto/x509.c b/src/libstrongswan/crypto/x509.c index 97aa8bb0b..5bf3f26d7 100755 --- a/src/libstrongswan/crypto/x509.c +++ b/src/libstrongswan/crypto/x509.c @@ -121,6 +121,11 @@ struct private_x509_t { */ identification_t *issuer; + /** + * link to the info recored of the certificate issuer + */ + ca_info_t *ca_info; + /** * Start time of certificate validity */ @@ -1021,6 +1026,22 @@ static identification_t *get_subject(const private_x509_t *this) return this->subject; } +/** + * Implements x509_t.set_ca_info + */ +static void set_ca_info(private_x509_t *this, ca_info_t *ca_info) +{ + this->ca_info = ca_info; +} + +/** + * Implements x509_t.get_ca_info + */ +static ca_info_t *get_ca_info(const private_x509_t *this) +{ + return this->ca_info; +} + /** * Implements x509_t.set_until */ @@ -1231,6 +1252,7 @@ x509_t *x509_create_from_chunk(chunk_t chunk, u_int level) this->public_key = NULL; this->subject = NULL; this->issuer = NULL; + this->ca_info = NULL; this->subjectAltNames = linked_list_create(); this->crlDistributionPoints = linked_list_create(); this->ocspAccessLocations = linked_list_create(); @@ -1256,6 +1278,8 @@ x509_t *x509_create_from_chunk(chunk_t chunk, u_int level) 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_ca_info = (void (*) (x509_t*,ca_info_t*))set_ca_info; + this->public.get_ca_info = (ca_info_t* (*) (const x509_t*))get_ca_info; this->public.set_until = (void (*) (x509_t*,time_t))set_until; this->public.get_until = (time_t (*) (const x509_t*))get_until; this->public.set_status = (void (*) (x509_t*,cert_status_t))set_status; diff --git a/src/libstrongswan/crypto/x509.h b/src/libstrongswan/crypto/x509.h index acdd3a954..c6fe148d4 100755 --- a/src/libstrongswan/crypto/x509.h +++ b/src/libstrongswan/crypto/x509.h @@ -33,6 +33,7 @@ typedef struct x509_t x509_t; #include #include #include +#include #include #include #include @@ -153,7 +154,7 @@ struct x509_t { chunk_t (*get_keyid) (const x509_t *this); /** - * @brief Get the certificate issuer's ID. + * @brief Get the issuerDistinguishedName * * The resulting ID is always a identification_t * of type ID_DER_ASN1_DN. @@ -164,7 +165,7 @@ struct x509_t { identification_t *(*get_issuer) (const x509_t *this); /** - * @brief Get the subjectDistinguisheName. + * @brief Get the subjectDistinguishedName. * * The resulting ID is always a identification_t * of type ID_DER_ASN1_DN. @@ -174,6 +175,26 @@ struct x509_t { */ identification_t *(*get_subject) (const x509_t *this); + /** + * @brief Set a link ca info + * + * @param this calling object + * @param ca_info link to the info record of the issuing ca + */ + void (*set_ca_info) (x509_t *this, ca_info_t *ca_info); + + /** + * @brief Get the . + * + * The resulting ID is always a identification_t + * of type ID_DER_ASN1_DN. + * + * @param this calling object + * @return link to the info record of the issuing ca + * or NULL if it does not [yet] exist + */ + ca_info_t *(*get_ca_info) (const x509_t *this); + /** * @brief Create an iterator for the crlDistributionPoints. *