Hi
Note that most public key algorithms are relatively computationally costly (relatively slow), in comparison with many symmetric key algorithms.
hybrid cryptosystems (public key algorithms and symmetric key algorithms) for reasons of efficiency are used;
1- in such a cryptosystem, a shared secret key ("session key") is generated by one party, this session key is then encrypted by each recipient's public key.
2- Each recipient uses the corresponding private key to decrypt the session key.
Once all parties have obtained the session key,
3- they can use a much faster symmetric algorithm to encrypt and decrypt messages.
Reference:
Regards
Haytham
Vadym Fedyukovych <[EMAIL PROTECTED]> wrote:
Vadym Fedyukovych <[EMAIL PROTECTED]> wrote:
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
Celebrate Earth Day everyday! Discover 10 things you can do to help slow climate change. Yahoo! Earth Day
