JDK-8142549 : Test sun/security/pkcs11/ec/TestECGenSpec.java fails on Ubuntu 15.10
  • Type: Bug
  • Component: security-libs
  • Sub-Component: javax.crypto:pkcs11
  • Affected Version: 8u65,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Duplicate
  • OS: linux_ubuntu
  • Submitted: 2015-11-12
  • Updated: 2023-11-29
  • Resolved: 2016-01-20
Related Reports
Duplicate :  
Description
sun/security/pkcs11/ec/TestECGenSpec.java test fails on Ubuntu 15.10 with the following exception:

java.security.InvalidAlgorithmParameterException: EC key must be at least 256 bits
	at sun.security.pkcs11.P11KeyPairGenerator.checkKeySize(P11KeyPairGenerator.java:230)
	at sun.security.pkcs11.P11KeyPairGenerator.initialize(P11KeyPairGenerator.java:216)
	at java.security.KeyPairGenerator$Delegate.initialize(KeyPairGenerator.java:667)
	at java.security.KeyPairGenerator.initialize(KeyPairGenerator.java:411)
	at TestECGenSpec.main(TestECGenSpec.java:84)
	at PKCS11Test.premain(PKCS11Test.java:86)
	at PKCS11Test.testNSS(PKCS11Test.java:401)
	at PKCS11Test.main(PKCS11Test.java:96)
	at TestECGenSpec.main(TestECGenSpec.java:41)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:92)
	at java.lang.Thread.run(Thread.java:745)

Comments
The sun/security/pkcs11/ec/TestECGenSpec.java test failing due to issue with NSS version parsing from libsoftokn3.so of ubuntu 15.10. JDK-8142541 is also addressing same issue but with different tests. Moving the bug to duplicate state as fix for JDK-8142541 would resolve present issue as well.
20-01-2016

Unlike earlier versions, the "libsoftokn3.so" file of Ubuntu 15.10 do not contain any Header with NSS version information, the NSS version string "3.19.2" is completely missing from the file. The version read code present in PKCS11Test.getNSSInfo(String library) is not sufficient to get the version string.
18-01-2016

There is no major version difference between NSS version of Ubuntu 15.10 and earlier release (eg: Ubuntu 14.04) Ubuntu 15.10 ---- >> dpkg -s libnss3 | grep Version Version: 2:3.19.2-1ubuntu1 Ubuntu 14.04: ---- >> dpkg -s libnss3 | grep Version Version: 2:3.19.2.1-0ubuntu0.14.04.1 The PKCS11Test.getNSSInfo(String library) reads the libsoftokn3.so file and searches for "$Header: NSS" to find the NSS version. In /usr/lib/x86_64-linux-gnu/nss/libsoftokn3.so file of Ubuntu 15.10 there is no such header having the NSS version information as it was present Ubuntu 14.04 file. The call to PKCS11Test.getNSSInfo(String library) is resulting in internal error and the NSS version set to 0.0. >> libsoftokn3 version not found, set to 0.0: /usr/lib/x86_64-linux-gnu/nss/libsoftokn3.so
18-01-2016

In normal circumstances, only elliptic curve secp256r1 is tested on ubuntu platforms. String[] names = { "secp256r1", "NIST P-192", "sect163k1", "1.3.132.0.26", "X9.62 c2tnb239v1"}; But in newer ubuntu platform, the call to getNSSInfo() in PKCS11Test is resulting in NSS version as 0.0 and due to that the ecc_state value has a default value ECCState.Extended (method call getNSSECC()). The ecc_state value ECCState.Extended is resulting in testing all the elliptic curves on this platform.
18-01-2016

The test appears to fail on: ---- Testing NIST P-192... secp192r1 [NIST P-192, X9.62 prime192v1] (1.2.840.10045.3.1.1) 1.2.840.10045.3.1.1 ---- I'm not sure why the key needs to be 256bits for what I believe is a 192bit curve. This seems more like odd NSS behavior rather than a test or a jdk issue. Probably related to JDK-8142541
12-11-2015