aboutsummaryrefslogtreecommitdiffstats
path: root/src/x509/x509self.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-09-28 19:29:24 +0000
committerlloyd <[email protected]>2008-09-28 19:29:24 +0000
commit9bcfe627321ddc81691b835dffaa6324ac4684a4 (patch)
treefe5e8ae9813b853549558b59833022e87e83981b /src/x509/x509self.h
parent9822a701516396b7de4e41339faecd48ff8dc8ff (diff)
Move all modules into src/ directory
Diffstat (limited to 'src/x509/x509self.h')
-rw-r--r--src/x509/x509self.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/x509/x509self.h b/src/x509/x509self.h
new file mode 100644
index 000000000..2f83a12be
--- /dev/null
+++ b/src/x509/x509self.h
@@ -0,0 +1,75 @@
+/*************************************************
+* X.509 Self-Signed Certificate Header File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#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 BOTAN_DLL 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, ip, 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& = "",
+ u32bit expire = 365 * 24 * 60 * 60);
+ };
+
+namespace X509 {
+
+/*************************************************
+* Create a self-signed X.509 certificate *
+*************************************************/
+BOTAN_DLL X509_Certificate
+create_self_signed_cert(const X509_Cert_Options&,
+ const Private_Key&,
+ RandomNumberGenerator& rng);
+
+/*************************************************
+* Create a PKCS #10 certificate request *
+*************************************************/
+BOTAN_DLL PKCS10_Request create_cert_req(const X509_Cert_Options&,
+ const Private_Key&,
+ RandomNumberGenerator& rng);
+
+}
+
+}
+
+#endif