I have read some posts about how a StringSink works. My problem is that I am importing the crypto++ library into a massive videogame engine, and one of the first things that the engine does is overwrite the new and delete operators. I got the dll importing correctly and the FIPS140_SampleApplication function from the dllTest.cpp pretty much working. My main problem is when I call this function from the game and the function exits, I get an "Unhandled exception thrown," usually in a delete() function somewhere in the source defining the platform. I have tried to overwrite the operators again as in the dlltest.cpp, and I get many errors. I am unsure as to what the main problem is, but I do know when I use a StringSink I get problems. My course of action is to start with what is working and go from there. As others have asked before me, does anyone know a quick and easy example that uses RSA? I feel bad asking this question, but I'm dealing with a pretty massive code base which deals with handling memory, and I have very little experience with it. The first part of the FIPS140_SampleApplication function works, but when it gets to DSA encoding, it crashes. Part of the code that works is:

// hash
                const byte message[] = {'a', 'b', 'c'};
const byte expectedDigest[] = {0xA9,0x99,0x3E,0x36,0x47,0x06,0x81,0x6A,0xBA,0x3E,0x25,0x71,0x78,0x50,0xC2,0x6C,0x9C,0xD0,0xD8,0x9D};
                byte digest[20];

                SHA1 sha;
                sha.Update(message, 3);
                sha.Final(digest);

                if (memcmp(digest, expectedDigest, 20) != 0)
                {
                        cerr << "SHA-1 hash failed.\n";
                        abort();
                }
                cout << "4. SHA-1 hash succeeded.\n";


Can anyone please write an RSA example like this?
Thanks


Reply via email to