Original Post
I'm wondering why the following doesn't work: Cipher encrypt = Cipher.getInstance("RSA"); encrypt.init(Cipher.ENCRYPT_MODE, key); ByteArrayInputStream str = new ByteArrayInputStream(data); CipherInputStream cis = new CipherInputStream(str, encrypt); ByteArrayOutputStream out = new ByteArrayOutputStream(); byte tmp[] = new byte[8]; int i = cis.read(tmp); while (i != -1) { out.write(tmp, 0, i); i = cis.read(tmp); } //WORKS ALWAYS TILL 52 characthers //return encrypt.doFinal(data); //this DON"T WORK AL the times buyt sometimes does return out.toString().getBytes(); the doFinal method always works but only upto 52 bytes probably i'm overlooking sth. but can't see directly waht