blob: 4b861ec8161142f7bbc7b22322e21e804dd7ef10 (
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
/*
* EAC1_1 CVC ADO
* (C) 2008 Falko Strenzke
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
#ifndef BOTAN_EAC_CVC_ADO_H__
#define BOTAN_EAC_CVC_ADO_H__
#include <botan/eac_obj.h>
#include <botan/eac_asn_obj.h>
#include <botan/cvc_req.h>
#include <string>
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<EAC1_1_ADO>
{
public:
friend class EAC1_1_obj<EAC1_1_ADO>;
/**
* 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 std::vector<byte> make_signed(
PK_Signer& signer,
const std::vector<byte>& 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
*/
std::vector<byte> 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,
std::vector<byte> & res_tbs_bits,
ECDSA_Signature & res_sig);
};
inline bool operator!=(EAC1_1_ADO const& lhs, EAC1_1_ADO const& rhs)
{
return (!(lhs == rhs));
}
}
#endif
|