diff options
author | lloyd <[email protected]> | 2014-01-01 21:20:55 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-01-01 21:20:55 +0000 |
commit | 197dc467dec28a04c3b2f30da7cef122dfbb13e9 (patch) | |
tree | cdbd3ddaec051c72f0a757db461973d90c37b97a /lib/cert/cvc/cvc_req.cpp | |
parent | 62faac373c07cfe10bc8c309e89ebdd30d8e5eaa (diff) |
Shuffle things around. Add NIST X.509 test to build.
Diffstat (limited to 'lib/cert/cvc/cvc_req.cpp')
-rw-r--r-- | lib/cert/cvc/cvc_req.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/lib/cert/cvc/cvc_req.cpp b/lib/cert/cvc/cvc_req.cpp new file mode 100644 index 000000000..6c013f755 --- /dev/null +++ b/lib/cert/cvc/cvc_req.cpp @@ -0,0 +1,53 @@ +/* + (C) 2007 FlexSecure GmbH + 2008-2010 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#include <botan/cvc_req.h> +#include <botan/cvc_cert.h> +#include <botan/ber_dec.h> + +namespace Botan { + +bool EAC1_1_Req::operator==(EAC1_1_Req const& rhs) const + { + return (this->tbs_data() == rhs.tbs_data() && + this->get_concat_sig() == rhs.get_concat_sig()); + } + +void EAC1_1_Req::force_decode() + { + std::vector<byte> enc_pk; + BER_Decoder tbs_cert(tbs_bits); + size_t cpi; + tbs_cert.decode(cpi, ASN1_Tag(41), APPLICATION) + .start_cons(ASN1_Tag(73)) + .raw_bytes(enc_pk) + .end_cons() + .decode(m_chr) + .verify_end(); + + if(cpi != 0) + throw Decoding_Error("EAC1_1 requests cpi was not 0"); + + m_pk = decode_eac1_1_key(enc_pk, sig_algo); + } + +EAC1_1_Req::EAC1_1_Req(DataSource& in) + { + init(in); + self_signed = true; + do_decode(); + } + +EAC1_1_Req::EAC1_1_Req(const std::string& in) + { + DataSource_Stream stream(in, true); + init(stream); + self_signed = true; + do_decode(); + } + +} |