Wednesday, August 10, 2005, 9:03:55 AM, you wrote:
BR> I am having a devil of a time catching Crypto++ exceptions.
BR> I added a wrapper file and compiled the library in Microsoft Visual
BR> Studio. The wrapper file is C function headers to encrypt and decrypt
BR> because one of our products is in C. Everything works fine until
BR> something goes wrong.
BR> Code of the problem area, with two of the catch's I've tried:
BR> std::string szRSA; // This has the RSA private key.
BR> try
BR> {
BR> pbyDecryptedData = RSADecryptString(&szRSA, (char*)byEncryptedData);
BR> }
BR> catch ( CryptoPP::Exception excp)
BR> {
BR> // Handle error
BR> }
BR> catch (...)
BR> {
BR> // Handle error
BR> }
BR> When we have an invalid RSA key, a BERDecodeErr exception is thrown, as
BR> expected. In debug, this is causing a Microsoft C++ Exception, but is
BR> then caught and handled. In release, I get 'Runtime Error!' and
BR> 'abnormal program termination'. I cannot get the catch to catch. I've
BR> also tried std::exception.
BR> I'm sure it's something simple and easy that I'm missing, but could
BR> someone please point it out to me? Many thanks in advance.
There is a very nasty bug in VC6 where try-catch blocks can be
optimized into non-existence. My recent experience is described here:
http://blog.surfulater.com/wordpress/?p=28
Have a look at the compiler assembler in the debugger and see if the
try-catch is present. If I can help further let me know.
--
Best regards,
Neville Franks, Author of Surfulater and ED for Windows
Soft As It Gets Pty Ltd, http://www.surfulater.com - http://www.getsoft.com
Victoria, Australia