This code looks fine and works for me with the current Crypto++ code in 
CVS.

What version of Crypto++ are you using? And also I need a stack trace. 
After the debugger breaks at the exception, hit Alt-7 to open a call stack 
window and copy the information for me.

On Thu, Jun 24, 2004 at 06:47:09PM +0300, Cornel Maftuleac wrote:
> Hello everybody.
> I have discovered strange errors when working with 
> StreamTransformationFilter class.
> If something is wrong in the following example please correct me.
> (OS: WinNT, Compiler: VC6.0)
> The follofing example throws exception when returning from main()
> 
> 
> //compiled with Debug Multithreaded DLL
> #include <cryptopp/dll.h>
> using namespace CryptoPP;
> extern "C"
> {
>     void __declspec( dllexport ) GetNewAndDeleteForCryptoPP(PNew &pnew, 
> PDelete &pdelete)
>     {
>         pnew = malloc;
>         pdelete = free;
>     }
> }
> 
> int main()
> {
>     AutoSeededRandomPool rng;
>     unsigned char m_Key[DES::DEFAULT_KEYLENGTH];
>     unsigned char m_iv[DES::BLOCKSIZE];
>     rng.GenerateBlock(m_Key,sizeof(m_Key));
>     rng.GenerateBlock(m_iv,sizeof(m_iv));
> 
>     std::string EncryptionBuffer;
>     ECB_Mode<DES>::Encryption 
> ChiperEncrypt(m_Key,DES::DEFAULT_KEYLENGTH,m_iv);
>     StreamTransformationFilter STFilterEncrypt(ChiperEncrypt,new 
> StringSink(EncryptionBuffer));
>    
>     unsigned char plaintext[] = "test bla bla bla";
> 
>     STFilterEncrypt.Put(plaintext,sizeof(plaintext));
>     STFilterEncrypt.MessageEnd();
> 
>     //well it should exit here without problems I guess ...  :)
>     return 0;
> }

Reply via email to