Botan
1.11.15
|
00001 /* 00002 * X.509 CRL 00003 * (C) 1999-2007 Jack Lloyd 00004 * 00005 * Botan is released under the Simplified BSD License (see license.txt) 00006 */ 00007 00008 #ifndef BOTAN_X509_CRL_H__ 00009 #define BOTAN_X509_CRL_H__ 00010 00011 #include <botan/x509_obj.h> 00012 #include <botan/crl_ent.h> 00013 #include <vector> 00014 00015 namespace Botan { 00016 00017 class X509_Certificate; 00018 00019 /** 00020 * This class represents X.509 Certificate Revocation Lists (CRLs). 00021 */ 00022 class BOTAN_DLL X509_CRL : public X509_Object 00023 { 00024 public: 00025 /** 00026 * This class represents CRL related errors. 00027 */ 00028 struct BOTAN_DLL X509_CRL_Error : public Exception 00029 { 00030 X509_CRL_Error(const std::string& error) : 00031 Exception("X509_CRL: " + error) {} 00032 }; 00033 00034 /** 00035 * Check if this particular certificate is listed in the CRL 00036 */ 00037 bool is_revoked(const X509_Certificate& cert) const; 00038 00039 /** 00040 * Get the entries of this CRL in the form of a vector. 00041 * @return vector containing the entries of this CRL. 00042 */ 00043 std::vector<CRL_Entry> get_revoked() const; 00044 00045 /** 00046 * Get the issuer DN of this CRL. 00047 * @return CRLs issuer DN 00048 */ 00049 X509_DN issuer_dn() const; 00050 00051 /** 00052 * Get the AuthorityKeyIdentifier of this CRL. 00053 * @return this CRLs AuthorityKeyIdentifier 00054 */ 00055 std::vector<byte> authority_key_id() const; 00056 00057 /** 00058 * Get the serial number of this CRL. 00059 * @return CRLs serial number 00060 */ 00061 u32bit crl_number() const; 00062 00063 /** 00064 * Get the CRL's thisUpdate value. 00065 * @return CRLs thisUpdate 00066 */ 00067 X509_Time this_update() const; 00068 00069 /** 00070 * Get the CRL's nextUpdate value. 00071 * @return CRLs nextdUpdate 00072 */ 00073 X509_Time next_update() const; 00074 00075 /** 00076 * Construct a CRL from a data source. 00077 * @param source the data source providing the DER or PEM encoded CRL. 00078 * @param throw_on_unknown_critical should we throw an exception 00079 * if an unknown CRL extension marked as critical is encountered. 00080 */ 00081 X509_CRL(DataSource& source, bool throw_on_unknown_critical = false); 00082 00083 /** 00084 * Construct a CRL from a file containing the DER or PEM encoded CRL. 00085 * @param filename the name of the CRL file 00086 * @param throw_on_unknown_critical should we throw an exception 00087 * if an unknown CRL extension marked as critical is encountered. 00088 */ 00089 X509_CRL(const std::string& filename, 00090 bool throw_on_unknown_critical = false); 00091 00092 /** 00093 * Construct a CRL from a binary vector 00094 * @param vec the binary (DER) representation of the CRL 00095 * @param throw_on_unknown_critical should we throw an exception 00096 * if an unknown CRL extension marked as critical is encountered. 00097 */ 00098 X509_CRL(const std::vector<byte>& vec, 00099 bool throw_on_unknown_critical = false); 00100 00101 private: 00102 void force_decode(); 00103 00104 bool throw_on_unknown_critical; 00105 std::vector<CRL_Entry> revoked; 00106 Data_Store info; 00107 }; 00108 00109 } 00110 00111 #endif