On Wed, Apr 19, 2006 at 06:49:10AM +0000, Khurram Shahzad wrote:
> hi all
>
> i use crypto 5.2.1 in my project using the envoirnment MSVC 2003 v7.1. the
> thing i try is i encrypt the small file using RSA public key, with finction
> used for string encryption for RSA... signature like:
>
>
> bool RSAEncryptFile(char *pubFilename, char *seed, const char *in, const char
> *ciphertext)
> {
> FileSource pubFile(pubFilename, true, new HexDecoder);
> RSAES_OAEP_SHA_Encryptor pub(pubFile);
>
> RandomPool randPool;
> randPool.Put((byte *)seed, strlen(seed));
>
> FileSource fE( in, true, new PK_EncryptorFilter(randPool, pub,
> new HexEncoder(new FileSink(ciphertext))) );
>
> return true;
> }
>
> this function RSAEncryptFile takes public key in "char *pubFilename"
> parameter, input file used for encryption in "const char *in" parameter and
> place the encrypted file in "const char *ciphertext" parameter.
>
> it works well on small file of size 56 bytes text file... but when i give
> file
> of size 32MB then my program crash with this exception:
RSA could be used on small data or maybe on small chunks of data.
For a large file, a symmetric cipher could be advised instead
>
> Unhandled exception at 0x7c4ea4e1 in Cpt.exe: Microsoft C++ exception:
> CryptoPP::InvalidArgument @ 0x0012ed94.
>
> and debugger points to file pubkey.cpp line 121:
>
> SecByteBlock paddedBlock(PaddedBlockByteLength());
>
> could anyone help me in this particular senario, may be my function calling
> for
> file encrytion is wronge , or some thing else is to be try..
> thanks..
>
> KHURRAM SHAHZAD