Botan
1.11.15
|
00001 /* 00002 * PKCS #10 00003 * (C) 1999-2007 Jack Lloyd 00004 * 00005 * Botan is released under the Simplified BSD License (see license.txt) 00006 */ 00007 00008 #ifndef BOTAN_PKCS10_H__ 00009 #define BOTAN_PKCS10_H__ 00010 00011 #include <botan/x509_obj.h> 00012 #include <botan/x509_dn.h> 00013 #include <botan/pkcs8.h> 00014 #include <botan/datastor.h> 00015 #include <botan/key_constraint.h> 00016 #include <botan/asn1_attribute.h> 00017 #include <botan/asn1_alt_name.h> 00018 #include <vector> 00019 00020 namespace Botan { 00021 00022 /** 00023 * PKCS #10 Certificate Request. 00024 */ 00025 class BOTAN_DLL PKCS10_Request : public X509_Object 00026 { 00027 public: 00028 /** 00029 * Get the subject public key. 00030 * @return subject public key 00031 */ 00032 Public_Key* subject_public_key() const; 00033 00034 /** 00035 * Get the raw DER encoded public key. 00036 * @return raw DER encoded public key 00037 */ 00038 std::vector<byte> raw_public_key() const; 00039 00040 /** 00041 * Get the subject DN. 00042 * @return subject DN 00043 */ 00044 X509_DN subject_dn() const; 00045 00046 /** 00047 * Get the subject alternative name. 00048 * @return subject alternative name. 00049 */ 00050 AlternativeName subject_alt_name() const; 00051 00052 /** 00053 * Get the key constraints for the key associated with this 00054 * PKCS#10 object. 00055 * @return key constraints 00056 */ 00057 Key_Constraints constraints() const; 00058 00059 /** 00060 * Get the extendend key constraints (if any). 00061 * @return extended key constraints 00062 */ 00063 std::vector<OID> ex_constraints() const; 00064 00065 /** 00066 * Find out whether this is a CA request. 00067 * @result true if it is a CA request, false otherwise. 00068 */ 00069 bool is_CA() const; 00070 00071 /** 00072 * Return the constraint on the path length defined 00073 * in the BasicConstraints extension. 00074 * @return path limit 00075 */ 00076 u32bit path_limit() const; 00077 00078 /** 00079 * Get the challenge password for this request 00080 * @return challenge password for this request 00081 */ 00082 std::string challenge_password() const; 00083 00084 /** 00085 * Create a PKCS#10 Request from a data source. 00086 * @param source the data source providing the DER encoded request 00087 */ 00088 PKCS10_Request(DataSource& source); 00089 00090 /** 00091 * Create a PKCS#10 Request from a file. 00092 * @param filename the name of the file containing the DER or PEM 00093 * encoded request file 00094 */ 00095 PKCS10_Request(const std::string& filename); 00096 00097 /** 00098 * Create a PKCS#10 Request from binary data. 00099 * @param vec a std::vector containing the DER value 00100 */ 00101 PKCS10_Request(const std::vector<byte>& vec); 00102 private: 00103 void force_decode(); 00104 void handle_attribute(const Attribute&); 00105 00106 Data_Store info; 00107 }; 00108 00109 } 00110 00111 #endif