I am trying to encrypt a megabyte of data using a 1024 bit RSA key but when I do I get an error indicating RSA will not process more than 127 bytes of data. Why won it work?
The RSA implementation that ships with Bouncy Castle only allows the encrypting of a single block of data. The RSA algorithm is not suited to streaming data and should not be used that way. In a situation like this you should encrypt the data using a randomly generated key and a symmetric cipher, after that you should encrypt the randomly generated key using RSA, and then send the encrypted data and the encrypted random key to the other end where they can reverse the process (ie. decrypt the random key using their RSA private key and then decrypt the data).
Related Questions
- On Windows 98/98SE/ME, I get the following exception and error message when I try to encrypt some data: com.pheox.jcapi.JCAPIJNIRuntimeException Exception raised in JCAPI.DLL: JCAPICipher_encrypt() - Could not determine the size of encrypted data. How can I resolve it?
- When I fire up the server, mod_ssl stops with the error "Failed to generate temporary 512 bit RSA private key", why?
- Does UDPi have a key management solution, or a particular way to scramble (as opposed to encrypt) data?