JDK-8266400 : importkeystore fails to a password less pkcs12 keystore
  • Type: Bug
  • Component: security-libs
  • Sub-Component: java.security
  • Affected Version: 8
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2021-05-01
  • Updated: 2021-06-07
  • Resolved: 2021-05-24
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 17
17 b24Fixed
Related Reports
Relates :  
Description
Imports from any keystores like jks, jceks, bks or pkcs12 are failing.

Steps : 
1) Create any type of keystore(jks, jceks, bks or pkcs12)
Eg: JKS - keytool -keystore testkeystore.jks -genkeypair -keyalg EC -alias testcert -dname CN=b -storetype jks  -storepass password -keypass pass123

2) Try to import same in to a password less pkcs12 file
keytool -importkeystore -srckeystore testkeystore.jks -destkeystore testkeystore.p12 -J-Dkeystore.pkcs12.macAlgorithm=NONE -J-Dkeystore.pkcs12.certProtectionAlgorithm=NONE

Error message: 
Problem importing entry for alias testcert: java.security.KeyStoreException: non-null password required to create PrivateKeyEntry.
Entry for alias testcert not imported.
Do you want to quit the import process? [no]:
Comments
Changeset: f2d880c1 Author: Hai-May Chao <hchao@openjdk.org> Date: 2021-05-24 15:38:32 +0000 URL: https://git.openjdk.java.net/jdk/commit/f2d880c11a99ef587e7e7c0398f0834c32a22d63
24-05-2021