[Botan-devel] Dubious MinGW error messages
Hans Mull
hans72mull at aol.com
Mon Apr 21 12:54:35 EDT 2008
Hi!
I've just startet using botan and want to encrypt a string with a string
password so I've modified the code from the tutorial slightly (removed
the DataSink stuff etc.). When using Botan 1.6.4 on
Win32/Code::Blocks/MinGW 5.1.3 the comppiler complains about many
things. This is my code:
string botanEncrypt(string plaintext, string passphrase, string cipher)
{
///Adapter code
stringstream ptss(plaintext);
stringstream ctss;
///Botan code
LibraryInitializer init;
S2K* s2k = get_s2k("PBKDF2(SHA-1)");
s2k->set_iterations(4096);
s2k->new_random_salt(8);
SecureVector<byte> the_salt = s2k->current_salt();
SymmetricKey master_key = s2k->derive_key(48, passphrase);
KDF* kdf = get_kdf("KDF2(SHA-1)");
SymmetricKey key = kdf->derive_key(20, master_key, "cipher key");
SymmetricKey mac_key = kdf->derive_key(20, master_key, "hmac key");
InitializationVector iv = kdf->derive_key(8, master_key, "cipher iv");
Pipe pipe
(
new Fork
(
get_cipher(cipher, key, iv, ENCRYPTION),
new MAC_Filter("HMAC(SHA-1)", mac_key)
)
);
ctss << (const char*)the_salt.ptr();
pipe.start_msg();
ptss >> pipe;
pipe.end_msg();
SecureVector<byte> hmac = pipe.read_all(1);
ctss << (const char*)hmac.ptr();
return ctss.str();
}
The error messages are:
C:\Dokumente und
Einstellungen\User\Desktop\1x1\trunk\TextCrypter\CryptoWrappers.h||In
function `std::string botanEncrypt(std::string, std::string, std::string)':|
C:\Dokumente und
Einstellungen\User\Desktop\1x1\trunk\TextCrypter\CryptoWrappers.h|30|error:
no matching function for call to `Botan::KDF::derive_key(int,
Botan::SymmetricKey&, const char[11])'|
C:\MinGW\include\botan\pk_util.h|53|note: candidates are:
Botan::SecureVector<Botan::byte> Botan::KDF::derive_key(Botan::u32bit,
const Botan::MemoryRegion<Botan::byte>&, const std::string&) const|
C:\MinGW\include\botan\pk_util.h|55|note:
Botan::SecureVector<Botan::byte> Botan::KDF::derive_key(Botan::u32bit,
const Botan::MemoryRegion<Botan::byte>&, const
Botan::MemoryRegion<Botan::byte>&) const|
C:\MinGW\include\botan\pk_util.h|57|note:
Botan::SecureVector<Botan::byte> Botan::KDF::derive_key(Botan::u32bit,
const Botan::MemoryRegion<Botan::byte>&, const Botan::byte*,
Botan::u32bit) const|
C:\MinGW\include\botan\pk_util.h|60|note:
Botan::SecureVector<Botan::byte> Botan::KDF::derive_key(Botan::u32bit,
const Botan::byte*, Botan::u32bit, const std::string&) const|
C:\MinGW\include\botan\pk_util.h|62|note:
Botan::SecureVector<Botan::byte> Botan::KDF::derive_key(Botan::u32bit,
const Botan::byte*, Botan::u32bit, const Botan::byte*, Botan::u32bit) const|
C:\Dokumente und
Einstellungen\User\Desktop\1x1\trunk\TextCrypter\CryptoWrappers.h|31|error:
no matching function for call to `Botan::KDF::derive_key(int,
Botan::SymmetricKey&, const char[9])'|
C:\MinGW\include\botan\pk_util.h|53|note: candidates are:
Botan::SecureVector<Botan::byte> Botan::KDF::derive_key(Botan::u32bit,
const Botan::MemoryRegion<Botan::byte>&, const std::string&) const|
C:\MinGW\include\botan\pk_util.h|55|note:
Botan::SecureVector<Botan::byte> Botan::KDF::derive_key(Botan::u32bit,
const Botan::MemoryRegion<Botan::byte>&, const
Botan::MemoryRegion<Botan::byte>&) const|
C:\MinGW\include\botan\pk_util.h|57|note:
Botan::SecureVector<Botan::byte> Botan::KDF::derive_key(Botan::u32bit,
const Botan::MemoryRegion<Botan::byte>&, const Botan::byte*,
Botan::u32bit) const|
C:\MinGW\include\botan\pk_util.h|60|note:
Botan::SecureVector<Botan::byte> Botan::KDF::derive_key(Botan::u32bit,
const Botan::byte*, Botan::u32bit, const std::string&) const|
C:\MinGW\include\botan\pk_util.h|62|note:
Botan::SecureVector<Botan::byte> Botan::KDF::derive_key(Botan::u32bit,
const Botan::byte*, Botan::u32bit, const Botan::byte*, Botan::u32bit) const|
C:\Dokumente und
Einstellungen\User\Desktop\1x1\trunk\TextCrypter\CryptoWrappers.h|32|error:
no matching function for call to `Botan::KDF::derive_key(int,
Botan::SymmetricKey&, const char[10])'|
C:\MinGW\include\botan\pk_util.h|53|note: candidates are:
Botan::SecureVector<Botan::byte> Botan::KDF::derive_key(Botan::u32bit,
const Botan::MemoryRegion<Botan::byte>&, const std::string&) const|
C:\MinGW\include\botan\pk_util.h|55|note:
Botan::SecureVector<Botan::byte> Botan::KDF::derive_key(Botan::u32bit,
const Botan::MemoryRegion<Botan::byte>&, const
Botan::MemoryRegion<Botan::byte>&) const|
C:\MinGW\include\botan\pk_util.h|57|note:
Botan::SecureVector<Botan::byte> Botan::KDF::derive_key(Botan::u32bit,
const Botan::MemoryRegion<Botan::byte>&, const Botan::byte*,
Botan::u32bit) const|
C:\MinGW\include\botan\pk_util.h|60|note:
Botan::SecureVector<Botan::byte> Botan::KDF::derive_key(Botan::u32bit,
const Botan::byte*, Botan::u32bit, const std::string&) const|
C:\MinGW\include\botan\pk_util.h|62|note:
Botan::SecureVector<Botan::byte> Botan::KDF::derive_key(Botan::u32bit,
const Botan::byte*, Botan::u32bit, const Botan::byte*, Botan::u32bit) const|
C:\Dokumente und
Einstellungen\User\Desktop\1x1\trunk\TextCrypter\CryptoWrappers.h|41|error:
'class Botan::SecureVector<Botan::byte>' has no member named 'ptr'|
C:\Dokumente und
Einstellungen\User\Desktop\1x1\trunk\TextCrypter\CryptoWrappers.h|48|error:
'class Botan::SecureVector<Botan::byte>' has no member named 'ptr'|
||=== Build finished: 5 errors, 0 warnings ===|
Which function should I use instead the one from the tutorial? I think
these error messages appear because the tutorial is a bit outdated.
It would be kind if you help me!
Thanks in advance, Hans
More information about the botan-devel
mailing list