diff options
author | lloyd <[email protected]> | 2006-06-03 06:59:11 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-06-03 06:59:11 +0000 |
commit | 720ef4cd84b5ac9ca127c44d891de11e61e4a584 (patch) | |
tree | f5b89afb6626d001345975d8e786904b4cee3e0c /misc/cms/cms_dec.cpp | |
parent | 4b2d4d38ce6e9b96e75b68026eece044d77edc7f (diff) |
Various hacks that get the old CMS code close to compiling under
mainline. Not completely done, getting some of it to work may
require changes to the ASN.1 code.
Diffstat (limited to 'misc/cms/cms_dec.cpp')
-rw-r--r-- | misc/cms/cms_dec.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/misc/cms/cms_dec.cpp b/misc/cms/cms_dec.cpp index 799e20b97..63aab9bd9 100644 --- a/misc/cms/cms_dec.cpp +++ b/misc/cms/cms_dec.cpp @@ -5,6 +5,7 @@ #include <botan/cms_dec.h> #include <botan/ber_dec.h> +#include <botan/asn1_int.h> #include <botan/oids.h> #include <botan/pem.h> @@ -21,7 +22,7 @@ CMS_Decoder::CMS_Decoder(DataSource& in, const X509_Store& x509store, add_key(key); - if(BER::maybe_BER(in) && !PEM_Code::matches(in)) + if(ASN1::maybe_BER(in) && !PEM_Code::matches(in)) initial_read(in); else { @@ -35,11 +36,18 @@ CMS_Decoder::CMS_Decoder(DataSource& in, const X509_Store& x509store, *************************************************/ void CMS_Decoder::initial_read(DataSource& in) { + // FIXME... + + /* BER_Decoder decoder(in); - BER_Decoder content_info = BER::get_subsequence(decoder); - BER::decode(content_info, next_type); + BER_Decoder content_info = decoder.start_cons(SEQUENCE); + + content_info.decode(next_type); + + BER_Decoder content_type = BER::get_subsequence(content_info, ASN1_Tag(0)); data = content_type.get_remaining(); + */ decode_layer(); } @@ -74,7 +82,7 @@ std::string CMS_Decoder::get_data() const { if(layer_type() != DATA) throw Invalid_State("CMS: Cannot retrieve data from non-DATA layer"); - return std::string((const char*)data.ptr(), data.size()); + return std::string((const char*)data.begin(), data.size()); } /************************************************* @@ -104,11 +112,12 @@ std::string CMS_Decoder::layer_info() const *************************************************/ void CMS_Decoder::read_econtent(BER_Decoder& decoder) { - BER_Decoder econtent_info = BER::get_subsequence(decoder); - BER::decode(econtent_info, next_type); + BER_Decoder econtent_info = decoder.start_cons(SEQUENCE); + econtent_info.decode(next_type); - BER_Decoder econtent = BER::get_subsequence(econtent_info, ASN1_Tag(0)); - BER::decode(econtent, data, OCTET_STRING); + // FIXME + //BER_Decoder econtent = BER::get_subsequence(econtent_info, ASN1_Tag(0)); + //econtent.decode(data, OCTET_STRING); } } |