-2

I have to implement RSA Algorithm for about 50 different text files

But the problem where i stuck is that:-

RSA Algorithm generates an encrypted value for one character(ASCII) or for any number

But i need to encrypt different files having larger messages like

"My name is MARK, I must have to implement this RSA in any case..........

....

...

... large text upto 70-80 lines "

written in single text file

I googled my problem but didnt find any satisfactory answers for it..

If you know how can i do that that kindly help me with some link or something I need to implement this in any case ...

I am struggling on it with all my efforts

Hassnain
  • 154
  • 1
  • 2
  • 17

1 Answers1

1

you typically generate a random number and use that as key to encrypt the file using a block cipher (like aes), then encrypt the key (a single number) with rsa.

for example, see What is the limit to the amount of data that can be encrypted with RSA?

however, you can also use rsa to encrypt small sequences of characters by treating the entire sequence as a large binary number (for example, 4 8-bit characters as a single 32 bit integer).

don't forget to use padding when encrypting with rsa.

Community
  • 1
  • 1
andrew cooke
  • 45,717
  • 10
  • 93
  • 143