Botan  1.11.15
src/lib/cert/cvc/eac_obj.h
Go to the documentation of this file.
00001 /*
00002 * EAC1_1 objects
00003 * (C) 2008 Falko Strenzke
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #ifndef BOTAN_EAC_OBJ_H__
00009 #define BOTAN_EAC_OBJ_H__
00010 
00011 #include <botan/signed_obj.h>
00012 #include <botan/ecdsa_sig.h>
00013 
00014 namespace Botan {
00015 
00016 /**
00017 * TR03110 v1.1 EAC CV Certificate
00018 */
00019 template<typename Derived> // CRTP is used enable the call sequence:
00020 class EAC1_1_obj : public EAC_Signed_Object
00021    {
00022    public:
00023       /**
00024       * Return the signature as a concatenation of the encoded parts.
00025       * @result the concatenated signature
00026       */
00027       std::vector<byte> get_concat_sig() const
00028          { return m_sig.get_concatenation(); }
00029 
00030       bool check_signature(class Public_Key& key) const
00031          {
00032          return EAC_Signed_Object::check_signature(key, m_sig.DER_encode());
00033          }
00034 
00035    protected:
00036       ECDSA_Signature m_sig;
00037 
00038       void init(DataSource& in)
00039          {
00040          try
00041             {
00042             Derived::decode_info(in, tbs_bits, m_sig);
00043             }
00044          catch(Decoding_Error)
00045             {
00046             throw Decoding_Error(PEM_label_pref + " decoding failed");
00047             }
00048          }
00049 
00050       virtual ~EAC1_1_obj<Derived>(){}
00051    };
00052 
00053 }
00054 
00055 #endif