Botan  1.11.15
src/lib/cert/x509/ocsp_types.h
Go to the documentation of this file.
00001 /*
00002 * OCSP subtypes
00003 * (C) 2012 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #ifndef BOTAN_OCSP_TYPES_H__
00009 #define BOTAN_OCSP_TYPES_H__
00010 
00011 #include <botan/x509cert.h>
00012 #include <botan/asn1_time.h>
00013 #include <botan/bigint.h>
00014 
00015 namespace Botan {
00016 
00017 namespace OCSP {
00018 
00019 class BOTAN_DLL CertID : public ASN1_Object
00020    {
00021    public:
00022       CertID() {}
00023 
00024       CertID(const X509_Certificate& issuer,
00025              const X509_Certificate& subject);
00026 
00027       bool is_id_for(const X509_Certificate& issuer,
00028                      const X509_Certificate& subject) const;
00029 
00030       void encode_into(class DER_Encoder& to) const override;
00031 
00032       void decode_from(class BER_Decoder& from) override;
00033    private:
00034       std::vector<byte> extract_key_bitstr(const X509_Certificate& cert) const;
00035 
00036       AlgorithmIdentifier m_hash_id;
00037       std::vector<byte> m_issuer_dn_hash;
00038       std::vector<byte> m_issuer_key_hash;
00039       BigInt m_subject_serial;
00040    };
00041 
00042 class BOTAN_DLL SingleResponse : public ASN1_Object
00043    {
00044    public:
00045       const CertID& certid() const { return m_certid; }
00046 
00047       size_t cert_status() const { return m_cert_status; }
00048 
00049       X509_Time this_update() const { return m_thisupdate; }
00050 
00051       X509_Time next_update() const { return m_nextupdate; }
00052 
00053       void encode_into(class DER_Encoder& to) const override;
00054 
00055       void decode_from(class BER_Decoder& from) override;
00056    private:
00057       CertID m_certid;
00058       size_t m_cert_status = 2; // unknown
00059       X509_Time m_thisupdate;
00060       X509_Time m_nextupdate;
00061    };
00062 
00063 }
00064 
00065 }
00066 
00067 #endif