jdk/test/sun/security/tools/keytool/KeyToolTest.java
changeset 41960 916bb3d29d7b
parent 41107 567f832618d7
--- a/jdk/test/sun/security/tools/keytool/KeyToolTest.java	Tue Nov 08 14:29:14 2016 -0800
+++ b/jdk/test/sun/security/tools/keytool/KeyToolTest.java	Tue Nov 08 15:55:11 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -1211,18 +1211,26 @@
     void sqePrintcertTest() throws Exception {
         remove("x.jks");
         remove("mykey.cert");
+        remove("myweakkey.cert");
         testOK("", "-keystore x.jks -storetype JKS -storepass changeit " +
                 "-keypass changeit -genkeypair -dname CN=olala");
         testOK("", "-keystore x.jks -storetype JKS -storepass changeit " +
                 "-export -file mykey.cert -alias mykey");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit " +
+                "-keypass changeit -genkeypair -dname CN=weak -keyalg rsa " +
+                "-keysize 512 -sigalg MD5withRSA -alias myweakkey");
+        testOK("", "-keystore x.jks -storetype JKS -storepass changeit " +
+                "-export -file myweakkey.cert -alias myweakkey");
         testFail("", "-printcert -file badkeystore");
         testFail("", "-printcert -file a/b/c/d");
         testOK("", "-printcert -file mykey.cert");
+        testOK("", "-printcert -file myweakkey.cert");
         FileInputStream fin = new FileInputStream("mykey.cert");
         testOK(fin, "-printcert");
         fin.close();
         remove("x.jks");
         remove("mykey.cert");
+        remove("myweakkey.cert");
     }
 
     // 8074935: jdk8 keytool doesn't validate pem files for RFC 1421 correctness