Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8287422

Add KeyStore.LoadStoreParameter to fail if certificates cannot be decrypted

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      Relates to JDK-8194702

      Currently, when a PKCS12 keystore containing encrypted certificates is loaded without a keystore password, the certificates are silently omitted, see:
      https://github.com/openjdk/jdk/blob/7cb368b34df97614f0d208b8b0b93aa714a49282/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java#L2056-L2078

      This behavior is quite error-prone and can make it difficult to troubleshoot keystore issues. Since that default behavior can most likely not be changed, it would be good to introduce a new method for KeyStore.LoadStoreParameter, for example `failForUnencryptableCertificates` (or similar). It could be implemented as an interface default method which returns `false` (for backward compatibility).
      This way users could choose to fail fast to detect early when certificates would be missing from a keystore.

      Depending on whether other keystore types have the same or similar problems, maybe the KeyStore.LoadStoreParameter method could also be more general.


            weijun Weijun Wang
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: