Date: Tue, 03 Jun 1997 20:30:01 -0400
From: Simon Spero <ses@tipper.oit.unc.edu>
To: mrm@Eng, java-security@javasoft.COM
Subject: another bug in jce/des
This is a multi-part message in MIME format.
--------------533F3C72201AE51DE0B97178
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
it's me being annoying again :-)
there seems to a weird bug in the output buffering code in either cipher
or des
when I call crypt with an output offset, I end up with array index
exceptions. Only certain values will trigger these exceptions--check
out the enclosed source file for more details
--------------533F3C72201AE51DE0B97178
Content-Type: text/plain; charset=us-ascii; name="CipherTest.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="CipherTest.java"
import java.io.*;
import java.util.*;
import java.net.*;
import java.security.*;
import sun.security.provider.SecretKey;
class CipherTest {
public static void main(String argv[]) throws Throwable{
int start = Integer.parseInt ( argv [0]);
int step = Integer.parseInt (argv [1]);
Cipher cipher = Cipher.getInstance("DES/ECB/NONE");
Key funky= new SecretKey("12345678".getBytes(),"RAW");
cipher.initEncrypt(funky);
byte out [] = new byte[40];
byte in [] = new byte[ 40];
int i = 0;
for (i = start; i < 33; i+= step) {
System.out.println("I = "+ i);
cipher.crypt(in, 0, 8,out, i);
}
}
}
------
cd c:/usr/home/jaberos/
java -cs CipherTest 0 8
I = 0
I = 8
I = 16
I = 24
I = 32
java.lang.ArrayIndexOutOfBoundsException:
at sun.security.provider.DES.perm(DES.java:182)
at sun.security.provider.DES.cipherBlock(DES.java:142)
at sun.security.provider.DES.engineUpdate(DES.java:92)
at java.security.Cipher.engineUpdateInternal(Cipher.java:1053)
at java.security.Cipher.nonPaddingNonBufferingUpdate(Cipher.java:811)
at java.security.Cipher.update(Cipher.java:646)
at java.security.Cipher.crypt(Cipher.java:946)
at CipherTest.main(CipherTest.java:27)
-----n
cd c:/usr/home/jaberos/
java -cs CipherTest 0 1
I = 0
I = 1
I = 2
I = 3
I = 4
I = 5
I = 6
I = 7
I = 8
I = 9
I = 10
I = 11
I = 12
I = 13
I = 14
I = 15
I = 16
I = 17
I = 18
I = 19
I = 20
I = 21
I = 22
I = 23
I = 24
I = 25
java.lang.ArrayIndexOutOfBoundsException:
at sun.security.provider.DES.perm(DES.java:189)
at sun.security.provider.DES.cipherBlock(DES.java:142)
at sun.security.provider.DES.engineUpdate(DES.java:92)
at java.security.Cipher.engineUpdateInternal(Cipher.java:1053)
at java.security.Cipher.nonPaddingNonBufferingUpdate(Cipher.java:811)
at java.security.Cipher.update(Cipher.java:646)
at java.security.Cipher.crypt(Cipher.java:946)
at CipherTest.main(CipherTest.java:27)
--------------533F3C72201AE51DE0B97178--