1 /**
2 * EAC11 objects
3 * 
4 * Copyright:
5 * (C) 2008 Falko Strenzke
6 * (C) 2014-2015 Etienne Cimon
7 *
8 * License:
9 * Botan is released under the Simplified BSD License (see LICENSE.md)
10 */
11 module botan.cert.cvc.eac_obj;
12 
13 import botan.constants;
14 static if (BOTAN_HAS_CARD_VERIFIABLE_CERTIFICATES):
15 
16 import botan.cert.cvc.signed_obj;
17 import botan.cert.cvc.ecdsa_sig;
18 import botan.filters.data_src;
19 import botan.pubkey.pubkey;
20 import botan.utils.types;
21 import botan.utils.exceptn;
22 
23 
24 /**
25 * TR03110 v1.1 EAC CV Certificate
26 */
27 // CRTP is used enable the call sequence:
28 abstract class EAC11obj(Derived) : EACSignedObject, SignedObject
29 {
30 public:
31     /**
32     * Return the signature as a concatenation of the encoded parts.
33     * Returns: the concatenated signature
34     */
35     override const(Vector!ubyte) getConcatSig() const { return m_sig.getConcatenation(); }
36 
37     bool checkSignature(PublicKey key) const
38     {
39         return super.checkSignature(key, m_sig.DER_encode());
40     }
41 
42     ECDSASignature m_sig;
43 
44 protected:
45 
46     void init(DataSource input)
47     {
48         try
49         {
50             Derived.decodeInfo(input, m_tbs_bits, m_sig);
51         }
52         catch(DecodingError e)
53         {
54             throw new DecodingError("EAC11obj decoding failed (" ~ e.msg ~ ")");
55         }
56     }
57 }