JDK-8170245 : [TEST_BUG] Cipher tests fail when running with unlimited policy
  • Type: Bug
  • Component: security-libs
  • Sub-Component: javax.crypto
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-11-23
  • Updated: 2018-03-21
  • Resolved: 2016-12-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9 Other
8u161Fixed 9 b148Fixed openjdk7uFixed
Related Reports
Relates :  
Description
When running with unlimited crypto policy, several regression tests under com/sun/crypto/provider failed as a result, e.g.
Execution failed: `main' threw exception: java.lang.Exception: Test Failed
    com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithDefaultProvider.java: Test AES ciphers with different modes and padding schemes with default provider
    com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithProviderChange.java: Test AES ciphers with different modes and padding schemes after remove then add provider.
    com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithRemoveAddProvider.java: Test AES ciphers with different modes and padding schemes after remove default provider then add it back. 

Execution failed: `main' threw exception: java.lang.RuntimeException: Expected InvalidKeyException exception uncaugh
    com/sun/crypto/provider/Cipher/PBE/TestCipherPBE.java: Tests for PBE ciphers 
Execution failed: `main' threw exception: java.lang.RuntimeException: One or more tests have failed....
    com/sun/crypto/provider/Cipher/PBE/TestCipherKeyWrapperPBEKey.java: Test to see if key wrapper works correctly with PBEKey 
Execution failed: `main' threw exception: java.lang.RuntimeException: Some PBE algorithm tests failed
    com/sun/crypto/provider/Cipher/PBE/PBESameBuffer/PBESameBuffer.java: Verify that same encrypt/decrypt buffer can be used for PBE ciphers 
Execution failed: `main' threw exception: java.security.InvalidParameterException: Keysize must be multiple of 8, and can only range from 32 to 448 (inclusive)
    com/sun/crypto/provider/Cipher/Blowfish/TestCipherBlowfish.java: Test Blowfish cipher with different MODES and padding 

Comments
No new regression test as this can be verified by running existing regression tests under unlimited policy which is used by default for Oracle JDK (See JDK-8170157).
08-12-2016

The failed tests are written under various assumptions which broke when running with unlimited policy. To name a few, some tests expects InvalidKeyException to be thrown when the key size is over 128, some relies on the value returned by Cipher.getMaxAllowedKeyLength(String) as the upper range for the tested key size which doesn't work when Integer.MAX_VALUE is returned when unlimited policy is in effect. They need to be updated accordingly to work with unlimited policy.
29-11-2016