On 12/14/05, Amir (sent by Nabble.com) <[EMAIL PROTECTED]> wrote:
Thank you for your reply,
I do not undrestand the last paragraph very well. I know how to encrypte a file using a symmetric algorithm. But i dont know what do you mean by "then encrypting with the RSA key"
Encrypting by by a symmetric al will give me a file with the same size.
I all want to do is to give a public key to someone to encrypt large files and send it to me.
Amir
Sent from the OpenSSL - User forum at Nabble.com:
Re: How to encrypt a large file by a public key?
OK, this is what you want to do:
Imagine that you want your friend to send you an arbitrarily large file F encrypted. We assume that your friend has your public key PubK. He proceeds as follows:
1) Randomly generate a key K to be used with some symmetric algorithm, e.g. AES.
2) Encrypt F with AES (not RSA) and key K.
3) Encrypt K with RSA, using key PubK.
4) Send the encrypted F and K to you.
You would proceed as follows:
1) Decrypt the encrypted K with RSA, using your private key PrK.
2) Decrypt the encrypted F with AES, using the K just decrypted.
Your friend could potentially use RSA to encrypt the whole F. This, however, would be terribly inefficient: not only would he have to do the encryption in chunks, as described in my previous note, but, in addition, RSA is hundreds of times slower than AES. On your side, things would be even worse, for the RSA private key operation is an order of magnitude slower than its public key counterpart.