aboutsummaryrefslogtreecommitdiffstats
path: root/include/x509_obj.h
blob: f7f110a42fd616de13b52de877b8e39790237fc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*************************************************
* X.509 SIGNED Object Header File                *
* (C) 1999-2006 The Botan Project                *
*************************************************/

#ifndef BOTAN_X509_OBJECT_H__
#define BOTAN_X509_OBJECT_H__

#include <botan/asn1_obj.h>
#include <botan/pipe.h>
#include <vector>

namespace Botan {

/*************************************************
* Generic X.509 SIGNED Object                    *
*************************************************/
class X509_Object
   {
   public:
      SecureVector<byte> tbs_data() const;
      SecureVector<byte> signature() const;
      AlgorithmIdentifier signature_algorithm() const;

      bool check_signature(class X509_PublicKey&) const;

      void encode(Pipe&, X509_Encoding = PEM) const;
      SecureVector<byte> BER_encode() const;
      std::string PEM_encode() const;

      X509_Object(DataSource&, const std::string&);
      X509_Object(const std::string&, const std::string&);
      virtual ~X509_Object() {}
   protected:
      void do_decode();
      X509_Object() {}
      AlgorithmIdentifier sig_algo;
      SecureVector<byte> tbs_bits, sig;
   private:
      virtual void force_decode() = 0;
      void init(DataSource&, const std::string&);
      void decode_info(DataSource&);
      std::vector<std::string> PEM_labels_allowed;
      std::string PEM_label_pref;
   };

}

#endif