hello all,
the attached patch --already committed-- fixes the above.
2006-06-11 Raif S. Naffah <[EMAIL PROTECTED]>
PR Classpath/27853
* gnu/javax/crypto/RSACipherImpl.java (engineDoFinal): Was short by 1
byte.
cheers;
rsn
Index: RSACipherImpl.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/javax/crypto/RSACipherImpl.java,v
retrieving revision 1.2
diff -u -r1.2 RSACipherImpl.java
--- RSACipherImpl.java 21 Sep 2005 20:55:40 -0000 1.2
+++ RSACipherImpl.java 11 Jun 2006 07:12:16 -0000
@@ -215,10 +215,11 @@
if (dec[0] != 0x02)
throw new BadPaddingException ("expected padding type 2");
int i;
- for (i = 1; i < dec.length && dec[i] != 0x00; i++);
- int len = dec.length - i;
+ for (i = 1; i < dec.length && dec[i] != 0x00; i++)
+ ; // keep incrementing i
+ int len = dec.length - i - 1; // skip the 0x00 byte
byte[] result = new byte[len];
- System.arraycopy (dec, i, result, 0, len);
+ System.arraycopy (dec, i + 1, result, 0, len);
pos = 0;
return result;
}