What's mean "too much data for RSA block"?
843810Jul 12 2003 — edited Jul 14 2003When I run:
......
Cipher cipher=Cipher.getInstance("RSA/ECB/PKCS1Padding");
cipher.init(Cipher.ENCRYPT_MODE,pubKey);
fileIn=new BufferedInputStream(new FileInputStream(args[1]));
buf=new byte[100];
for(int size=fileIn.read(buf,0,buf.length);size!=-1;size=fileIn.read(buf,0,buf.length))
cipher.update(buf,0,size);
buf=cipher.doFinal(buf);
BufferedOutputStream fileOut=new BufferedOutputStream(new FileOutputStream(args[2]));
fileOut.write(buf);
fileOut.close();
......
but I get an error:
java.lang.ArrayIndexOutOfBoundsException: too much data for RSA block
at org.bouncycastle.jce.provider.JCERSACipher.engineDoFinal(JCERSACipher.java:275)
at javax.crypto.Cipher.doFinal(DashoA6275)
at PublicEncrypt.main(PublicEncrypt.java:44)
Who can help me?