changeset 11505:392d66ecf06b

8048830: Implement tests for new functionality provided in JEP 166 Summary: New tests for validating read write operations on PKCS 12 based keystore Reviewed-by: vinnie
author bgopularam
date Tue, 29 Mar 2016 01:57:33 -0700
parents ffd65eb4d2be
children 4eeb7999ff74
files test/java/security/KeyStore/PKCS12/CheckDefaults.java test/java/security/KeyStore/PKCS12/EntryProtectionTest.java test/java/security/KeyStore/PKCS12/KeytoolReaderP12Test.java test/java/security/KeyStore/PKCS12/KeytoolWriteP12Test.java test/java/security/KeyStore/PKCS12/MetadataEmptyTest.java test/java/security/KeyStore/PKCS12/MetadataStoreLoadTest.java test/java/security/KeyStore/PKCS12/StoreTrustedCertAPITest.java test/java/security/KeyStore/PKCS12/StoreTrustedCertKeytool.java test/java/security/KeyStore/PKCS12/Utils.java test/java/security/KeyStore/PKCS12/api_cert_chain.p12.data test/java/security/KeyStore/PKCS12/api_cert_chain.p12_expected.data test/java/security/KeyStore/PKCS12/api_private_key.p12.data test/java/security/KeyStore/PKCS12/api_private_key.p12_expected.data test/java/security/KeyStore/PKCS12/api_private_key_not_match.p12.data test/java/security/KeyStore/PKCS12/api_private_key_not_match.p12_expected.data test/java/security/KeyStore/PKCS12/api_two_pass.p12.data test/java/security/KeyStore/PKCS12/api_two_pass.p12_expected.data test/java/security/KeyStore/PKCS12/ie_chain.pfx.data test/java/security/KeyStore/PKCS12/ie_chain.pfx.pem test/java/security/KeyStore/PKCS12/ie_self.pfx.data test/java/security/KeyStore/PKCS12/ie_self.pfx.pem test/java/security/KeyStore/PKCS12/mozilla_self.p12.data test/java/security/KeyStore/PKCS12/mozilla_self.p12.pem test/java/security/KeyStore/PKCS12/netscape_self.p12.data test/java/security/KeyStore/PKCS12/netscape_self.p12.pem test/java/security/KeyStore/PKCS12/openssl.p12.data test/java/security/KeyStore/PKCS12/openssl.p12.pem test/sun/security/pkcs12/StoreSecretKeyTest.java
diffstat 28 files changed, 1674 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/KeyStore/PKCS12/CheckDefaults.java	Tue Mar 29 01:57:33 2016 -0700
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.security.KeyStore;
+import java.security.Security;
+import static java.lang.System.out;
+
+/**
+ * @test
+ * @bug 8048830
+ * @summary Set up keystore.type secure property and check that
+ * KeyStore.getDefaultType() value is related to property value. Expect a full
+ * match the value 'keystore.type' and the value of the
+ * KeyStore.getDefaultType()
+ * @run  main/othervm CheckDefaults
+ */
+public class CheckDefaults {
+    private static final String DEFAULT_KEY_STORE_TYPE = "jks";
+    private static final String[] KEY_STORE_TYPES = {"jks", "pkcs12", "jceks",
+        "Unregistered_type_of_KS"};
+
+    private void runTest(String[] args) {
+        if (!KeyStore.getDefaultType().
+                equalsIgnoreCase(DEFAULT_KEY_STORE_TYPE)) {
+            throw new RuntimeException(String.format("Default keystore type "
+                    + "Expected '%s' . Actual: '%s' ", DEFAULT_KEY_STORE_TYPE,
+                    KeyStore.getDefaultType()));
+        }
+        for (String ksDefaultType : KEY_STORE_TYPES) {
+            Security.setProperty("keystore.type", ksDefaultType);
+            if (!KeyStore.getDefaultType().equals(ksDefaultType)) {
+                throw new RuntimeException(String.format(
+                        "Keystore default type value: '%s' cannot be set up via"
+                        + " keystore.type "
+                        + "security property, Actual: '%s'",
+                        ksDefaultType, KeyStore.getDefaultType()));
+            }
+        }
+        out.println("Test Passed");
+    }
+
+    public static void main(String[] args) {
+        CheckDefaults checkDefaultsTest = new CheckDefaults();
+        checkDefaultsTest.runTest(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/KeyStore/PKCS12/EntryProtectionTest.java	Tue Mar 29 01:57:33 2016 -0700
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.io.File;
+import static java.lang.System.err;
+import java.security.*;
+import java.security.cert.Certificate;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+import javax.crypto.spec.PBEParameterSpec;
+import jdk.testlibrary.RandomFactory;
+import static java.lang.System.out;
+import java.util.Arrays;
+
+/**
+ * @test
+ * @bug 8048830
+ * @summary Test for feature 'support stronger entry protection'. An entry is
+ * stored to keystore with different PasswordProtection objects which are
+ * specified by different PBE algorithms (use -Dseed=X to set PRNG seed)
+ * @library /lib/testlibrary ../
+ */
+public class EntryProtectionTest {
+    private static final char[] PASSWORD = "passwd".toCharArray();
+    private static final String ALIAS = "testkey";
+    private static final byte[] SALT = new byte[8];
+    private static final int ITERATION_COUNT = 1024;
+    private static final List<KeyStore.PasswordProtection> PASSWORD_PROTECTION
+            = new ArrayList<>();
+    private static final String KEYSTORE_PATH = System.getProperty(
+            "test.classes" + File.separator + "ks.pkcs12",
+            "." + File.separator + "ks.pkcs12");
+
+    private void runTest() throws Exception {
+            KeyStore ksIn = Utils.loadKeyStore(KEYSTORE_PATH,
+                    Utils.KeyStoreType.pkcs12, PASSWORD);
+            KeyStore ksTest = KeyStore
+                    .getInstance(Utils.KeyStoreType.pkcs12.name());
+            ksTest.load(null);
+            Certificate cert = ksIn.getCertificate(ALIAS);
+            Key key = ksIn.getKey(ALIAS, PASSWORD);
+            KeyStore.Entry keyStoreEntry = new KeyStore.PrivateKeyEntry(
+                    (PrivateKey) key, new Certificate[]{cert});
+            for (KeyStore.PasswordProtection passwordAlgorithm :
+                    PASSWORD_PROTECTION) {
+                out.println("Try to use: " +
+                        passwordAlgorithm.getProtectionAlgorithm());
+                ksTest.setEntry(ALIAS, keyStoreEntry, passwordAlgorithm);
+                KeyStore.Entry entryRead = ksTest.getEntry(ALIAS,
+                        new KeyStore.PasswordProtection(PASSWORD));
+                if (!isPrivateKeyEntriesEqual((KeyStore.PrivateKeyEntry)
+                        keyStoreEntry, (KeyStore.PrivateKeyEntry)entryRead)) {
+                    err.println("Original entry in KeyStore: " + keyStoreEntry);
+                    err.println("Enc/Dec entry : " + entryRead);
+                    throw new RuntimeException(
+                            String.format(
+                                    "Decrypted & original enities do "
+                                    + "not match. Algo: %s, Actual: %s, "
+                                    + "Expected: %s",
+                                    passwordAlgorithm.getProtectionAlgorithm(),
+                                    entryRead, keyStoreEntry));
+                }
+                ksTest.deleteEntry(ALIAS);
+            }
+            out.println("Test Passed");
+    }
+
+    public static void main(String args[]) throws Exception {
+        EntryProtectionTest entryProtectionTest = new EntryProtectionTest();
+        entryProtectionTest.setUp();
+        entryProtectionTest.runTest();
+    }
+
+    private void setUp() {
+        out.println("Using KEYSTORE_PATH:"+KEYSTORE_PATH);
+        Utils.createKeyStore(Utils.KeyStoreType.pkcs12, KEYSTORE_PATH, ALIAS);
+        Random rand = RandomFactory.getRandom();
+        rand.nextBytes(SALT);
+        out.print("Salt: ");
+        for (byte b : SALT) {
+            out.format("%02X ", b);
+        }
+        out.println("");
+        PASSWORD_PROTECTION
+                .add(new KeyStore.PasswordProtection(PASSWORD,
+                                "PBEWithMD5AndDES", new PBEParameterSpec(SALT,
+                                        ITERATION_COUNT)));
+        PASSWORD_PROTECTION.add(new KeyStore.PasswordProtection(PASSWORD,
+                "PBEWithSHA1AndDESede", null));
+        PASSWORD_PROTECTION.add(new KeyStore.PasswordProtection(PASSWORD,
+                "PBEWithSHA1AndRC2_40", null));
+        PASSWORD_PROTECTION.add(new KeyStore.PasswordProtection(PASSWORD,
+                "PBEWithSHA1AndRC2_128", null));
+        PASSWORD_PROTECTION.add(new KeyStore.PasswordProtection(PASSWORD,
+                "PBEWithSHA1AndRC4_40", null));
+        PASSWORD_PROTECTION.add(new KeyStore.PasswordProtection(PASSWORD,
+                "PBEWithSHA1AndRC4_128", null));
+    }
+
+    /**
+     * Checks whether given two KeyStore.PrivateKeyEntry parameters are equal
+     * The KeyStore.PrivateKeyEntry fields like {privateKey, certificateChain[]}
+     * are checked for equality and another field Set<attributes> is not checked
+     * as default implementation adds few PKCS12 attributes during read
+     * operation
+     * @param  first
+     *         parameter is of type KeyStore.PrivateKeyEntry
+     * @param  second
+     *         parameter is of type KeyStore.PrivateKeyEntry
+     * @return boolean
+     *         true when both the KeyStore.PrivateKeyEntry fields are equal
+    */
+    boolean isPrivateKeyEntriesEqual(KeyStore.PrivateKeyEntry first,
+            KeyStore.PrivateKeyEntry second) {
+        //compare privateKey
+        if (!Arrays.equals(first.getPrivateKey().getEncoded(),
+                second.getPrivateKey().getEncoded())) {
+            err.println("Mismatch found in privateKey!");
+            return false;
+        }
+        //compare certificateChain[]
+        if (!Arrays.equals(first.getCertificateChain(),
+                second.getCertificateChain())) {
+            err.println("Mismatch found in certificate chain!");
+            return false;
+        }
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/KeyStore/PKCS12/KeytoolReaderP12Test.java	Tue Mar 29 01:57:33 2016 -0700
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.StandardOpenOption;
+import java.util.Base64;
+import jdk.testlibrary.OutputAnalyzer;
+import static java.lang.System.out;
+import java.nio.file.Paths;
+import java.util.List;
+
+/**
+ * @test
+ * @bug 8048830
+ * @summary Test for PKCS12 keystore list , export commands. Refer README for
+ * keystore files information
+ * @library /lib/testlibrary ../
+ * @run main KeytoolReaderP12Test
+ */
+public class KeytoolReaderP12Test {
+    private static final String WORKING_DIRECTORY = System.getProperty(
+            "test.classes", "."+ File.separator);
+    private static final String KS_PASSWD = "storepass";
+    private static final String CERT_CHAIN_PASSWD = "password";
+    private static final String SOURCE_DIRECTORY =
+            System.getProperty("test.src", "." + File.separator);
+
+    public static void main(String[] args) throws Exception {
+        List<String> expectedValues = null;
+        out.println("Self signed test");
+        expectedValues = Files.readAllLines(Paths.get(SOURCE_DIRECTORY,
+                "api_private_key.p12_expected.data"));
+        readTest("api_private_key.p12.data", KS_PASSWD, expectedValues);
+        out.println("Self signed test Passed");
+
+        out.println("private key with selfsigned cert, key pair not match");
+        expectedValues = Files.readAllLines(Paths.get(SOURCE_DIRECTORY,
+                "api_private_key_not_match.p12_expected.data"));
+        readTest("api_private_key_not_match.p12.data", KS_PASSWD,
+                expectedValues);
+        out.println("private key with selfsigned cert, key pair "
+                + "not match passed");
+
+        out.println("cert chain test");
+        expectedValues = Files.readAllLines(Paths.get(SOURCE_DIRECTORY,
+                "api_cert_chain.p12_expected.data"));
+        readTest("api_cert_chain.p12.data", CERT_CHAIN_PASSWD, expectedValues);
+        out.println("cert chain test passed");
+
+        out.println("IE self test");
+        expectedValues = Files.readAllLines(Paths.get(SOURCE_DIRECTORY,
+                "ie_self.pfx.pem"));
+        exportTest("ie_self.pfx.data", "pkcs12testenduser1",
+                KS_PASSWD, expectedValues);
+        out.println("IE self test passed");
+
+        out.println("IE chain test");
+        expectedValues = Files.readAllLines(Paths.get(SOURCE_DIRECTORY,
+                "ie_chain.pfx.pem"));
+        exportTest("ie_chain.pfx.data", "servercert",
+                CERT_CHAIN_PASSWD, expectedValues);
+        out.println("IE chain test passed");
+
+        out.println("Netscape self");
+        expectedValues = Files.readAllLines(Paths.get(SOURCE_DIRECTORY,
+                "netscape_self.p12.pem"));
+        exportTest("netscape_self.p12.data", "pkcs12testenduser1",
+                KS_PASSWD, expectedValues);
+        out.println("Netscape self passed");
+
+        out.println("Mozilla self test");
+        expectedValues = Files.readAllLines(Paths.get(SOURCE_DIRECTORY,
+                "mozilla_self.p12.pem"));
+        exportTest("mozilla_self.p12.data", "pkcs12testenduser1",
+                KS_PASSWD, expectedValues);
+        out.println("Mozilla self test passed");
+
+        out.println("Openssl test");
+        expectedValues = Files.readAllLines(Paths.get(SOURCE_DIRECTORY,
+                "openssl.p12.pem"));
+        exportTest("openssl.p12.data", "servercert", CERT_CHAIN_PASSWD, expectedValues);
+        out.println("openssl test passed");
+
+        out.println("with different keystore and entrykey password");
+        expectedValues = Files.readAllLines(Paths.get(SOURCE_DIRECTORY,
+                "api_two_pass.p12_expected.data"));
+        readTest("api_two_pass.p12.data", KS_PASSWD,
+                expectedValues);
+        out.println("two pass test passed");
+    }
+
+    private static void readTest(String name, String password,
+            List<String> expectedValues)
+            throws IOException {
+        convertToPFX(name);
+        final String[] command = new String[]{"-debug", "-list", "-v",
+            "-keystore", WORKING_DIRECTORY + File.separator + name,
+            "-storetype", "pkcs12", "-storepass", password};
+        runAndValidate(command, expectedValues);
+    }
+
+    private static void exportTest(String name, String alias,
+            String password, List<String> expectedValues)
+            throws IOException {
+        convertToPFX(name);
+        final String[] command = new String[]{"-debug", "-export", "-alias",
+            alias, "-keystore", WORKING_DIRECTORY + File.separator + name,
+            "-storepass", password, "-storetype", "pkcs12", "-rfc"};
+        runAndValidate(command, expectedValues);
+    }
+
+    private static void runAndValidate(String[] command,
+            List<String> expectedValues) throws IOException {
+        OutputAnalyzer output = Utils.executeKeytoolCommand(command);
+        if (expectedValues != null) {
+            expectedValues.stream().forEach(line -> {
+                output.shouldContain(line);
+            });
+        }
+    }
+
+    /**
+     * Decodes the base64 encoded keystore and writes into new file
+     * @param name base64 encoded keystore name
+     */
+    private static void convertToPFX(String name) throws IOException{
+        File base64File = new File(SOURCE_DIRECTORY, name);
+        File pkcs12File = new File(WORKING_DIRECTORY, name);
+        byte[] input = Files.readAllBytes(base64File.toPath());
+        Files.write(pkcs12File.toPath(), Base64.getMimeDecoder().
+                decode(input), StandardOpenOption.CREATE);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/KeyStore/PKCS12/KeytoolWriteP12Test.java	Tue Mar 29 01:57:33 2016 -0700
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import jdk.testlibrary.OutputAnalyzer;
+import static java.lang.System.out;
+
+/**
+ * @test
+ * @bug 8048830
+ * @summary Tests for creating pkcs12 keystore with various algorithms
+ * @library /lib/testlibrary ../
+ * @run main KeytoolWriteP12Test
+ */
+public class KeytoolWriteP12Test {
+    private static final String ALIAS = "pkcs12testCA";
+    private static final Utils.KeyStoreType PKCS12 = Utils.KeyStoreType.pkcs12;
+    private static final int FAILED_EXIT_CODE = 1;
+    private static final String CERT_FILE_NAME = "cert.data";
+    private static final String DNAME = "CN=PKCS12 Test CA, OU=Security SQE, "
+            + "O=JavaSoft, C=US";
+    private static final String WORKING_DIRECTORY = System.
+            getProperty("test.classes", "." + File.separator);
+    private enum Algorithm {
+        DSA, RSA, ECC
+    };
+    private void run() {
+        out.println("Running DSA Test");
+        keytoolListTest("kt_DSA.p12", Algorithm.DSA);
+        out.println("DSA Test passed");
+
+        out.println("Running RSA Test");
+        final String rsaKeyStoreName = "kt_RSA_MD5.p12";
+        keytoolListTest(rsaKeyStoreName, Algorithm.RSA);
+        out.println("RSA Test passed");
+
+        out.println("Running RSA and Signing Algorithm SHA1withRSA Test");
+        keytoolListTest("kt_RSA_SHA1.p12", Algorithm.RSA,
+                "-sigalg", "SHA1withRSA");
+        out.println("RSA and Signing Algorithm SHA1withRSA Test Passed");
+
+        out.println("Running Keysize 256 Test");
+        keytoolListNegativeTest("kt_DSA_256.p12", Algorithm.DSA, "-keysize",
+                "256");
+        out.println("Keysize 256 Test Passed");
+
+        out.println("Running Keysize 1023 Test");
+        keytoolListTest("kt_RSA_MD5_1023.p12", Algorithm.RSA, "-keysize",
+                "1023");
+        out.println("Keysize 1023 Test Passed");
+        out.println("Running Export certificate Test");
+        exportTest(rsaKeyStoreName);
+        out.println("Export certificate Test Passed");
+    }
+
+    private void exportTest(String keyStore) {
+        final String keyStoreName = WORKING_DIRECTORY + File.separator
+                + keyStore;
+        deleteKeyStoreFile(keyStoreName);
+        Utils.createKeyStore(DNAME, PKCS12, keyStore, ALIAS,
+                Algorithm.RSA.name());
+        final String certFilePath = WORKING_DIRECTORY + File.separator
+                + CERT_FILE_NAME;
+        Utils.exportCert(PKCS12, keyStore,
+                ALIAS, certFilePath);
+        final String[] command = new String[]{"-debug", "-printcert", "-v",
+            "-file", certFilePath};
+        Utils.executeKeytoolCommand(command);
+    }
+
+    private void keytoolListTest(String keyStore, Algorithm algorithm,
+            String ...optionalArgs) {
+        final String keyStoreName = WORKING_DIRECTORY + File.separator
+                + keyStore;
+        final String[] command = new String[]{"-debug", "-list", "-v", "-alias",
+            ALIAS, "-keystore", keyStoreName, "-storetype", "pkcs12",
+            "-storepass", Utils.DEFAULT_PASSWD};
+        deleteKeyStoreFile(keyStoreName);
+        Utils.createKeyStore(DNAME, PKCS12, keyStoreName, ALIAS,
+                algorithm.name(), optionalArgs);
+        OutputAnalyzer output = Utils.executeKeytoolCommand(command);
+        output.shouldContain(DNAME);
+    }
+
+    private void keytoolListNegativeTest(String keyStore, Algorithm algorithm,
+            String... optionalArgs) {
+        final String keyStoreName = WORKING_DIRECTORY  + File.separator
+                + keyStore;
+        deleteKeyStoreFile(keyStoreName);
+        Utils.createKeyStore(DNAME, PKCS12, keyStoreName, ALIAS,
+                algorithm.name(), optionalArgs, FAILED_EXIT_CODE);
+    }
+
+    public static void main(String[] args) {
+        KeytoolWriteP12Test test = new KeytoolWriteP12Test();
+        test.run();
+        out.println("Test Passed");
+    }
+
+    private void deleteKeyStoreFile(String fileName) {
+        File file = new File(fileName);
+        if (file.exists()) {
+            file.delete();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/KeyStore/PKCS12/MetadataEmptyTest.java	Tue Mar 29 01:57:33 2016 -0700
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.security.Key;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.PrivateKey;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.Certificate;
+import java.io.IOException;
+import java.security.cert.CertificateException;
+import static java.lang.System.out;
+
+/**
+ * @test
+ * @bug 8048830
+ * @summary Entry's attribute set should be empty
+ * @library /lib/testlibrary ../
+ * @run main MetadataEmptyTest
+ */
+public class MetadataEmptyTest {
+    private static final char[] PASSWORD = "passwd".toCharArray();
+    private static final String ALIAS = "testkey";
+    private static final String KEYSTORE_PATH = System.getProperty(
+            "test.classes" + File.separator + "ks.pkcs12",
+            "." + File.separator + "ks.pkcs12");
+
+    private void runTest() throws IOException, KeyStoreException,
+            NoSuchAlgorithmException, CertificateException,
+            UnrecoverableKeyException {
+        KeyStore ks = Utils.loadKeyStore(KEYSTORE_PATH,
+                Utils.KeyStoreType.pkcs12, PASSWORD);
+        Key key = ks.getKey(ALIAS, PASSWORD);
+        Certificate cert = ks
+                .getCertificate(ALIAS);
+        KeyStore.Entry entry = new KeyStore.PrivateKeyEntry(
+                (PrivateKey) key,
+                new Certificate[]{cert});
+        if (!entry.getAttributes().isEmpty()) {
+            throw new RuntimeException("Entry's attributes set "
+                    + "must be empty");
+        }
+        out.println("Test Passed");
+    }
+
+    public static void main(String[] args) throws Exception{
+        MetadataEmptyTest test = new MetadataEmptyTest();
+        test.setUp();
+        test.runTest();
+    }
+
+    private void setUp() {
+        Utils.createKeyStore(Utils.KeyStoreType.pkcs12, KEYSTORE_PATH, ALIAS);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/KeyStore/PKCS12/MetadataStoreLoadTest.java	Tue Mar 29 01:57:33 2016 -0700
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+import java.security.Key;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.PKCS12Attribute;
+import java.security.PrivateKey;
+import java.security.UnrecoverableEntryException;
+import java.security.cert.Certificate;
+import java.util.Arrays;
+import java.util.Set;
+import static java.lang.System.out;
+import java.util.HashSet;
+
+/**
+ * @test
+ * @bug 8048830
+ * @summary Test store metadata attributes to PKCS12 keystore.
+ * @library /lib/testlibrary ../
+ * @run main MetadataStoreLoadTest
+ */
+public class MetadataStoreLoadTest {
+    private static final char[] PASSWORD = "passwd".toCharArray();
+    private static final char[] KEY_PASSWORD = "keypasswd".toCharArray();
+    private static final String ALIAS = "testkey_metadata";
+    private static final String KEYSTORE = "ks.pkcs12";
+    private static final String KESTORE_NEW = "ks-attr.pkcs12";
+    private static final int MAX_HUGE_SIZE = 2000000;
+    private static final String WORKING_DIRECTORY = System.getProperty(
+            "test.classes", "." + File.separator);
+    private static final String KEYSTORE_PATH = WORKING_DIRECTORY
+            + File.separator + KEYSTORE;
+    private static KeyStore.Entry.Attribute[] ATTR_SET;
+
+    private void runTest() throws GeneralSecurityException,
+            UnrecoverableEntryException, NoSuchAlgorithmException,
+            KeyStoreException, IOException {
+        storeAttrs();
+        checkAttrs();
+    }
+
+    private void storeAttrs() throws UnrecoverableEntryException,
+            GeneralSecurityException, NoSuchAlgorithmException,
+            KeyStoreException, IOException {
+        KeyStore ksIn = Utils.loadKeyStore(KEYSTORE_PATH,
+                Utils.KeyStoreType.pkcs12, PASSWORD);
+        KeyStore ksAttr = KeyStore
+                .getInstance(Utils.KeyStoreType.pkcs12.name());
+        ksAttr.load(null);
+        Key key = ksIn.getKey(ALIAS, PASSWORD);
+        Certificate cert = ksIn.getCertificate(ALIAS);
+        Set<KeyStore.Entry.Attribute> attrs =
+                new HashSet<>(Arrays.asList(ATTR_SET));
+        KeyStore.Entry e = new KeyStore.PrivateKeyEntry((PrivateKey) key,
+                new Certificate[]{cert}, attrs);
+        ksAttr.setEntry(ALIAS, e, new KeyStore.PasswordProtection(
+                KEY_PASSWORD));
+
+        out.println("Attributes before store:");
+        e.getAttributes().stream().forEach((attr) -> {
+            out.println(attr.getName() + ", '" + attr.getValue() + "'");
+        });
+        Utils.saveKeyStore(ksAttr, WORKING_DIRECTORY + File.separator
+                + KESTORE_NEW, PASSWORD);
+    }
+
+    private void checkAttrs() throws UnrecoverableEntryException,
+            GeneralSecurityException, NoSuchAlgorithmException,
+            KeyStoreException, IOException {
+        KeyStore ks = Utils.loadKeyStore(WORKING_DIRECTORY
+                + File.separator
+                + KESTORE_NEW, Utils.KeyStoreType.pkcs12, PASSWORD);
+        KeyStore.Entry keyStoreEntry = ks.getEntry(ALIAS,
+                new KeyStore.PasswordProtection(KEY_PASSWORD));
+        out.println("Attributes after store:");
+        //print attribute values
+        keyStoreEntry.getAttributes().stream().forEach((attr) -> {
+            out.println(attr.getName() + ", '" + attr.getValue() + "'");
+        });
+        Arrays.stream(ATTR_SET).forEach((attr) -> {
+            if (!keyStoreEntry.getAttributes().contains(attr)) {
+                throw new RuntimeException("Entry doesn't contain attribute: ("
+                        + attr.getName() + ", '" + attr.getValue() + "')");
+            }
+        });
+    }
+
+    public static void main(String[] args) throws Exception {
+        MetadataStoreLoadTest test = new MetadataStoreLoadTest();
+        test.setUp();
+        test.runTest();
+        out.println("Test Passed");
+    }
+
+    private void setUp() {
+        Utils.createKeyStore(Utils.KeyStoreType.pkcs12, KEYSTORE_PATH, ALIAS);
+        final String allCharsString = "`1234567890-=qwertyuiop[]asdfghjkl;'\\zx"
+                + "cvbnm,./!@#$%^&*()_+QWERTYUIOP{}ASDFGHJKL:|>ZXCVBNM<>?\"";
+        StringBuilder sbPrintable = new StringBuilder();
+        while (sbPrintable.length() < MAX_HUGE_SIZE) {
+            sbPrintable.append(allCharsString);
+        }
+        final String hugePrintable = sbPrintable.toString();
+        final String binaryString = "00:11:22:33:44:55:66:77:88:99:AA:BB:DD:"
+                + "EE:FF:";
+        StringBuilder sbBinary = new StringBuilder();
+        sbBinary.append(binaryString);
+        while (sbBinary.length() < MAX_HUGE_SIZE) {
+            sbBinary.append(":").append(binaryString);
+        }
+        sbBinary.insert(0, "[").append("]");
+        final String hugeBinary = sbBinary.toString();
+        ATTR_SET = new PKCS12Attribute[5];
+        ATTR_SET[0] = new PKCS12Attribute("1.2.840.113549.1.9.1",
+                "Test email addres attr <test@oracle.com>");
+        ATTR_SET[1] = new PKCS12Attribute("1.2.110.1", "not registered attr");
+        ATTR_SET[2] = new PKCS12Attribute("1.2.110.2", hugePrintable);
+        ATTR_SET[3] = new PKCS12Attribute("1.2.110.3", hugeBinary);
+        ATTR_SET[4] = new PKCS12Attribute("1.2.110.2", " ");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/KeyStore/PKCS12/StoreTrustedCertAPITest.java	Tue Mar 29 01:57:33 2016 -0700
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import static java.lang.System.err;
+import static java.lang.System.out;
+
+/**
+ * @test
+ * @bug 8048830
+ * @summary Test imports certificate from file to PKCS12 keystore store it as
+ * trusted certificate Check import errors (must be not errors) & check keystore
+ * content after import
+ * @library /lib/testlibrary ../
+ * @run main StoreTrustedCertAPITest
+ */
+public class StoreTrustedCertAPITest {
+    private static final char[] PASSWORD = "passwd".toCharArray();
+    private static final String ALIAS = "testkey_stcapi";
+    private static final String WORKING_DIRECTORY = System.getProperty(
+            "test.classes", "." + File.separator);
+    private static final String CERT_PATH = WORKING_DIRECTORY + File.separator
+            + "cert.data";
+    private static final String KEYSTORE_PATH = WORKING_DIRECTORY
+            + File.separator + "ks.pkcs12";
+
+    /**
+     * Test logic (environment has set up)
+     */
+    private void runTest() throws FileNotFoundException, CertificateException,
+            KeyStoreException, IOException, NoSuchAlgorithmException {
+        Certificate cert;
+        CertificateFactory cf;
+        try (FileInputStream fi = new FileInputStream(CERT_PATH)) {
+            cf = CertificateFactory.getInstance("X.509");
+            cert = cf.generateCertificate(fi);
+            KeyStore ks = KeyStore.getInstance(
+                    Utils.KeyStoreType.pkcs12.name());
+            ks.load(null, null);
+            ks.setCertificateEntry(ALIAS, cert);
+            Utils.saveKeyStore(ks, KEYSTORE_PATH, PASSWORD);
+            ks = Utils.loadKeyStore(KEYSTORE_PATH, Utils.KeyStoreType.pkcs12,
+                    PASSWORD);
+            final Certificate ksCert = ks.getCertificate(ALIAS);
+            if (!ksCert.equals(cert)) {
+                err.println("Orig cert: " + cert.toString());
+                err.println("Cert from keystore: " + ksCert.toString());
+                throw new RuntimeException("Certificates don't match");
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        StoreTrustedCertAPITest test = new StoreTrustedCertAPITest();
+        test.setUp();
+        test.runTest();
+        out.println("Test Passed");
+    }
+
+    private void setUp() {
+        Utils.createKeyStore(Utils.KeyStoreType.pkcs12, KEYSTORE_PATH, ALIAS);
+        Utils.exportCert(Utils.KeyStoreType.pkcs12, KEYSTORE_PATH,
+                ALIAS, CERT_PATH);
+        new File(KEYSTORE_PATH).delete();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/KeyStore/PKCS12/StoreTrustedCertKeytool.java	Tue Mar 29 01:57:33 2016 -0700
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import jdk.testlibrary.OutputAnalyzer;
+import static java.lang.System.out;
+
+/**
+ * @test
+ * @bug 8048830
+ * @summary Tests keytool command imports certificate , list keystore, print
+ * certificate and import password help.
+ * @library /lib/testlibrary ../
+ * @run main StoreTrustedCertKeytool
+ */
+public class StoreTrustedCertKeytool {
+    private static final String PASSWORD = "passwd";
+    private static final String ALIAS = "testkey_stckey";
+    private static final String FILE_SEPARATOR = File.separator;
+    private static final String WORKING_DIRECTORY = System.getProperty(
+            "test.classes", "." + FILE_SEPARATOR);
+    private static final String CERT_PATH = WORKING_DIRECTORY
+            + FILE_SEPARATOR
+            + "cert.data";
+    private static final String KEYSTORE_PATH = WORKING_DIRECTORY
+            + FILE_SEPARATOR + "ks.pkcs12";
+
+    protected void run() throws IOException, KeyStoreException,
+            NoSuchAlgorithmException, CertificateException {
+        setUp();
+        importCert();
+        out.println("Import Cert test passed");
+        listCerts();
+        out.println("listCerts test passed");
+        printCert();
+        out.println("print cert test passed");
+        helpImportPassword();
+        out.println("help import test passed");
+    }
+
+    private void importCert() {
+        final String[] command = new String[]{"-debug", "-importcert",
+            "-alias", ALIAS, "-file", CERT_PATH, "-noprompt", "-keystore",
+            KEYSTORE_PATH, "-storetype", "pkcs12", "-storepass", PASSWORD};
+        // If the keystore exists delete it.
+        File keystoreFile = new File(KEYSTORE_PATH);
+        if (keystoreFile.exists()) {
+            keystoreFile.delete();
+        }
+        Utils.executeKeytoolCommand(command);
+    }
+
+    private void listCerts() throws IOException, KeyStoreException,
+            NoSuchAlgorithmException, CertificateException {
+        final String[] command = new String[]{"-debug", "-list", "-v",
+            "-alias", ALIAS, "-keystore", KEYSTORE_PATH, "-storetype", "pkcs12",
+            "-storepass", PASSWORD};
+        OutputAnalyzer output = Utils.executeKeytoolCommand(command);
+        if (output == null) {
+            throw new RuntimeException("Keystore print fails");
+        }
+        X509Certificate ksCert = null;
+        final KeyStore ks = Utils.loadKeyStore(KEYSTORE_PATH,
+                Utils.KeyStoreType.pkcs12, PASSWORD.toCharArray());
+        ksCert = (X509Certificate) ks.getCertificate(ALIAS);
+
+        if (ksCert == null) {
+            throw new RuntimeException("Certificate " + ALIAS
+                    + " not found in Keystore " + KEYSTORE_PATH);
+        }
+        String serialNumber = ksCert.getSerialNumber().toString(16);
+        output.shouldContain(serialNumber);
+    }
+
+    private void printCert() {
+        final String[] command = new String[]{"-debug", "-printcert",
+            "-file", CERT_PATH};
+        Utils.executeKeytoolCommand(command);
+
+    }
+
+    private void helpImportPassword() {
+        final String[] command = new String[]{"-debug", "-help",
+            "-importpassword"};
+        Utils.executeKeytoolCommand(command);
+    }
+
+    public static void main(String[] args) throws Exception {
+        final StoreTrustedCertKeytool test = new StoreTrustedCertKeytool();
+        test.run();
+        out.println("Test Passed");
+    }
+
+    private void setUp() {
+        Utils.createKeyStore(Utils.KeyStoreType.pkcs12, KEYSTORE_PATH, ALIAS);
+        Utils.exportCert(Utils.KeyStoreType.pkcs12, KEYSTORE_PATH, ALIAS,
+                CERT_PATH);
+        new File(KEYSTORE_PATH).delete();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/KeyStore/PKCS12/Utils.java	Tue Mar 29 01:57:33 2016 -0700
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertificateException;
+import java.util.Arrays;
+import java.util.List;
+import jdk.testlibrary.ProcessTools;
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.JDKToolFinder;
+import static java.lang.System.out;
+import java.util.ArrayList;
+
+/**
+ * Helper class for creating keystore and executing keytool commands
+ */
+public class Utils {
+    public enum KeyStoreType {
+        jks, pkcs12;
+    }
+    public static final String DEFAULT_DNAME
+            = "CN=TestKey, T=FuncTestCertKey, O=Oracle, OU=JDKSQE, C=US";
+    public static final String DEFAULT_PASSWD = "passwd";
+    public static final String RSA = "rsa";
+    public static final String JAVA_HOME = System.getProperty("java.home");
+    public static final String KEYTOOL = "keytool";
+    private static final int SUCCESS_EXIT_CODE = 0;
+
+    public static OutputAnalyzer executeKeytoolCommand(String[] command) {
+        return executeKeytoolCommand(command, SUCCESS_EXIT_CODE);
+    }
+
+    public static OutputAnalyzer executeKeytoolCommand(String[] command,
+            int exitCode) {
+        String[] keytoolCmd = new String[command.length + 1];
+        OutputAnalyzer output = null;
+        try {
+            keytoolCmd[0] = JDKToolFinder.getJDKTool(KEYTOOL);
+            System.arraycopy(command, 0, keytoolCmd, 1, command.length);
+            output = ProcessTools.executeCommand(keytoolCmd);
+            output.shouldHaveExitValue(exitCode);
+            out.println("Executed keytool command sucessfully:"
+                    + Arrays.toString(keytoolCmd));
+        } catch (Throwable e) {
+            e.printStackTrace(System.err);
+            throw new RuntimeException("Keytool Command execution failed : "
+                    + Arrays.toString(keytoolCmd), e);
+        }
+        return output;
+    }
+
+    public static void createKeyStore(KeyStoreType type, String name,
+            String alias) {
+        createKeyStore(DEFAULT_DNAME, type, name, alias, RSA);
+    }
+
+    public static void createKeyStore(String dName, KeyStoreType type,
+            String name, String alias, String algorithm,
+            String... optionalArgs) {
+        createKeyStore(dName, type, name, alias, algorithm, optionalArgs,
+                SUCCESS_EXIT_CODE);
+    }
+
+    public static void createKeyStore(String dName, KeyStoreType type,
+            String name, String alias, String algorithm,
+            String[] optionalArgs, int exitCode) {
+        String[] command = new String[]{"-debug", "-genkeypair", "-alias",
+            alias, "-keystore", name, "-dname", dName, "-storepass",
+            DEFAULT_PASSWD, "-keypass", DEFAULT_PASSWD, "-validity", "7300",
+            "-keyalg", algorithm, "-storetype", type.name()};
+        if (optionalArgs != null && optionalArgs.length > 0) {
+            List<String> commandArgs = new ArrayList<>(Arrays.asList(command));
+            List<String> temp = Arrays.asList(optionalArgs);
+            commandArgs.addAll(temp);
+            if (!commandArgs.contains(("-keysize"))) {
+                commandArgs.add("-keysize");
+                commandArgs.add("1024");
+            }
+            command = commandArgs.toArray(new String[commandArgs.size()]);
+        }
+        executeKeytoolCommand(command, exitCode);
+    }
+
+    public static void exportCert(KeyStoreType type, String name,
+            String alias, String cert) {
+        String[] command = {"-debug", "-exportcert", "-keystore", name,
+            "-storetype", type.name(), "-storepass", DEFAULT_PASSWD, "-alias",
+            alias,"-file",cert,"-noprompt"};
+        executeKeytoolCommand(command);
+    }
+
+    public static KeyStore loadKeyStore(String file, KeyStoreType type,
+            char[] passwd)
+            throws IOException, KeyStoreException,
+            NoSuchAlgorithmException, CertificateException {
+        KeyStore ks = KeyStore.getInstance(type.name());
+        try (FileInputStream fin = new FileInputStream(file)) {
+            ks.load(fin, passwd);
+        }
+        return ks;
+    }
+
+    public static void saveKeyStore(KeyStore ks, String file, char[] passwd)
+            throws IOException, KeyStoreException, NoSuchAlgorithmException,
+            CertificateException {
+        try (FileOutputStream fout = new FileOutputStream(file)) {
+            ks.store(fout, passwd);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/KeyStore/PKCS12/api_cert_chain.p12.data	Tue Mar 29 01:57:33 2016 -0700
@@ -0,0 +1,76 @@
+MIIQ6AIBAzCCEKIGCSqGSIb3DQEHAaCCEJMEghCPMIIQizCCBXAGCSqGSIb3DQEHAaCCBWEEggVd
+MIIFWTCCBVUGCyqGSIb3DQEMCgECoIIE+jCCBPYwKAYKKoZIhvcNAQwBAzAaBBSKdWqt6IsXyQA9
+6SNtYnk7vaT/CQICBAAEggTIv5XR91OsI7r831ltprYhtOfAhl3TFKj+cqnohJF1xm60K5dQN5BZ
+enfVw4YPbCTR16+zTiGyHJ/MFELwOrOogPdSQBTuy1PtUZOfskD/EKFQaCVSQ1omNlgOWqVh0dhF
+TMjw6KLaTfhwx2Qw3aLIjhy7rvS5SEsUbGZ/IvJ7ym+DHzFuP8oQFfISUkNxh7wOqk4BSsY1Yh9H
+JbK7Y7JtWReDTbAtuACQSPO0Z7RSWKC2y29cG6x3gIiB8iKTNrPKc6m0wb48RKipzF6r35GQRMoS
+rsordIc22RS/KYFfU4W9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XIcUR/3TChw09nR5rrIaFsN+MCAgQA
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/KeyStore/PKCS12/api_cert_chain.p12_expected.data	Tue Mar 29 01:57:33 2016 -0700
@@ -0,0 +1,7 @@
+SHA1: 09:F1:08:B1:B3:28:22:23:22:F7:5F:6D:4A:8D:0E:0A:5E:6D:56:FB
+SHA256: AD:57:47:67:20:96:49:86:53:E4:10:EF:BD:4D:D2:B0:81:C0:B0:BB:62:AE:BE:47:80:DC:00:F8:E3:E7:66:B5
+SHA1: 2B:CE:0C:E1:35:B9:9D:FE:5A:6E:25:88:01:F7:E9:E5:7B:89:17:42
+SHA256: 65:F3:0A:64:F2:52:B2:4E:F8:76:C5:D0:6D:53:7C:E8:00:AE:F4:95:3C:CC:CB:01:6B:22:AF:46:36:50:CF:FF
+SHA1: 7D:48:4D:1C:F8:55:E8:79:6A:B0:19:E1:26:4F:AC:FD:57:6B:38:A0
+SHA256: 0A:14:3F:88:8D:C2:D6:97:3E:02:0F:5F:17:E3:D9:FE:CF:93:10:2C:3C:8D:81:AC:06:2F:32:39:4D:0E:CB:6A
+Alias name: servercert
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/KeyStore/PKCS12/api_private_key.p12.data	Tue Mar 29 01:57:33 2016 -0700
@@ -0,0 +1,31 @@
+MIIGyAIBAzCCBoIGCSqGSIb3DQEHAaCCBnMEggZvMIIGazCCAzgGCSqGSIb3DQEHAaCCAykEggMl
+MIIDITCCAx0GCyqGSIb3DQEMCgECoIICsjCCAq4wKAYKKoZIhvcNAQwBAzAaBBTyKTFVy4z9Rja3
+Gd3aw4Eb49XnKQICBAAEggKAOFjH3xr57gTXK1A1jBzdxnY7ZaHVqeFrjAcouBC3DV+yR6x2bxNJ
+oEythXOYnC6flZu3NTbGkCd8AjGsUPgIy03SeRrQE8eKhhV981FOWuG1uHpa3wN1e3aCpaH7xvcG
+d+5cS2UUWd2ejrM5hc3GeQ+rGC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lk7HIb
+FWbYdjy4/uHnyPeAIgFIltd1RdxXt5VDwTSAY4lwSwaEA+vvkycVfckzhmbUylclfy4HVNf/3d3e
+61VlLUbitSbnKX281Eek89yfKlB5YxQd0jHdXbdBNTB1eUM9s+Anm7p3emDMa1XR0N+lTehKLAyp
+znOe3ynqL1OxAiLH/4uv3EI4Ah3b09rB+JJ0+sAVRo1olMr2Q5lkQdMWxGBwIFHf1LI+JH05QWkx
+6a8niEfvQceybkgz+e9UPkdKNcX3UYV07rYIHnd3kg5lbsEotN1OdcMPgewg5OC3LbHG8wAlxyfR
+L+WAyFoA7QnFpNhBgstOx6jclTbSpMzjGKBCKb1tsKD6N9wNEKbluJetyQDAnQ7JjNsTpspYM8d6
+pUiX0t7PpaoBM8/sN3o1s5wp+c3jxCVUHGzKGymavx8ItKWKNQJCZdwvZPWjsjIytc8A0k3nVvK8
+qPUlXEj6raWGxnbWV5AUpQwu8SzysyfGHt/7dF9Scc+8uSA8FKGpqOczWktiwe6m8nYwGZAg9D/7
+ynXr8xq4N4LgsM3JlnHf8vIntPaoo8bNSIQCZV6FK7x84A1tnD1vQrZuzSdyW5G7L/FqaomRoaj2
+BCyeoxpgvldNp0TIR1rNsNAwLmur5+r/Qk5TslWtV1fEXpBQDKgboB7lzocAugi1+OPywEqyLQL/
+EjinsMKp+IxzKAFLEJTZF+VGaVHNhDo7UqZI0psp/SqX9lQZkuuQKK9zNrbaLnAHfcijHRKa0mH4
+lkvA3Xp3tdmatCzO3eHd/el2U9zGxQk66B4yJHZTuIS7ipMKrPQWfkRqVi9qqOwpgr9YAIvYrVAw
+4Ke6//xG/zeNpMf3iwq0a2MECex7/ZZuMD0wITAJBgUrDgMCGgUABBR+Gn1klUGKLNrlz1zvINy9
+OAbKhQQUbyJhmiLytWdKpRT8ywMAn/VMTkgCAgQA
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/KeyStore/PKCS12/api_private_key.p12_expected.data	Tue Mar 29 01:57:33 2016 -0700
@@ -0,0 +1,3 @@
+SHA1: 48:22:E2:C2:47:9F:75:E3:52:56:9C:20:37:DF:03:7F:CD:9F:87:38
+SHA256: 9B:DF:B9:EC:DB:3E:EF:BD:61:8F:C3:62:BD:3E:95:FE:E5:B6:A3:F9:94:3D:8D:C1:AE:E9:44:86:25:FA:C1:1B
+Alias name: pkcs12testenduser1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/KeyStore/PKCS12/api_private_key_not_match.p12.data	Tue Mar 29 01:57:33 2016 -0700
@@ -0,0 +1,21 @@
+MIIEpAIBAzCCBF4GCSqGSIb3DQEHAaCCBE8EggRLMIIERzCCBEMGCSqGSIb3DQEHBqCCBDQwggQw
+AgEAMIIEKQYJKoZIhvcNAQcBMCgGCiqGSIb3DQEMAQYwGgQUgIXKrki/1oMI4cCRpYWa/iQtL0cC
+AgQAgIID8L1nh0C0Gmm9/AbAYbiwBJeb5oCAHa5E6BXJO9DP+m7774lUoQFuAmHJRoqr9hRzJulD
+FfdkmRO9JdCs1tRgmnik66ybBb2wqr9gsAhPHFhDWuYIQTJcYqYlBTS8hbg5stDYWCeyaqK3+Zyp
+bV3nHZtCe0AO+Rd3derZ3qhluPhc2FWX05fIomTZNiJsbi5wp95ejH4tGX5OdQoWXBjDzlrxopUd
+pmdmHfJvRRTEtMr45VPfuHOkAX8Fe2tPFUgkE2tUalUth90AuPXVlMm5Ne+OdKcj+V2EN2s5JxA6
+28H1IL753Hov3R80/+Rzn+NIN/BCwLfHyTFa4Ur7Z2dyOJHvM5qeaz580RR8MwsEjqSpmXiyVhQW
+3LNuziqs21woC7ueDW7TLiLhHp2Mt8BqFyfUYqBoS29lchRTHZbWTN2h66xycXlzbUCGIOHDXPXB
+mqgxQWIltgluel+9Uf//D5yzIkXbtnW9dkMwKkybctAUs9VN8V44UBxv4+noSxepUs0iG+07c5Uu
+dfvzwYtnKqKUrtTT8tA/MBNd4P1paYJR2Angx5tInyNKp8TwOaSrFUfg9stMYMh2fbWHLJFS9RDz
+P7BDkrBgEO7jDu3O/XyyXzgUQRcQBv/Mw7sCFQ8BBMFzwf/dc6q277w+DJmwz2ex23iXQXQi/b6Y
+iHbPwYHVwURWpVAq3P36pCTYjnUpPHMgRKo/9Iy+tL39H46SyGqBFlriM4jDEu7dbi7n1MuMxRYD
+zocSkdsnlsJUBOhHLFFYIUIqx6jOgnOESKPWbG9XIHCTZJYnpasmP/VidrQMljzC7c3piePsI03D
+8NcJq+BqCRrX+7Z5vPAU022hMryQqHesgnx0T0dWXaCyabzjjjOaWvacxRRCiJ4+EFZqAahMNQp/
+XTNlpW1eI0oQ3YBlJl5FWuwhk6YuoNSoi8ya1wp42rFnTwXIG8enfa0wyx/ORAvfypW4wcohsCdP
+oRjc9foQsdcjxv2e1yMn9TlgjTOemY81mFfaSMa+4OIhSgLnIYI96QztrY9n8WHJer1hxVdKrb+8
+Mhf2vcNEToVF9ypst1C7fXSeOKdAYlNDskPAAm3prcuLMf1dzceIADr+4JOYxzdz6lLvjR+tpAHo
+zWO1xh73P+p+Bo82wxnoWCopqOUCEoAYhsy+JBGZNM4AHvPAo4g0Sett3qixZhvbmw9kzKsiFAjf
+wQHYPUfl0O02HvBizHK7dRDqJ94G/djGBhqfe34P0hKrCzW+n0u5nFmkFEdk50LpsTu0z3AaaaNh
+E6485FDeW3R3/67pGXglNJHBWPsl2AYFimUTzxQqOfoCzBiw9St7hNvuCJBv5jA9MCEwCQYFKw4D
+AhoFAAQUczIrgX5A0QTP7tpYDiY3MaSbEM8EFAprSM643ml+k9DGSQKZ7MG0UEhKAgIEAA==
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/KeyStore/PKCS12/api_private_key_not_match.p12_expected.data	Tue Mar 29 01:57:33 2016 -0700
@@ -0,0 +1,3 @@
+SHA1: 2B:CE:0C:E1:35:B9:9D:FE:5A:6E:25:88:01:F7:E9:E5:7B:89:17:42
+SHA256: 65:F3:0A:64:F2:52:B2:4E:F8:76:C5:D0:6D:53:7C:E8:00:AE:F4:95:3C:CC:CB:01:6B:22:AF:46:36:50:CF:FF
+Alias name: pkcs12testenduser1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/KeyStore/PKCS12/api_two_pass.p12.data	Tue Mar 29 01:57:33 2016 -0700
@@ -0,0 +1,46 @@
+MIIKGAIBAzCCCdIGCSqGSIb3DQEHAaCCCcMEggm/MIIJuzCCBYAGCSqGSIb3DQEHAaCCBXEEggVt
+MIIFaTCCBWUGCyqGSIb3DQEMCgECoIIE+jCCBPYwKAYKKoZIhvcNAQwBAzAaBBRXawh3kWXVQuH9
+IwNiyygBmKxSAAICBAAEggTINY1+d2I8JZk2edT/FddM9FOQ/jchyf+SE4a0eKQae4Hby2LrL+AG
+/+6MmRyvKOQYVthtxEAqoqUxsEPc35vr0xtiv/em42AUI5abfAnh8tTrgoCY4Zc3Gk/m7iS0XKQJ
+Eg/uiA2C6UbrS0soIjpBkNKxmh45L9hBtkOQkwRC2SqXPQy5g9ezwyPFWm3KsbdyMwnyJs2dMEnE
+p2D2BrdSfJwEZjDFLRFszQDLYvLgJcWzt8Zl3vdgVB6MDVGtT8Zdsa5cyxnplCQU+tWxP1U0uODn
+4uyM3PPujLwgwBl6EvCtR1ddcz8k4YMrIp0h1UbEGUibg7kaBmZ79xeZ94FWU0ulxW7sXX3YBSPH
+Nf4KM1fHshdAbwKZD2cR9yGG1fta/HnZN8y5YuQ9iNsAF+sJZATOysqa4/L8cst0Y1KpuirFkctp
+sVykTqCqiwOhSzQ0plMXG0rABhSX/Poapsl7ghY9jgK4d/zX1XJ34BQv896AjEQSBUs1NbybzNiK
+AzxV11JF/Mxdp29a8Y2tTr5NQVpnIEMlvxTwJgx662MPTlPyNUTxFWJfx/WkhI8VQzz3lqRhvOD4
+IvkKw91+BK5BrdSclrJ0P6R6Rak5zaXFMY3eveCQ1HQyU4Az84+xPw9NP9xO+5DQxRPbMDLZYLm/
+nMkwJAf/fXpto/2JeXkMPahuG6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Bsyis/RmL
+8z5B44M1d0HkjgcFDQNHm2xR4W9uuCcrxkicU2e5GzO5bUDaBv7rnwBj7Fy/AiVhFCreJO6cVAFR
+kIyeLBrJGzlemscTbymrYsg2BydoxRXWU4wRmgZQQyRgQTxHZeNYtn5mpvV5D7m3HNCGxoYj46L2
+6P+FFoByASwSQpKrn6OnH42xmAs7HT/flOhz4e3cD1UuUcfqqITaOWSrX22Ew88JqzbLDgN/K5Eo
+TIMvtPSwihL4NLJpzG1HbuhnzmOiYtI3/IVhrDQ5dPYTUy+U1hasE1NTLM3xvdTBebksygbj3IMu
+wiW+reRdF5l0Pz9tz63MFu1FbKNrKEkg8Vw4cDEtnvpJRIO2VbVgZpdKhhMC7Z0T3xP9hEa8crv6
+/8qd5uY9mvY3RSKO0IdJSgkwPTAhMAkGBSsOAwIaBQAEFKSVvKysZX3JB3K2WGS6czUVRXZeBBTO
++FjQ0fq7d/D+Ilu6e2EBG1y/ngICBAA=
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/KeyStore/PKCS12/api_two_pass.p12_expected.data	Tue Mar 29 01:57:33 2016 -0700
@@ -0,0 +1,3 @@
+SHA1: 77:90:EC:65:C5:0C:FD:F2:1E:B0:3A:BD:43:21:1A:C6:FD:18:8C:AB
+SHA256: 8E:C8:49:82:B8:4B:89:8E:61:2D:CD:F6:D6:34:96:04:91:6F:1B:08:F5:CD:BD:23:ED:94:22:5A:B4:7A:39:DD
+Alias name: pkcs12testenduser1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/KeyStore/PKCS12/ie_chain.pfx.data	Tue Mar 29 01:57:33 2016 -0700
@@ -0,0 +1,65 @@
+MIIOWAIBAzCCDhIGCSqGSIb3DQEHAaCCDgMEgg3/MIIN+zCCBXAGCSqGSIb3DQEHAaCCBWEEggVd
+MIIFWTCCBVUGCyqGSIb3DQEMCgECoIIE+jCCBPYwKAYKKoZIhvcNAQwBAzAaBBSqiN24DSDipTd5
+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2mr9AurMsoORgdb+LxUuI5u1QS9xW5q1tNoEwTmrGfG3oergsDFmpty3c8DKJ1LJtL
+chuTi0lRpc9Js5hCuDRjDRaf2JaQwpo+OxvnQRWUWbVyS3UZX1tZj1gjcEEAeZPnItICeUl+igZd
+yvIPDBcwUUIuEG1sTcigsxh1e40AQ2+sl+8s90lbWLVQqpCrx511RukoPl2bWlcxR+GWnqhj1ssQ
+b+RBTQbj48qoke37CHdnwod/7aAwW/OFB6JlAu0h6G+OcCE7qmtav+We4XHsdXjfCL+k9Y3CNies
+36GeZEcTTsmrXplDHWLgBjEp5PVtTFE9NEe4h5YT1B8G6kPqOixPzNucpFZ8EGoenrcGOGSqTc3L
+9vRny/TJYEAjXMZBXo2QzNc9dGWcG0NhTadKQWuYxFew9C5OvxCu5D3kdTh2PWRpG/uynW+bpjUi
+KPgg9lY8mkHjvb+FmPDmOZla63V/TzA9MCEwCQYFKw4DAhoFAAQUQNid2ROQWDvYCz4DPzph7hci
+fAQEFPL7KYm4NrHpQSKpto5+pPs7NgLWAgIEAA==
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/KeyStore/PKCS12/ie_chain.pfx.pem	Tue Mar 29 01:57:33 2016 -0700
@@ -0,0 +1,23 @@
+-----BEGIN CERTIFICATE-----
+MIID7DCCAtSgAwIBAgIBBDANBgkqhkiG9w0BAQsFADBXMQswCQYDVQQGEwJJTjEL
+MAkGA1UECAwCS0ExDDAKBgNVBAcMA2JscjEPMA0GA1UECgwGT3JhY2xlMQ0wCwYD
+VQQLDARKYXZhMQ0wCwYDVQQDDARMZWFkMB4XDTE1MDUyODAzNDMwN1oXDTI1MDUy
+NTAzNDMwN1owSzELMAkGA1UEBhMCSU4xCzAJBgNVBAgMAktBMQ8wDQYDVQQKDAZP
+cmFjbGUxDTALBgNVBAsMBEphdmExDzANBgNVBAMMBk1lbWJlcjCCASIwDQYJKoZI
+hvcNAQEBBQADggEPADCCAQoCggEBAMr07JoRV0kR5mNKgLF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XBcK6KQ61X5GftMz4a5io7PoxJxsDkPyTPNaHov2dzOBblbn2
+Gd0YgRdI3jcmm6ELDN7CqzsO7FK48L8maLeIj/0hYPBZPxKohjChi2GUNKn97OMf
+Y0LTeDqpO6+oc2E25XECAwEAAaMhMB8wHQYDVR0OBBYEFLC2ChLxDu/yacB3s0ON
+NNDusz2SMA0GCSqGSIb3DQEBBAUAA4GBADhG2wSf4KHMspsKv8bkjWrDA6wTjwnx
+pQES8E2dMmmp/LybH0CerpcShGGw35uh8wnCaWA1hBgMAs1mfghTt9X8tZCG5MmA
+VmkR7VPu1lNbdB1sswXAy3/423ncWbPJKIvbXBLJrzvC3Ri6d/AiH/0Tud0H15IN
+YQ+ThBRF5iQC
+-----END CERTIFICATE-----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/KeyStore/PKCS12/netscape_self.p12.data	Tue Mar 29 01:57:33 2016 -0700
@@ -0,0 +1,31 @@
+MIIGyAIBAzCCBoIGCSqGSIb3DQEHAaCCBnMEggZvMIIGazCCAzgGCSqGSIb3DQEHAaCCAykEggMl
+MIIDITCCAx0GCyqGSIb3DQEMCgECoIICsjCCAq4wKAYKKoZIhvcNAQwBAzAaBBTCAQwl6bGuvgin
+MKu6yDFS0MTbSgICBAAEggKA+opmhScngYOULEBEohIPKypaCmqQ/W/bccSFYV5qBxkD8hUKsIr9
+pkgZzZBPFycpAfIL0lJ7BGQaTnQpFOxXZiDOnFxqFTk3s8QTXYYeEL2Q9PMf/wJ0RTpl4eJQlxF9
+j2IiNHhoFNhlarpvSdQxYP5K9OUIrGzEJ/hlpZIavwV3hnj14A0F+/nBviaRn2bnevsF4icjICW9
+8/jPp8TNg2UF+qQkKd1SpGZYo29a3dbgSuZn2PcPYT+CDQZ/V/W8ch1e+k+Lcdh5wBopnUyavONa
+v7lkd9WO8Tc0Y6pBBMBZukv3Fcny9DEgegh4dWxGIBZ4jMLGgW+MMpIi6P+TG8UrIPO5mBrRSC6e
+3LBS5YMZ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h1PcGVuU1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAd
+BgNVHQ4EFgQUhxNmvHpNjpjnl/vMVkEnyF5Msk0wHwYDVR0jBBgwFoAUHyFP2xAx
+0GeDCQPTzfxG7M8di7QwDQYJKoZIhvcNAQELBQADggEBAD4rXzKq8PdSK7rzuwfu
+q+RzeYZnNM7OsoBGhMfHQKnnI3LH5bgyttuCoV665X2mgy6+LZcrXqom/ZrLXQ6x
+JVtGxNHr7rqbnC/9tB2/s9HHN3YiRs966shWHGkhCubsUGre7Z25Pq55K6Pyl+nU
+hb+K8aQ54z4oDt+raAdbuILq91fUjw5j1qex3d62fHvf4IO3spcKY4HhnwBPifg2
+YZCiZRZOoVysi2FTdsvW2NfQCYgtUftbkfNrKglkRuIa9rQEduhDy1cwn4fc9S1f
+6WTvuJNoIp3o1nQppFjfO7fzfIDCrlaEkkXU7O54KQ5HTKu62tZp9xKW71oolOnZ
+bZQ=
+-----END CERTIFICATE-----
--- a/test/sun/security/pkcs12/StoreSecretKeyTest.java	Mon Mar 21 14:13:57 2016 +0000
+++ b/test/sun/security/pkcs12/StoreSecretKeyTest.java	Tue Mar 29 01:57:33 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,8 +23,9 @@
 
 /*
  * @test
- * @bug 8005408 8079129
+ * @bug 8005408 8079129 8048830
  * @summary KeyStore API enhancements
+ * @run main StoreSecretKeyTest
  */
 
 import java.io.*;
@@ -44,9 +45,20 @@
     private static final String CERT = DIR + "/trusted.pem";
     private static final String ALIAS = "my trusted cert";
     private static final String ALIAS2 = "my secret key";
-
+    private enum ALGORITHM {
+        DES(56),
+        DESede(168),
+        AES(128);
+        final int len;
+        ALGORITHM(int l) {
+            len = l;
+        }
+        final int getLength() {
+            return len;
+        }
+    }
     public static void main(String[] args) throws Exception {
-
+        boolean isSecretkeyAlgSupported = false;
         // Skip test if AES is unavailable
         try {
             SecretKeyFactory.getInstance("AES");
@@ -55,57 +67,69 @@
             return;
         }
 
+        for (ALGORITHM alg : ALGORITHM.values()) {
+            isSecretkeyAlgSupported |= testSecretKeyAlgorithm(alg);
+        }
+        if (!isSecretkeyAlgSupported) {
+            throw new Exception("None of the SecretKey algorithms is "
+                    + "supported");
+        }
+    }
+
+    private static boolean testSecretKeyAlgorithm(ALGORITHM algorithm) throws
+            Exception {
+
+        System.out.println("Testing algorithm : " + algorithm.name());
         new File(KEYSTORE).delete();
+        try {
+            KeyStore keystore = KeyStore.getInstance("PKCS12");
+            keystore.load(null, null);
 
-        KeyStore keystore = KeyStore.getInstance("PKCS12");
-        keystore.load(null, null);
-
-        // Set trusted certificate entry
-        Certificate cert = loadCertificate(CERT);
-        keystore.setEntry(ALIAS,
+            // Set trusted certificate entry
+            Certificate cert = loadCertificate(CERT);
+            keystore.setEntry(ALIAS,
             new KeyStore.TrustedCertificateEntry(cert), null);
-
-        // Set secret key entry
-        keystore.setEntry(ALIAS2,
-            new KeyStore.SecretKeyEntry(generateSecretKey("AES", 128)),
+            // Set secret key entry
+            SecretKey secretKey = generateSecretKey(algorithm.name(),
+                    algorithm.len);
+            if(secretKey == null) {
+                return false;
+            }
+            keystore.setEntry(ALIAS2,
+                new KeyStore.SecretKeyEntry(secretKey),
                 new KeyStore.PasswordProtection(PASSWORD));
 
-        try (FileOutputStream outStream = new FileOutputStream(KEYSTORE)) {
-            System.out.println("Storing keystore to: " + KEYSTORE);
-            keystore.store(outStream, PASSWORD);
+            try (FileOutputStream outStream = new FileOutputStream(KEYSTORE)) {
+                System.out.println("Storing keystore to: " + KEYSTORE);
+                keystore.store(outStream, PASSWORD);
+            }
+
+            try (FileInputStream inStream = new FileInputStream(KEYSTORE)) {
+                System.out.println("Loading keystore from: " + KEYSTORE);
+                keystore.load(inStream, PASSWORD);
+                System.out.println("Loaded keystore with " + keystore.size() +
+                    " entries");
+            }
+
+            KeyStore.Entry entry = keystore.getEntry(ALIAS2,
+                new KeyStore.PasswordProtection(PASSWORD));
+            System.out.println("Retrieved entry: " + entry);
+
+            if (entry instanceof KeyStore.SecretKeyEntry) {
+                System.out.println("Retrieved secret key entry: " + entry);
+            } else {
+                throw new Exception("Not a secret key entry");
+            }
+        } catch (KeyStoreException | UnrecoverableKeyException ex) {
+            System.out.println("Unable to check SecretKey algorithm due to "
+                    + "exception: " + ex.getMessage());
+            return false;
         }
-
-        try (FileInputStream inStream = new FileInputStream(KEYSTORE)) {
-            System.out.println("Loading keystore from: " + KEYSTORE);
-            keystore.load(inStream, PASSWORD);
-            System.out.println("Loaded keystore with " + keystore.size() +
-                " entries");
-        }
-
-        KeyStore.Entry entry = keystore.getEntry(ALIAS2,
-            new KeyStore.PasswordProtection(PASSWORD));
-        System.out.println("Retrieved entry: " + entry);
-
-        if (entry instanceof KeyStore.SecretKeyEntry) {
-            System.out.println("Retrieved secret key entry: " + entry);
-        } else {
-            throw new Exception("Not a secret key entry");
-        }
+        return true;
     }
 
     private static SecretKey generateSecretKey(String algorithm, int size)
         throws NoSuchAlgorithmException {
-
-        // Failover to DES if the requested secret key factory is unavailable
-        SecretKeyFactory keyFactory;
-        try {
-            keyFactory = SecretKeyFactory.getInstance(algorithm);
-        } catch (NoSuchAlgorithmException nsae) {
-            keyFactory = SecretKeyFactory.getInstance("DES");
-            algorithm = "DES";
-            size = 56;
-        }
-
         KeyGenerator generator = KeyGenerator.getInstance(algorithm);
         generator.init(size);
         return generator.generateKey();