-
Bug
-
Resolution: Fixed
-
P3
-
6u19, 8
-
b139
-
x86
-
solaris_10
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8228565 | openjdk8u232 | Andrew Hughes | P3 | Resolved | Fixed | b01 |
FULL PRODUCT VERSION :
java version "1.6.0_19"
Java(TM) SE Runtime Environment (build 1.6.0_19-b04)
Java HotSpot(TM) Server VM (build 16.2-b04, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
SunOS vmsbuild-01 5.10 Generic_141415-07 i86pc i386 i86pc
A DESCRIPTION OF THE PROBLEM :
Calling dcipher.doFinal() with an empty byte array behaves differently depending on the platform.
On Solaris an exception is thrown: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8.
On linux and Windows an empty array is returned.
In 1.6 update 13 all platforms returned an empty array, in update 19 Solaris started throwing IllegalBlockSizeException. All platforms should exhibit the same behavior.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Use attached source code
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Output: doFinal returned [B@aeffdf
ACTUAL -
Output: doFinal threw javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public void emptyStringTest() {
try {
final String DES_KEY = "XXX-fill-me-in-XXX"; // Put your key here
byte[] desKeyData = DES_KEY.getBytes();
DESKeySpec desKeySpec = new DESKeySpec(desKeyData);
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
SecretKey secretKey = keyFactory.generateSecret(desKeySpec);
Cipher dcipher = Cipher.getInstance("DES");
dcipher.init(Cipher.DECRYPT_MODE, secretKey);
byte[] plain = new byte[0];
byte[] utf8 = dcipher.doFinal(plain);
System.out.println("doFinal returned " + utf8);
} catch (Exception e) {
System.out.println("doFinal threw " + e);
}
}
---------- END SOURCE ----------
Release Regression From : 6u13
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.
java version "1.6.0_19"
Java(TM) SE Runtime Environment (build 1.6.0_19-b04)
Java HotSpot(TM) Server VM (build 16.2-b04, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
SunOS vmsbuild-01 5.10 Generic_141415-07 i86pc i386 i86pc
A DESCRIPTION OF THE PROBLEM :
Calling dcipher.doFinal() with an empty byte array behaves differently depending on the platform.
On Solaris an exception is thrown: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8.
On linux and Windows an empty array is returned.
In 1.6 update 13 all platforms returned an empty array, in update 19 Solaris started throwing IllegalBlockSizeException. All platforms should exhibit the same behavior.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Use attached source code
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Output: doFinal returned [B@aeffdf
ACTUAL -
Output: doFinal threw javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public void emptyStringTest() {
try {
final String DES_KEY = "XXX-fill-me-in-XXX"; // Put your key here
byte[] desKeyData = DES_KEY.getBytes();
DESKeySpec desKeySpec = new DESKeySpec(desKeyData);
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
SecretKey secretKey = keyFactory.generateSecret(desKeySpec);
Cipher dcipher = Cipher.getInstance("DES");
dcipher.init(Cipher.DECRYPT_MODE, secretKey);
byte[] plain = new byte[0];
byte[] utf8 = dcipher.doFinal(plain);
System.out.println("doFinal returned " + utf8);
} catch (Exception e) {
System.out.println("doFinal threw " + e);
}
}
---------- END SOURCE ----------
Release Regression From : 6u13
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.
- backported by
-
JDK-8228565 javax.crypto.Cipher.doFinal behavior differs depending on platform
- Resolved
- relates to
-
JDK-8235215 SunPKCS11 connection lost after Decrypt doFinal (noPadding)
- Closed
-
JDK-8236512 PKCS11 Connection closed after Cipher.doFinal and NoPadding
- Resolved