Botan: src/cert/cvc/cvc_cert.h Source File

Botan 1.10.17

cvc_cert.h
Go to the documentation of this file.
1 /*
2 * EAC1_1 CVC
3 * (C) 2008 Falko Strenzke
4 * 2008 Jack Lloyd
5 *
6 * Distributed under the terms of the Botan license
7 */
8
9 #ifndef BOTAN_CVC_EAC_H__
10 #define BOTAN_CVC_EAC_H__
11
12 #include <botan/cvc_gen_cert.h>
13 #include <botan/ecdsa.h>
14 #include <string>
15
16 namespace Botan {
17
18 /**
19 * This class represents TR03110 (EAC) v1.1 CV Certificates
20 */
21 class BOTAN_DLL EAC1_1_CVC : public EAC1_1_gen_CVC<EAC1_1_CVC>//Signed_Object
22 {
23 public:
24 friend class EAC1_1_obj<EAC1_1_CVC>;
25
26 /**
27 * Get the CAR of the certificate.
28 * @result the CAR of the certificate
29 */
30 ASN1_Car get_car() const;
31
32 /**
33 * Get the CED of this certificate.
34 * @result the CED this certificate
35 */
36 ASN1_Ced get_ced() const;
37
38 /**
39 * Get the CEX of this certificate.
40 * @result the CEX this certificate
41 */
42 ASN1_Cex get_cex() const;
43
44 /**
45 * Get the CHAT value.
46 * @result the CHAT value
47 */
48 u32bit get_chat_value() const;
49
50 bool operator==(const EAC1_1_CVC&) const;
51
52 /**
53 * Construct a CVC from a data source
54 * @param source the data source
55 */
56 EAC1_1_CVC(DataSource& source);
57
58 /**
59 * Construct a CVC from a file
60 * @param str the path to the certificate file
61 */
62 EAC1_1_CVC(const std::string& str);
63
64 virtual ~EAC1_1_CVC() {}
65 private:
66 void force_decode();
67 EAC1_1_CVC() {}
68
69 ASN1_Car m_car;
70 ASN1_Ced m_ced;
71 ASN1_Cex m_cex;
72 byte m_chat_val;
73 OID m_chat_oid;
74 };
75
76 /*
77 * Comparison
78 */
79 inline bool operator!=(EAC1_1_CVC const& lhs, EAC1_1_CVC const& rhs)
80 {
81 return !(lhs == rhs);
82 }
83
84 /**
85 * Create an arbitrary EAC 1.1 CVC.
86 * The desired key encoding must be set within the key (if applicable).
87 * @param signer the signer used to sign the certificate
88 * @param public_key the DER encoded public key to appear in
89 * the certificate
90 * @param car the CAR of the certificate
91 * @param chr the CHR of the certificate
92 * @param holder_auth_templ the holder authorization value byte to
93 * appear in the CHAT of the certificate
94 * @param ced the CED to appear in the certificate
95 * @param cex the CEX to appear in the certificate
96 * @param rng a random number generator
97 */
98 EAC1_1_CVC BOTAN_DLL make_cvc_cert(PK_Signer& signer,
99 const MemoryRegion<byte>& public_key,
100 ASN1_Car const& car,
101 ASN1_Chr const& chr,
102 byte holder_auth_templ,
103 ASN1_Ced ced,
104 ASN1_Cex cex,
105 RandomNumberGenerator& rng);
106
107 /**
108 * Decode an EAC encoding ECDSA key
109 */
110 BOTAN_DLL ECDSA_PublicKey* decode_eac1_1_key(const MemoryRegion<byte>& enc_key,
111 AlgorithmIdentifier& sig_algo);
112
113 }
114
115 #endif
116
Botan::operator!=
bool operator!=(const OctetString &s1, const OctetString &s2)
Definition: symkey.cpp:106
Botan::EAC1_1_CVC
Definition: cvc_cert.h:21
Botan::ASN1_Cex
Definition: eac_asn_obj.h:139
Botan::operator==
bool operator==(const OctetString &s1, const OctetString &s2)
Definition: symkey.cpp:98
Botan::DataSource
Definition: data_src.h:20
Botan::make_cvc_cert
EAC1_1_CVC make_cvc_cert(PK_Signer &signer, MemoryRegion< byte > const &public_key, ASN1_Car const &car, ASN1_Chr const &chr, byte holder_auth_templ, ASN1_Ced ced, ASN1_Cex cex, RandomNumberGenerator &rng)
Definition: cvc_cert.cpp:98
Botan::byte
unsigned char byte
Definition: types.h:22
Botan
Definition: algo_base.h:14
Botan::ASN1_Car
Definition: eac_asn_obj.h:201
Botan::decode_eac1_1_key
ECDSA_PublicKey * decode_eac1_1_key(const MemoryRegion< byte > &, AlgorithmIdentifier &)
Definition: cvc_cert.cpp:91
Botan::EAC1_1_obj
Definition: eac_obj.h:20
Botan::ASN1_Ced
Definition: eac_asn_obj.h:108
Botan::u32bit
unsigned int u32bit
Definition: types.h:32
Botan::EAC1_1_gen_CVC
Definition: cvc_gen_cert.h:23
Botan::EAC1_1_CVC::~EAC1_1_CVC
virtual ~EAC1_1_CVC()
Definition: cvc_cert.h:64