Going back to the original (from test.cpp), it looks like there's a
typo:

FileSource pubFile(pubFilename, true, new HexEncoder);

To confirm the typo, run "cryptest.exe r" to invoke the original
routines.

Jeff

string RSAEncryptString(const char *pubFilename, const char *seed,
const char *message)
{
        FileSource pubFile(pubFilename, true, new HexDecoder);
        RSAES_OAEP_SHA_Encryptor pub(pubFile);

        RandomPool randPool;
        randPool.IncorporateEntropy((byte *)seed, strlen(seed));

        string result;
        StringSource(message, true, new PK_EncryptorFilter(randPool, pub, new
HexEncoder(new StringSink(result))));
        return result;
}


On Oct 15, 2:54 pm, nuges01 <[email protected]> wrote:
> Hi,
>
> I copied the functions RSAEncryptString and RSADecryptString from
> test.cpp and I'm currently having problems running the
> RSADecryptString function. I'm using a slightly modified version (I'm
> using StringSource instead of FileSource):
>
> string RSADecryptString(const string privateKey, const string
> ciphertext)
> {
>         StringSource privString(privateKey, true, new HexDecoder);
>         RSAES_OAEP_SHA_Decryptor priv(privString);
>         string result;
>         StringSource(ciphertext, true, new HexDecoder(new
> PK_DecryptorFilter(GlobalRNG(), priv, new StringSink(result))));
>         return result;
>
> }
>
> I'm generating public and private keys using the function
> GenerateRSAKey(), also from test.cpp.
>
> When I run this function, I get the following error: Unhandled
> exception at 0x0080f657 in cryptest.exe: 0xC0000005: Access violation
> reading location 0x00000008.
>
> It breaks at StringSource(ciphertext,....) and I just can't figure out
> why. Could it be the length of the keys, cos I had a similar message
> when I was trying to encrypt with keyLength=32? Now keyLength=1024.
>
> Any help will be appreciated.
> Thanks!

-- 
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.

Reply via email to