JDK-8062170 : java.security.ProviderException: Error parsing configuration with space
  • Type: Bug
  • Component: security-libs
  • Sub-Component: javax.crypto:pkcs11
  • Affected Version: 8
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_7
  • CPU: x86_64
  • Submitted: 2014-10-24
  • Updated: 2015-10-28
  • Resolved: 2014-12-17
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 7 JDK 8 JDK 9
7u80Fixed 8u60Fixed 9 b44Fixed
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) Client VM (build 25.25-b02, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Windows 7 Professional SP1

A DESCRIPTION OF THE PROBLEM :
When path to security provider dll is containing a space (eq. C:\pki DLL\x64\acpkcs211.dll) you get exception:


java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	...
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$400(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.security.ProviderException: Error parsing configuration
	at sun.security.pkcs11.Config.getConfig(Config.java:88)
	at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:129)
	at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:107)
	... 43 more
Caused by: sun.security.pkcs11.ConfigurationException: Unknown keyword 'DLL\x64\acpkcs211.dll', line 2
	at sun.security.pkcs11.Config.parse(Config.java:466)
	at sun.security.pkcs11.Config.<init>(Config.java:220)
	at sun.security.pkcs11.Config.getConfig(Config.java:84)
	... 45 more


REGRESSION.  Last worked in version 7u71


REPRODUCIBILITY :
This bug can be reproduced always.


Comments
Escape-old label added, since this bug was caused by JDK-7196009, which was introduced in 8.
03-04-2015

Regression of 7196009 (since jdk8 b91)
25-11-2014

Well, a library name containing a space can be parsed. However, the value for the library name have to be surrounded by double quotes. In 7u71, the whole line is taken as the value for the library name, but later we changed to parse the line as one string entry which means requiring the value to be quoted when special characters (such as space) are part of the value.
25-11-2014

I think this may have been caused by JDK-7196009 and that change now stops parsing a library name when it contains a space.
28-10-2014

Additional information from the submitter: Code fails in runtime on line iSecurityProvider = (Provider) tConstructor.newInstance(tConfigStream); with a exception "Caused by: java.security.ProviderException: Error parsing configuration" when there is a space in tLibFilename. The case is loading security provider for PKCS11. Code example for test case: try{ String tLibFilename = "C:\\pki DLL\\x64\\acpkcs211.dll"; String tPkcs11Config = "name=SmartCard\nlibrary = " + tLibFilename; tPkcs11Config += "\nslot = " + tSlot; byte[] tPkcs11ConfigBytes = tPkcs11Config.getBytes(); ByteArrayInputStream tConfigStream = new ByteArrayInputStream(tPkcs11ConfigBytes); Class tSunPkcs11Class = Class.forName("sun.security.pkcs11.SunPKCS11"); Constructor tConstructor = tSunPkcs11Class.getConstructor(InputStream.class); iSecurityProvider = (Provider) tConstructor.newInstance(tConfigStream); Security.addProvider(iSecurityProvider); this.logSecurityProviders(); } catch (Exception e) { iSecurityProvider = null; e.printStackTrace(System.err); }
27-10-2014