I am trying to decrypt a String, that I have encrypted elsewhere. Here is my code:
private void test() {
try {
String stringMessage=\"Sf3O7Lr2+W
It is possible your feeding the KeyFactory
garbage since you are reading into a 2000 byte array, and your key is probably something like 128 (1024 bits) or 256 (2048 bits) bytes long. Additionally, you shouldn't really use RSA for encryption directly: there are security issues with this the data size you can encrypt is limited by the RSA key size.