aboutsummaryrefslogtreecommitdiffstats
path: root/include/x509find.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-09-10 03:37:57 +0000
committerlloyd <[email protected]>2006-09-10 03:37:57 +0000
commit04ca56c95e152edf1f2a49bc1a4be5b64a5774a7 (patch)
treebb0ff73976daf32a5f6e51869d4c6551bfc375cf /include/x509find.h
parent3af61dd588df052eb100e0c581860edfc1cb09c3 (diff)
Completely rewrite how the default X509_Store searches are performed,
exposing the actual search objects to the user rather than wrapping them in functions. Primarily this is to avoid the Visual Studio bug alluded to in the last commit.
Diffstat (limited to 'include/x509find.h')
-rw-r--r--include/x509find.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/include/x509find.h b/include/x509find.h
new file mode 100644
index 000000000..7ad363672
--- /dev/null
+++ b/include/x509find.h
@@ -0,0 +1,58 @@
+/*************************************************
+* X.509 Certificate Store Searching Header File *
+* (C) 1999-2006 The Botan Project *
+*************************************************/
+
+#ifndef BOTAN_X509_CERT_STORE_SEARCH_H__
+#define BOTAN_X509_CERT_STORE_SEARCH_H__
+
+#include <botan/x509stor.h>
+
+namespace Botan {
+
+/*************************************************
+* Search based on the contents of a DN entry *
+*************************************************/
+class DN_Check : public X509_Store::Search_Func
+ {
+ public:
+ typedef bool (*compare_fn)(const std::string&, const std::string&);
+ enum Search_Type { SUBSTRING_MATCHING, IGNORE_CASE };
+
+ bool match(const X509_Certificate& cert) const;
+
+ DN_Check(const std::string&, const std::string&, compare_fn);
+ DN_Check(const std::string&, const std::string&, Search_Type);
+ private:
+ std::string dn_entry, looking_for;
+ compare_fn compare;
+ };
+
+/*************************************************
+* Search for a certificate by issuer/serial *
+*************************************************/
+class IandS_Match : public X509_Store::Search_Func
+ {
+ public:
+ bool match(const X509_Certificate& cert) const;
+ IandS_Match(const X509_DN&, const MemoryRegion<byte>&);
+ private:
+ X509_DN issuer;
+ MemoryVector<byte> serial;
+ };
+
+/*************************************************
+* Search for a certificate by subject keyid *
+*************************************************/
+class SKID_Match : public X509_Store::Search_Func
+ {
+ public:
+ bool match(const X509_Certificate& cert) const;
+ SKID_Match(const MemoryRegion<byte>& s) : skid(s) {}
+ private:
+ MemoryVector<byte> skid;
+ };
+
+}
+
+#endif