Botan  2.6.0
Crypto and TLS for C++11
ocsp_types.h
Go to the documentation of this file.
1 /*
2 * OCSP subtypes
3 * (C) 2012 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_OCSP_TYPES_H_
9 #define BOTAN_OCSP_TYPES_H_
10 
11 #include <botan/x509cert.h>
12 #include <botan/asn1_time.h>
13 #include <botan/bigint.h>
14 
15 namespace Botan {
16 
17 namespace OCSP {
18 
19 class BOTAN_PUBLIC_API(2,0) CertID final : public ASN1_Object
20  {
21  public:
22  CertID() = default;
23 
24  CertID(const X509_Certificate& issuer,
25  const BigInt& subject_serial);
26 
27  bool is_id_for(const X509_Certificate& issuer,
28  const X509_Certificate& subject) const;
29 
30  void encode_into(class DER_Encoder& to) const override;
31 
32  void decode_from(class BER_Decoder& from) override;
33 
34  const std::vector<uint8_t>& issuer_key_hash() const { return m_issuer_key_hash; }
35 
36  private:
37  AlgorithmIdentifier m_hash_id;
38  std::vector<uint8_t> m_issuer_dn_hash;
39  std::vector<uint8_t> m_issuer_key_hash;
40  BigInt m_subject_serial;
41  };
42 
43 class BOTAN_PUBLIC_API(2,0) SingleResponse final : public ASN1_Object
44  {
45  public:
46  const CertID& certid() const { return m_certid; }
47 
48  size_t cert_status() const { return m_cert_status; }
49 
50  X509_Time this_update() const { return m_thisupdate; }
51 
52  X509_Time next_update() const { return m_nextupdate; }
53 
54  void encode_into(class DER_Encoder& to) const override;
55 
56  void decode_from(class BER_Decoder& from) override;
57  private:
58  CertID m_certid;
59  size_t m_cert_status = 2; // unknown
60  X509_Time m_thisupdate;
61  X509_Time m_nextupdate;
62  };
63 
64 }
65 
66 }
67 
68 #endif
const CertID & certid() const
Definition: ocsp_types.h:46
const std::vector< uint8_t > & issuer_key_hash() const
Definition: ocsp_types.h:34
X509_Time this_update() const
Definition: ocsp_types.h:50
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
size_t cert_status() const
Definition: ocsp_types.h:48
X509_Time next_update() const
Definition: ocsp_types.h:52
Definition: alg_id.cpp:13