< prev index next >

src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java

Print this page
rev 55964 : 8162628: Migrate cacerts keystore from JKS

@@ -61,10 +61,11 @@
 import javax.crypto.Cipher;
 import javax.crypto.Mac;
 import javax.security.auth.DestroyFailedException;
 import javax.security.auth.x500.X500Principal;
 
+import sun.security.provider.PemKeyStore;
 import sun.security.tools.KeyStoreUtil;
 import sun.security.util.Debug;
 import sun.security.util.DerInputStream;
 import sun.security.util.DerOutputStream;
 import sun.security.util.DerValue;

@@ -106,14 +107,16 @@
             = "PBEWithHmacSHA256AndAES_256";
     private static final String DEFAULT_MAC_ALGORITHM = "HmacPBESHA256";
     private static final int DEFAULT_PBE_ITERATION_COUNT = 50000;
     private static final int DEFAULT_MAC_ITERATION_COUNT = 100000;
 
-    // special PKCS12 keystore that supports PKCS12 and JKS file formats
-    public static final class DualFormatPKCS12 extends KeyStoreDelegator {
-        public DualFormatPKCS12() {
-            super("PKCS12", PKCS12KeyStore.class, "JKS", JKS.class);
+    // special PKCS12 keystore that supports JKS/PKCS12/PEM file formats
+    public static final class MultipleFormatPKCS12 extends KeyStoreDelegator {
+        public MultipleFormatPKCS12() {
+            super("PKCS12", PKCS12KeyStore.class,
+                    List.of("JKS", "PEM"),
+                    List.of(JKS.class, PemKeyStore.class));
         }
     }
 
     public static final int VERSION_3 = 3;
 

@@ -2307,10 +2310,12 @@
 
             if (s.available() > 0) {
                 // The MacData exists.
                 return false;
             }
+        } catch (IOException e) {
+            return false;
         }
         return true;
     }
 
     /**
< prev index next >