Botan  1.10.9
pkcs10.h
Go to the documentation of this file.
1 /*
2 * PKCS #10
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7 
8 #ifndef BOTAN_PKCS10_H__
9 #define BOTAN_PKCS10_H__
10 
11 #include <botan/x509_obj.h>
12 #include <botan/x509_dn.h>
13 #include <botan/pkcs8.h>
14 #include <botan/datastor.h>
15 #include <vector>
16 
17 namespace Botan {
18 
19 /**
20 * PKCS #10 Certificate Request.
21 */
22 class BOTAN_DLL PKCS10_Request : public X509_Object
23  {
24  public:
25  /**
26  * Get the subject public key.
27  * @return subject public key
28  */
29  Public_Key* subject_public_key() const;
30 
31  /**
32  * Get the raw DER encoded public key.
33  * @return raw DER encoded public key
34  */
35  MemoryVector<byte> raw_public_key() const;
36 
37  /**
38  * Get the subject DN.
39  * @return subject DN
40  */
41  X509_DN subject_dn() const;
42 
43  /**
44  * Get the subject alternative name.
45  * @return subject alternative name.
46  */
47  AlternativeName subject_alt_name() const;
48 
49  /**
50  * Get the key constraints for the key associated with this
51  * PKCS#10 object.
52  * @return key constraints
53  */
54  Key_Constraints constraints() const;
55 
56  /**
57  * Get the extendend key constraints (if any).
58  * @return extended key constraints
59  */
60  std::vector<OID> ex_constraints() const;
61 
62  /**
63  * Find out whether this is a CA request.
64  * @result true if it is a CA request, false otherwise.
65  */
66  bool is_CA() const;
67 
68  /**
69  * Return the constraint on the path length defined
70  * in the BasicConstraints extension.
71  * @return path limit
72  */
73  u32bit path_limit() const;
74 
75  /**
76  * Get the challenge password for this request
77  * @return challenge password for this request
78  */
79  std::string challenge_password() const;
80 
81  /**
82  * Create a PKCS#10 Request from a data source.
83  * @param source the data source providing the DER encoded request
84  */
85  PKCS10_Request(DataSource& source);
86 
87  /**
88  * Create a PKCS#10 Request from a file.
89  * @param filename the name of the file containing the DER or PEM
90  * encoded request file
91  */
92  PKCS10_Request(const std::string& filename);
93  private:
94  void force_decode();
95  void handle_attribute(const Attribute&);
96 
97  Data_Store info;
98  };
99 
100 }
101 
102 #endif
Key_Constraints
Definition: pubkey_enums.h:18
unsigned int u32bit
Definition: types.h:32