Botan 1.10.17

cvc_ado.h
Go to the documentation of this file.
1 /*
2 * EAC1_1 CVC ADO
3 * (C) 2008 Falko Strenzke
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_EAC_CVC_ADO_H__
9 #define BOTAN_EAC_CVC_ADO_H__
10
11 #include <botan/eac_obj.h>
12 #include <botan/eac_asn_obj.h>
13 #include <botan/cvc_req.h>
14 #include <string>
15
16 namespace Botan {
17
18 /**
19 * This class represents a TR03110 (EAC) v1.1 CVC ADO request
20 */
21
22 // CRTP continuation from EAC1_1_obj
23 class BOTAN_DLL EAC1_1_ADO : public EAC1_1_obj<EAC1_1_ADO>
24 {
25 public:
26 friend class EAC1_1_obj<EAC1_1_ADO>;
27
28 /**
29 * Construct a CVC ADO request from a DER encoded CVC ADO request file.
30 * @param str the path to the DER encoded file
31 */
32 EAC1_1_ADO(const std::string& str);
33
34 /**
35 * Construct a CVC ADO request from a data source
36 * @param source the data source
37 */
38 EAC1_1_ADO(DataSource& source);
39
40 /**
41 * Create a signed CVC ADO request from to be signed (TBS) data
42 * @param signer the signer used to sign the CVC ADO request
43 * @param tbs_bits the TBS data to sign
44 * @param rng a random number generator
45 */
46 static MemoryVector<byte> make_signed(
47 PK_Signer& signer,
48 const MemoryRegion<byte>& tbs_bits,
49 RandomNumberGenerator& rng);
50
51 /**
52 * Get the CAR of this CVC ADO request
53 * @result the CAR of this CVC ADO request
54 */
55 ASN1_Car get_car() const;
56
57 /**
58 * Get the CVC request contained in this object.
59 * @result the CVC request inside this CVC ADO request
60 */
61 EAC1_1_Req get_request() const;
62
63 /**
64 * Encode this object into a pipe. Only DER is supported.
65 * @param out the pipe to encode this object into
66 * @param encoding the encoding type to use, must be DER
67 */
68 void encode(Pipe& out, X509_Encoding encoding) const;
69
70 bool operator==(EAC1_1_ADO const& rhs) const;
71
72 /**
73 * Get the TBS data of this CVC ADO request.
74 * @result the TBS data
75 */
76 SecureVector<byte> tbs_data() const;
77
78 virtual ~EAC1_1_ADO() {}
79 private:
80 ASN1_Car m_car;
81 EAC1_1_Req m_req;
82
83 void force_decode();
84 static void decode_info(DataSource& source,
85 SecureVector<byte> & res_tbs_bits,
86 ECDSA_Signature & res_sig);
87 };
88
89 inline bool operator!=(EAC1_1_ADO const& lhs, EAC1_1_ADO const& rhs)
90 {
91 return (!(lhs == rhs));
92 }
93
94 }
95
96 #endif
97
98
Botan::EAC1_1_Req
Definition: cvc_req.h:19
Botan::operator!=
bool operator!=(const OctetString &s1, const OctetString &s2)
Definition: symkey.cpp:106
Botan::EAC1_1_ADO::~EAC1_1_ADO
virtual ~EAC1_1_ADO()
Definition: cvc_ado.h:78
Botan::RandomNumberGenerator
Definition: rng.h:20
Botan::operator==
bool operator==(const OctetString &s1, const OctetString &s2)
Definition: symkey.cpp:98
Botan::X509_Encoding
X509_Encoding
Definition: pubkey_enums.h:67
Botan::DataSource
Definition: data_src.h:20
Botan::MemoryRegion< byte >
Botan
Definition: algo_base.h:14
Botan::MemoryVector< byte >
Botan::ASN1_Car
Definition: eac_asn_obj.h:201
Botan::PEM_Code::encode
std::string encode(const byte der[], size_t length, const std::string &label, size_t width)
Definition: pem.cpp:19
Botan::EAC1_1_obj
Definition: eac_obj.h:20
Botan::SecureVector< byte >
Botan::Pipe
Definition: pipe.h:25
Botan::PK_Signer
Definition: pubkey.h:123
Botan::EAC1_1_ADO
Definition: cvc_ado.h:23
Botan::ECDSA_Signature
Definition: ecdsa_sig.h:21