Botan 1.10.17

cvc_req.cpp
Go to the documentation of this file.
1 /*
2 (C) 2007 FlexSecure GmbH
3 2008-2010 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #include <botan/cvc_req.h>
9 #include <botan/cvc_cert.h>
10 #include <botan/ber_dec.h>
11
12 namespace Botan {
13
14 bool EAC1_1_Req::operator==(EAC1_1_Req const& rhs) const
15 {
16 return (this->tbs_data() == rhs.tbs_data() &&
17 this->get_concat_sig() == rhs.get_concat_sig());
18 }
19
20 void EAC1_1_Req::force_decode()
21 {
22 SecureVector<byte> enc_pk;
23 BER_Decoder tbs_cert(tbs_bits);
24 size_t cpi;
25 tbs_cert.decode(cpi, ASN1_Tag(41), APPLICATION)
26 .start_cons(ASN1_Tag(73))
27 .raw_bytes(enc_pk)
28 .end_cons()
29 .decode(m_chr)
30 .verify_end();
31
32 if(cpi != 0)
33 throw Decoding_Error("EAC1_1 requests cpi was not 0");
34
35 m_pk = decode_eac1_1_key(enc_pk, sig_algo);
36 }
37
38 EAC1_1_Req::EAC1_1_Req(DataSource& in)
39 {
40 init(in);
41 self_signed = true;
42 do_decode();
43 }
44
45 EAC1_1_Req::EAC1_1_Req(const std::string& in)
46 {
47 DataSource_Stream stream(in, true);
48 init(stream);
49 self_signed = true;
50 do_decode();
51 }
52
53 }
Botan::EAC1_1_Req
Definition: cvc_req.h:19
Botan::EAC1_1_obj< EAC1_1_Req >::get_concat_sig
SecureVector< byte > get_concat_sig() const
Definition: eac_obj.h:27
Botan::DataSource_Stream
Definition: data_src.h:128
Botan::EAC1_1_obj< EAC1_1_Req >::init
void init(DataSource &in)
Definition: eac_obj.h:38
Botan::EAC_Signed_Object::do_decode
void do_decode()
Definition: signed_obj.cpp:79
Botan::EAC_Signed_Object::sig_algo
AlgorithmIdentifier sig_algo
Definition: signed_obj.h:85
Botan::DataSource
Definition: data_src.h:20
Botan::ASN1_Tag
ASN1_Tag
Definition: asn1_int.h:19
Botan::Decoding_Error
Definition: exceptn.h:138
Botan
Definition: algo_base.h:14
Botan::EAC1_1_gen_CVC< EAC1_1_Req >::self_signed
bool self_signed
Definition: cvc_gen_cert.h:88
Botan::decode_eac1_1_key
ECDSA_PublicKey * decode_eac1_1_key(const MemoryRegion< byte > &, AlgorithmIdentifier &)
Definition: cvc_cert.cpp:91
Botan::APPLICATION
Definition: asn1_int.h:21
Botan::EAC1_1_Req::operator==
bool operator==(const EAC1_1_Req &other) const
Definition: cvc_req.cpp:14
Botan::EAC1_1_gen_CVC< EAC1_1_Req >::m_chr
ASN1_Chr m_chr
Definition: cvc_gen_cert.h:87
Botan::SecureVector< byte >
Botan::EAC_Signed_Object::tbs_bits
SecureVector< byte > tbs_bits
Definition: signed_obj.h:86
Botan::BER_Decoder
Definition: ber_dec.h:19
Botan::EAC1_1_gen_CVC< EAC1_1_Req >::tbs_data
SecureVector< byte > tbs_data() const
Definition: cvc_gen_cert.h:136
Botan::EAC1_1_gen_CVC< EAC1_1_Req >::m_pk
ECDSA_PublicKey * m_pk
Definition: cvc_gen_cert.h:86