aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/cert/cvc/eac_obj.h
blob: a6e676076b327cc0ff5cbb1090436f76babce54b (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
50
51
52
53
54
55
/*
* EAC1_1 objects
* (C) 2008 Falko Strenzke
*
* Botan is released under the Simplified BSD License (see license.txt)
*/

#ifndef BOTAN_EAC_OBJ_H__
#define BOTAN_EAC_OBJ_H__

#include <botan/signed_obj.h>
#include <botan/ecdsa_sig.h>

namespace Botan {

/**
* TR03110 v1.1 EAC CV Certificate
*/
template<typename Derived> // CRTP is used enable the call sequence:
class EAC1_1_obj : public EAC_Signed_Object
   {
   public:
      /**
      * Return the signature as a concatenation of the encoded parts.
      * @result the concatenated signature
      */
      std::vector<byte> get_concat_sig() const
         { return m_sig.get_concatenation(); }

      bool check_signature(class Public_Key& key) const
         {
         return EAC_Signed_Object::check_signature(key, m_sig.DER_encode());
         }

   protected:
      ECDSA_Signature m_sig;

      void init(DataSource& in)
         {
         try
            {
            Derived::decode_info(in, m_tbs_bits, m_sig);
            }
         catch(Decoding_Error)
            {
            throw Decoding_Error(m_PEM_label_pref + " decoding failed");
            }
         }

      virtual ~EAC1_1_obj<Derived>(){}
   };

}

#endif