added set_ca_info() and get_ca_info() methods
authorAndreas Steffen <andreas.steffen@strongswan.org>
Fri, 18 May 2007 10:15:23 +0000 (10:15 -0000)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Fri, 18 May 2007 10:15:23 +0000 (10:15 -0000)
src/libstrongswan/crypto/x509.c
src/libstrongswan/crypto/x509.h

index 97aa8bb..5bf3f26 100755 (executable)
@@ -122,6 +122,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
         */
        time_t notBefore;
@@ -1022,6 +1027,22 @@ static identification_t *get_subject(const private_x509_t *this)
 }
 
 /**
+ * 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
  */
 static void set_until(private_x509_t *this, time_t 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;
index acdd3a9..c6fe148 100755 (executable)
@@ -33,6 +33,7 @@ typedef struct x509_t x509_t;
 #include <library.h>
 #include <crypto/rsa/rsa_public_key.h>
 #include <crypto/certinfo.h>
+#include <crypto/ca.h>
 #include <utils/identification.h>
 #include <utils/iterator.h>
 #include <utils/linked_list.h>
@@ -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. 
@@ -175,6 +176,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.
         * 
         * @param this                          calling object