blob: 731402960b50fe722546b5292629fd894174a7fd (
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
/*
* PKCS #10
* (C) 1999-2007 Jack Lloyd
* (C) 2016 René Korthaus, Rohde & Schwarz Cybersecurity
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
#ifndef BOTAN_PKCS10_H_
#define BOTAN_PKCS10_H_
#include <botan/x509_obj.h>
#include <botan/x509_dn.h>
#include <botan/x509_ext.h>
#include <botan/key_constraint.h>
#include <botan/asn1_attribute.h>
#include <botan/asn1_alt_name.h>
#include <vector>
namespace Botan {
struct PKCS10_Data;
/**
* PKCS #10 Certificate Request.
*/
class BOTAN_PUBLIC_API(2,0) PKCS10_Request final : public X509_Object
{
public:
/**
* Get the subject public key.
* @return subject public key
*/
Public_Key* subject_public_key() const;
/**
* Get the raw DER encoded public key.
* @return raw DER encoded public key
*/
const std::vector<uint8_t>& raw_public_key() const;
/**
* Get the subject DN.
* @return subject DN
*/
const X509_DN& subject_dn() const;
/**
* Get the subject alternative name.
* @return subject alternative name.
*/
const AlternativeName& subject_alt_name() const;
/**
* Get the key constraints for the key associated with this
* PKCS#10 object.
* @return key constraints
*/
Key_Constraints constraints() const;
/**
* Get the extendend key constraints (if any).
* @return extended key constraints
*/
std::vector<OID> ex_constraints() const;
/**
* Find out whether this is a CA request.
* @result true if it is a CA request, false otherwise.
*/
bool is_CA() const;
/**
* Return the constraint on the path length defined
* in the BasicConstraints extension.
* @return path limit
*/
size_t path_limit() const;
/**
* Get the challenge password for this request
* @return challenge password for this request
*/
std::string challenge_password() const;
/**
* Get the X509v3 extensions.
* @return X509v3 extensions
*/
const Extensions& extensions() const;
/**
* Create a PKCS#10 Request from a data source.
* @param source the data source providing the DER encoded request
*/
explicit PKCS10_Request(DataSource& source);
#if defined(BOTAN_TARGET_OS_HAS_FILESYSTEM)
/**
* Create a PKCS#10 Request from a file.
* @param filename the name of the file containing the DER or PEM
* encoded request file
*/
explicit PKCS10_Request(const std::string& filename);
#endif
/**
* Create a PKCS#10 Request from binary data.
* @param vec a std::vector containing the DER value
*/
explicit PKCS10_Request(const std::vector<uint8_t>& vec);
private:
std::string PEM_label() const override;
std::vector<std::string> alternate_PEM_labels() const override;
void force_decode() override;
const PKCS10_Data& data() const;
std::shared_ptr<PKCS10_Data> m_data;
};
}
#endif
|