Botan
1.11.15
|
00001 /* 00002 * (C) 2007 FlexSecure GmbH 00003 * 2008-2010 Jack Lloyd 00004 * 00005 * Botan is released under the Simplified BSD License (see license.txt) 00006 */ 00007 00008 #include <botan/cvc_req.h> 00009 #include <botan/cvc_cert.h> 00010 #include <botan/ber_dec.h> 00011 00012 namespace Botan { 00013 00014 bool EAC1_1_Req::operator==(EAC1_1_Req const& rhs) const 00015 { 00016 return (this->tbs_data() == rhs.tbs_data() && 00017 this->get_concat_sig() == rhs.get_concat_sig()); 00018 } 00019 00020 void EAC1_1_Req::force_decode() 00021 { 00022 std::vector<byte> enc_pk; 00023 BER_Decoder tbs_cert(tbs_bits); 00024 size_t cpi; 00025 tbs_cert.decode(cpi, ASN1_Tag(41), APPLICATION) 00026 .start_cons(ASN1_Tag(73)) 00027 .raw_bytes(enc_pk) 00028 .end_cons() 00029 .decode(m_chr) 00030 .verify_end(); 00031 00032 if(cpi != 0) 00033 throw Decoding_Error("EAC1_1 requests cpi was not 0"); 00034 00035 m_pk = decode_eac1_1_key(enc_pk, sig_algo); 00036 } 00037 00038 EAC1_1_Req::EAC1_1_Req(DataSource& in) 00039 { 00040 init(in); 00041 self_signed = true; 00042 do_decode(); 00043 } 00044 00045 EAC1_1_Req::EAC1_1_Req(const std::string& in) 00046 { 00047 DataSource_Stream stream(in, true); 00048 init(stream); 00049 self_signed = true; 00050 do_decode(); 00051 } 00052 00053 }