/* * EAC1_1 CVC ADO * (C) 2008 Falko Strenzke * * Distributed under the terms of the Botan license */ #ifndef BOTAN_EAC_CVC_ADO_H__ #define BOTAN_EAC_CVC_ADO_H__ #include #include #include #include namespace Botan { /** * This class represents a TR03110 (EAC) v1.1 CVC ADO request */ // CRTP continuation from EAC1_1_obj class BOTAN_DLL EAC1_1_ADO : public EAC1_1_obj { public: friend class EAC1_1_obj; /** * Construct a CVC ADO request from a DER encoded CVC ADO request file. * @param str the path to the DER encoded file */ EAC1_1_ADO(const std::string& str); /** * Construct a CVC ADO request from a data source * @param source the data source */ EAC1_1_ADO(DataSource& source); /** * Create a signed CVC ADO request from to be signed (TBS) data * @param signer the signer used to sign the CVC ADO request * @param tbs_bits the TBS data to sign * @param rng a random number generator */ static MemoryVector make_signed( PK_Signer& signer, const MemoryRegion& tbs_bits, RandomNumberGenerator& rng); /** * Get the CAR of this CVC ADO request * @result the CAR of this CVC ADO request */ ASN1_Car get_car() const; /** * Get the CVC request contained in this object. * @result the CVC request inside this CVC ADO request */ EAC1_1_Req get_request() const; /** * Encode this object into a pipe. Only DER is supported. * @param out the pipe to encode this object into * @param encoding the encoding type to use, must be DER */ void encode(Pipe& out, X509_Encoding encoding) const; bool operator==(EAC1_1_ADO const& rhs) const; /** * Get the TBS data of this CVC ADO request. * @result the TBS data */ SecureVector tbs_data() const; virtual ~EAC1_1_ADO() {} private: ASN1_Car m_car; EAC1_1_Req m_req; void force_decode(); static void decode_info(DataSource& source, SecureVector & res_tbs_bits, ECDSA_Signature & res_sig); }; inline bool operator!=(EAC1_1_ADO const& lhs, EAC1_1_ADO const& rhs) { return (!(lhs == rhs)); } } #endif