Sorry for the double post, I forgot the subject...

Hi to every,
I'm trying to use the CryptoPP library yet I 'm facing strange crashes...

Here follows my code:

int main(int argc, char* argv[]) throw ()
{

AutoSeededRandomPool rng;
RSA::PrivateKey privKey;

privKey.Initialize(rng,256);

FileSink *f;
HexEncoder *h;

f=new FileSink("c:\\a.der");

h=new HexEncoder(f);

privKey.DEREncode(h->Ref()); // (or *h)
h->MessageEnd();
f->MessageEnd();

delete h;
delete f; // <--- ERROR: ACCESS VALIDATION

return 1;
}

I'm using Visual C++ 6 with SP6, CryptoPP version 5.21 linked as a static library.
When I run the program it gives me access violation error on the "delete f", yet the 
program does write the file with the key encoded as an hex string.
If I remove that line all works perfectly... Can anyone give me some clues.
Thanks anticipately.

Bye,
Federico.



Reply via email to