I have a large file that I am trying to encrypt with RSA. Yes, I know that hybrid encryption is typically used in this case, but I would like to use standard public key encryption to see the difference in efficiency.
In order to encrypt such a large file, I understand that I must encrypt block by block. After receiving, an error that stated my byte array was too large to encrypt with RSA-2048, I reduced the byte array to 245 bytes. A byte array of 246 bytes works fine, but it also only works for 246 bytes which is my issue. I need to encrypt the whole file with RSA-2048.
After researching RSA-2048 cryptography to get a better understanding, and block by block encryption, I am still confused about implementing block by block encryption with RSA-2048. This is my first time implementing cryptography in any language. Below is my code pertaining to encrypting the large file with an RSA public key.
Any suggestions as to how I can encrypt the whole large file block by block with RSA are appreciated.