blob: 439535fce9ef56f239d795209acf89e4789a1ae0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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
|