< prev index next >

test/jdk/java/security/KeyStore/PKCS12/KeytoolReaderP12Test.java

Print this page
rev 51638 : [mq]: 8210112


   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.io.File;
  25 import java.io.IOException;
  26 import java.nio.file.Files;
  27 import java.nio.file.StandardOpenOption;
  28 import java.util.Base64;
  29 import jdk.testlibrary.OutputAnalyzer;
  30 import static java.lang.System.out;
  31 import java.nio.file.Paths;
  32 import java.util.List;
  33 
  34 /**
  35  * @test
  36  * @bug 8048830
  37  * @summary Test for PKCS12 keystore list , export commands. Refer README for
  38  * keystore files information
  39  * @library /lib/testlibrary ../

  40  * @run main KeytoolReaderP12Test
  41  */
  42 public class KeytoolReaderP12Test {
  43     private static final String WORKING_DIRECTORY = System.getProperty(
  44             "test.classes", "."+ File.separator);
  45     //private static final String KS_PASSWD = "pass";
  46     private static final String KS_PASSWD = "storepass";
  47     private static final String CERT_CHAIN_PASSWD = "password";
  48     private static final String SOURCE_DIRECTORY =
  49             System.getProperty("test.src", "." + File.separator);
  50 
  51     public static void main(String[] args) throws Exception {
  52         List<String> expectedValues = null;
  53         out.println("Self signed test");
  54         expectedValues = Files.readAllLines(Paths.get(SOURCE_DIRECTORY,
  55                 "api_private_key.p12_expected.data"));
  56         readTest("api_private_key.p12.data", KS_PASSWD, expectedValues);
  57         out.println("Self signed test Passed");
  58 
  59         out.println("private key with selfsigned cert, key pair not match");




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.io.File;
  25 import java.io.IOException;
  26 import java.nio.file.Files;
  27 import java.nio.file.StandardOpenOption;
  28 import java.util.Base64;
  29 import jdk.test.lib.process.OutputAnalyzer;
  30 import static java.lang.System.out;
  31 import java.nio.file.Paths;
  32 import java.util.List;
  33 
  34 /**
  35  * @test
  36  * @bug 8048830
  37  * @summary Test for PKCS12 keystore list , export commands. Refer README for
  38  * keystore files information
  39  * @library /lib/testlibrary ../
  40  * @library /test/lib
  41  * @run main KeytoolReaderP12Test
  42  */
  43 public class KeytoolReaderP12Test {
  44     private static final String WORKING_DIRECTORY = System.getProperty(
  45             "test.classes", "."+ File.separator);
  46     //private static final String KS_PASSWD = "pass";
  47     private static final String KS_PASSWD = "storepass";
  48     private static final String CERT_CHAIN_PASSWD = "password";
  49     private static final String SOURCE_DIRECTORY =
  50             System.getProperty("test.src", "." + File.separator);
  51 
  52     public static void main(String[] args) throws Exception {
  53         List<String> expectedValues = null;
  54         out.println("Self signed test");
  55         expectedValues = Files.readAllLines(Paths.get(SOURCE_DIRECTORY,
  56                 "api_private_key.p12_expected.data"));
  57         readTest("api_private_key.p12.data", KS_PASSWD, expectedValues);
  58         out.println("Self signed test Passed");
  59 
  60         out.println("private key with selfsigned cert, key pair not match");


< prev index next >