Hi w,
I forgot to mention, Default[En/De]cryptorWithMAC provides two
overloads. So if you need to specify a password length, it is there
(see class DefaultEncryptorWithMAC in default.h).
Finally, Default[En/De]cryptorWithMAC uses DES_EDE2 in CBC mode as the
cipher, and SHA as the hash.
Jeff
StringSource(
message,
true,
new DefaultEncryptorWithMAC(
password.c_str(),
password.lenght(),
new StringSink( encrypted )
) // DefaultEncryptorWithMAC
); // StringSource
On 2/24/08, Jeffrey Walton <[EMAIL PROTECTED]> wrote:
> Hi w,
>
> I suspect it has to with your usage of the library. Try the following.
>
> Jeff
>
> #include <iostream>
> #include <string>
>
> using std::string;
> using std::cout;
> using std::endl;
>
> #include "default.h"
> #include "filters.h"
>
> using CryptoPP::DefaultEncryptorWithMAC;
> using CryptoPP::DefaultDecryptorWithMAC;
> using CryptoPP::StringSink;
> using CryptoPP::StringSource;
>
> int main(int argc, char* argv[])
> {
> string message = "secret message";
> string password = "password";
> string encrypted, recovered;
>
> StringSource(
> message,
> true,
> new DefaultEncryptorWithMAC(
> password.c_str(),
> new StringSink( encrypted )
> ) // DefaultEncryptorWithMAC
> ); // StringSource
>
> StringSource(
> encrypted,
> true,
> new DefaultDecryptorWithMAC(
> password.c_str(),
> new StringSink( recovered )
> ) // DefaultDecryptorWithMAC
> ); // StringSource
>
> cout << "Recovered Text:" << endl;
> cout << " " << recovered << endl;
>
> return 0;
> }
>
[SNIP]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users"
Google Group.
To unsubscribe, send an email to [EMAIL PROTECTED]
More information about Crypto++ and this group is available at
http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---