My Problem:
My encryption code working fine for below 64 characters. but if it exceeds 64 character I got following error
javax.crypto.IllegalBlockSizeException: input must be under 64 bytes
Encryption code
cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding);
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
encryptedBytes = cipher.doFinal(message.getBytes(StandardCharsets.UTF_8));
rsaEncrypted= Base64.encodeToString(encryptedBytes, Base64.NO_WRAP);
Key generation code
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
keyGen.initialize(512);
KeyPair keypair = keyGen.genKeyPair();
PublicKey pub = keypair.getPublic();
byte[] pubs = pub.getEncoded();
My question:
It's possible encrypt large text with 512 bits of keys? Any mistake in my code?
Note: If anyone want full of code I will update later.