Botan
1.11.15
|
00001 /* 00002 * CRL Entry 00003 * (C) 1999-2007 Jack Lloyd 00004 * 00005 * Botan is released under the Simplified BSD License (see license.txt) 00006 */ 00007 00008 #ifndef BOTAN_CRL_ENTRY_H__ 00009 #define BOTAN_CRL_ENTRY_H__ 00010 00011 #include <botan/x509cert.h> 00012 #include <botan/asn1_time.h> 00013 00014 namespace Botan { 00015 00016 /** 00017 * X.509v2 CRL Reason Code. 00018 */ 00019 enum CRL_Code { 00020 UNSPECIFIED = 0, 00021 KEY_COMPROMISE = 1, 00022 CA_COMPROMISE = 2, 00023 AFFILIATION_CHANGED = 3, 00024 SUPERSEDED = 4, 00025 CESSATION_OF_OPERATION = 5, 00026 CERTIFICATE_HOLD = 6, 00027 REMOVE_FROM_CRL = 8, 00028 PRIVLEDGE_WITHDRAWN = 9, 00029 AA_COMPROMISE = 10, 00030 00031 DELETE_CRL_ENTRY = 0xFF00, 00032 OCSP_GOOD = 0xFF01, 00033 OCSP_UNKNOWN = 0xFF02 00034 }; 00035 00036 /** 00037 * This class represents CRL entries 00038 */ 00039 class BOTAN_DLL CRL_Entry : public ASN1_Object 00040 { 00041 public: 00042 void encode_into(class DER_Encoder&) const; 00043 void decode_from(class BER_Decoder&); 00044 00045 /** 00046 * Get the serial number of the certificate associated with this entry. 00047 * @return certificate's serial number 00048 */ 00049 std::vector<byte> serial_number() const { return serial; } 00050 00051 /** 00052 * Get the revocation date of the certificate associated with this entry 00053 * @return certificate's revocation date 00054 */ 00055 X509_Time expire_time() const { return time; } 00056 00057 /** 00058 * Get the entries reason code 00059 * @return reason code 00060 */ 00061 CRL_Code reason_code() const { return reason; } 00062 00063 /** 00064 * Construct an empty CRL entry. 00065 */ 00066 CRL_Entry(bool throw_on_unknown_critical_extension = false); 00067 00068 /** 00069 * Construct an CRL entry. 00070 * @param cert the certificate to revoke 00071 * @param reason the reason code to set in the entry 00072 */ 00073 CRL_Entry(const X509_Certificate& cert, 00074 CRL_Code reason = UNSPECIFIED); 00075 00076 private: 00077 bool throw_on_unknown_critical; 00078 std::vector<byte> serial; 00079 X509_Time time; 00080 CRL_Code reason; 00081 }; 00082 00083 /** 00084 * Test two CRL entries for equality in all fields. 00085 */ 00086 BOTAN_DLL bool operator==(const CRL_Entry&, const CRL_Entry&); 00087 00088 /** 00089 * Test two CRL entries for inequality in at least one field. 00090 */ 00091 BOTAN_DLL bool operator!=(const CRL_Entry&, const CRL_Entry&); 00092 00093 } 00094 00095 #endif