Botan  1.10.9
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 }
void init(DataSource &in)
Definition: eac_obj.h:38
AlgorithmIdentifier sig_algo
Definition: signed_obj.h:85
bool operator==(const EAC1_1_Req &other) const
Definition: cvc_req.cpp:14
ASN1_Tag
Definition: asn1_int.h:19
SecureVector< byte > get_concat_sig() const
Definition: eac_obj.h:27
SecureVector< byte > tbs_data() const
ECDSA_PublicKey * decode_eac1_1_key(const MemoryRegion< byte > &, AlgorithmIdentifier &)
Definition: cvc_cert.cpp:91
SecureVector< byte > tbs_bits
Definition: signed_obj.h:86