]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
addin get_keyid() method
authorAndreas Steffen <andreas.steffen@strongswan.org>
Sat, 24 Feb 2007 00:33:48 +0000 (00:33 -0000)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Sat, 24 Feb 2007 00:33:48 +0000 (00:33 -0000)
src/libstrongswan/crypto/x509.c
src/libstrongswan/crypto/x509.h

index 4de5885bf70b7b7cc9053eaf1f36c2b164a6d198..fcbd5dc959dc32bb133873eb8aa20dff19acbaa4 100755 (executable)
@@ -24,7 +24,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <string.h>
-#include <printf.h>
+#include <stdio.h>
 
 #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;
index f17d086bd55cedc360fa54f62d2e224e21474dbe..fd129149bfcc45f7661a28984ee0a2a857830685 100755 (executable)
@@ -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.
         *