aboutsummaryrefslogtreecommitdiffstats
path: root/include/x509self.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/x509self.h')
-rw-r--r--include/x509self.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/include/x509self.h b/include/x509self.h
new file mode 100644
index 000000000..439535fce
--- /dev/null
+++ b/include/x509self.h
@@ -0,0 +1,71 @@
+/*************************************************
+* X.509 Self-Signed Certificate Header File *
+* (C) 1999-2006 The Botan Project *
+*************************************************/
+
+#ifndef BOTAN_X509_SELF_H__
+#define BOTAN_X509_SELF_H__
+
+#include <botan/x509cert.h>
+#include <botan/pkcs8.h>
+#include <botan/pkcs10.h>
+
+namespace Botan {
+
+/*************************************************
+* Options for X.509 Certificates *
+*************************************************/
+class X509_Cert_Options
+ {
+ public:
+ std::string common_name;
+ std::string country;
+ std::string organization;
+ std::string org_unit;
+ std::string locality;
+ std::string state;
+ std::string serial_number;
+
+ std::string email, uri, dns, xmpp;
+
+ std::string challenge;
+
+ X509_Time start, end;
+
+ bool is_CA;
+ u32bit path_limit;
+ Key_Constraints constraints;
+ std::vector<OID> ex_constraints;
+
+ void sanity_check() const;
+
+ void CA_key(u32bit = 8);
+ void not_before(const std::string&);
+ void not_after(const std::string&);
+
+ void add_constraints(Key_Constraints);
+ void add_ex_constraint(const OID&);
+ void add_ex_constraint(const std::string&);
+
+ X509_Cert_Options(const std::string& = "");
+ };
+
+namespace X509 {
+
+/*************************************************
+* Create a self-signed X.509 certificate *
+*************************************************/
+X509_Certificate create_self_signed_cert(const X509_Cert_Options&,
+ const PKCS8_PrivateKey&);
+
+/*************************************************
+* Create a PKCS #10 certificate request *
+*************************************************/
+PKCS10_Request create_cert_req(const X509_Cert_Options&,
+ const PKCS8_PrivateKey&);
+
+}
+
+}
+
+#endif