Retired horse trader.
Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
James Sabre wrote:One can RSA encrypt the whole file by breaking the file into sections shorter than the RSA modulus (-11 bytes if one uses PKCS1 padding) but this is very very very slow. The standard approach to RSA encryption of files of any length is to use a hybrid approach. One uses a symmetric encryption (AES, Blowfish , DES etc) to actually encrypt the data using a random 'session' key and one only uses RSA to encrypt the session key. The encrypted file then consists of the concatenation of the encrypted session key and the symmetric encrypted file content. To decrypt one just extracts the encrypted session key, RSA decrypts it then using the symmetric algorithm decrypts the file content using this session key.
There is a good description of the approach in section 13.6 of "Practical Cryptography" by Ferguson and Schneier. PGP uses this general approach but the detail differs from that described in section 13.6 .
Campbell Ritchie wrote:Welcome to the Ranch
![]()
I have added some new lines to your code because long lines are difficult to read. I shall move this discussion because it is too difficult for "beginning".
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Christopher Chan wrote:
i have considered that but my supervisor is adamant on having rsa by itself. mind advising on how to split and recombine? much thanks
Retired horse trader.
Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
Christopher Chan wrote:i have considered that but my supervisor is adamant on having rsa by itself. mind advising on how to split and recombine? much thanks
Pat Farrell wrote:
Christopher Chan wrote:i have considered that but my supervisor is adamant on having rsa by itself. mind advising on how to split and recombine? much thanks
Your supervisor *must* be educated. S/He is wrong. Its an evil and broken requirement. The standard practice is to create a session key randomly. Encrypt and send the session key to the other end, and use DES/3DES/AES to encipher the long text.
Retired horse trader.
Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
James Sabre wrote:If this is for a school/college/university assignment for somebody learning Java then it is a bad assignment. If it is for the OP's work then his supervisor is an idiot.