diff options
Diffstat (limited to 'src/cms')
-rw-r--r-- | src/cms/cms_algo.cpp | 19 | ||||
-rw-r--r-- | src/cms/cms_dalg.cpp | 6 | ||||
-rw-r--r-- | src/cms/cms_dec.cpp | 2 | ||||
-rw-r--r-- | src/cms/cms_ealg.cpp | 3 | ||||
-rw-r--r-- | src/cms/info.txt | 2 |
5 files changed, 17 insertions, 15 deletions
diff --git a/src/cms/cms_algo.cpp b/src/cms/cms_algo.cpp index 686a79b4e..33652a6b6 100644 --- a/src/cms/cms_algo.cpp +++ b/src/cms/cms_algo.cpp @@ -33,17 +33,18 @@ SecureVector<byte> do_rfc3217_wrap(RandomNumberGenerator& rng, public: std::string name() const { return "Fip_Bytes"; } - void write(const byte data[], u32bit length) + void write(const byte data[], size_t length) { - buf.append(data, length); + buf += std::make_pair(data, length); } void end_msg() { for(u32bit j = 0; j != buf.size(); j++) send(buf[buf.size()-j-1]); - buf.destroy(); + buf.clear(); } - Flip_Bytes(const SecureVector<byte>& prefix) { buf.append(prefix); } + + Flip_Bytes(const SecureVector<byte>& prefix) : buf(prefix) {} private: SecureVector<byte> buf; }; @@ -52,7 +53,7 @@ SecureVector<byte> do_rfc3217_wrap(RandomNumberGenerator& rng, const BlockCipher* cipher = af.prototype_block_cipher(cipher_name); - if(!cipher || cipher->BLOCK_SIZE != 8) + if(!cipher || cipher->block_size() != 8) throw Encoding_Error("do_rfc3217_wrap: Bad cipher: " + cipher_name); Pipe icv(new Hash_Filter(new SHA_160, 8)); @@ -98,10 +99,10 @@ SecureVector<byte> CMS_Encoder::wrap_key(RandomNumberGenerator& rng, throw Encoding_Error("CMS: 128-bit KEKs must be used with " + cipher); SecureVector<byte> lcekpad; - lcekpad.append((byte)cek.length()); - lcekpad.append(cek.bits_of()); + lcekpad.push_back((byte)cek.length()); + lcekpad += cek.bits_of(); while(lcekpad.size() % 8) - lcekpad.append(rng.next_byte()); + lcekpad.push_back(rng.next_byte()); return do_rfc3217_wrap(rng, cipher, kek, lcekpad); } #endif @@ -133,7 +134,7 @@ SecureVector<byte> CMS_Encoder::encode_params(const std::string& cipher, { encoder.start_cons(SEQUENCE). encode(iv.bits_of(), OCTET_STRING). - encode(8*key.length()). + encode(u32bit(8*key.length())). end_cons(); } else diff --git a/src/cms/cms_dalg.cpp b/src/cms/cms_dalg.cpp index f727f2a3f..719b791d2 100644 --- a/src/cms/cms_dalg.cpp +++ b/src/cms/cms_dalg.cpp @@ -6,7 +6,6 @@ */ #include <botan/cms_dec.h> -#include <botan/x509find.h> #include <botan/ber_dec.h> #include <botan/oids.h> #include <botan/hash.h> @@ -37,12 +36,13 @@ SecureVector<byte> hash_of(const SecureVector<byte>& content, * Find a cert based on SignerIdentifier */ std::vector<X509_Certificate> get_cert(BER_Decoder& signer_info, - X509_Store& store) + X509_Store&) { BER_Object id = signer_info.get_next_object(); std::vector<X509_Certificate> found; +#if 0 if(id.type_tag == SEQUENCE && id.class_tag == CONSTRUCTED) { X509_DN issuer; @@ -58,6 +58,8 @@ std::vector<X509_Certificate> get_cert(BER_Decoder& signer_info, found = store.get_certs(X509_Store_Search::by_skid(id.value)); else throw Decoding_Error("CMS: Unknown tag for cert identifier"); +#endif + throw Internal_Error("Not implemented"); // verify cert if found diff --git a/src/cms/cms_dec.cpp b/src/cms/cms_dec.cpp index fdb9a4a54..c86e1d0ae 100644 --- a/src/cms/cms_dec.cpp +++ b/src/cms/cms_dec.cpp @@ -86,7 +86,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.begin(), data.size()); + return std::string((const char*)&data[0], data.size()); } /* diff --git a/src/cms/cms_ealg.cpp b/src/cms/cms_ealg.cpp index b910b89d2..85e2d1370 100644 --- a/src/cms/cms_ealg.cpp +++ b/src/cms/cms_ealg.cpp @@ -14,7 +14,6 @@ #include <botan/oids.h> #include <botan/pipe.h> #include <botan/pubkey.h> -#include <botan/x509find.h> #include <memory> namespace Botan { @@ -259,7 +258,7 @@ SecureVector<byte> CMS_Encoder::do_encrypt(RandomNumberGenerator& rng, if(!OIDS::have_oid(cipher->name() + "/CBC")) throw Encoding_Error("CMS: No OID assigned for " + cipher_name + "/CBC"); - InitializationVector iv(rng, cipher->BLOCK_SIZE); + InitializationVector iv(rng, cipher->block_size()); AlgorithmIdentifier content_cipher; content_cipher.oid = OIDS::lookup(cipher->name() + "/CBC"); diff --git a/src/cms/info.txt b/src/cms/info.txt index b863a9a26..708f1d592 100644 --- a/src/cms/info.txt +++ b/src/cms/info.txt @@ -12,5 +12,5 @@ pem pubkey sha1 sym_algo -x509 +x509cert </requires> |