8027026: Change keytool -genkeypair to use -keyalg RSA
authorweijun
Wed, 23 Oct 2013 08:32:03 +0800
changeset 21342 7bbb056a1c23
parent 21341 b29c2fe04b30
child 21343 2a4c97049dc6
8027026: Change keytool -genkeypair to use -keyalg RSA Reviewed-by: alanb, chegar, mullan
jdk/test/ProblemList.txt
jdk/test/java/util/TimeZone/TimeZoneDatePermissionCheck.sh
jdk/test/java/util/jar/JarInputStream/ExtraFileInMetaInf.java
jdk/test/sun/security/pkcs12/PKCS12SameKeyId.java
jdk/test/sun/security/tools/jarsigner/TimestampCheck.java
jdk/test/sun/security/tools/jarsigner/checkusage.sh
jdk/test/sun/security/tools/jarsigner/collator.sh
jdk/test/sun/security/tools/jarsigner/crl.sh
jdk/test/sun/security/tools/jarsigner/jvindex.sh
jdk/test/sun/security/tools/jarsigner/newsize7.sh
jdk/test/sun/security/tools/jarsigner/onlymanifest.sh
jdk/test/sun/security/tools/jarsigner/passtype.sh
jdk/test/sun/security/tools/jarsigner/samename.sh
jdk/test/sun/security/tools/jarsigner/ts.sh
jdk/test/sun/security/tools/keytool/CloseFile.java
jdk/test/sun/security/tools/keytool/ListKeychainStore.sh
jdk/test/sun/security/tools/keytool/StartDateTest.java
jdk/test/sun/security/tools/keytool/UnknownAndUnparseable.java
jdk/test/sun/security/tools/keytool/emptysubject.sh
jdk/test/sun/security/tools/keytool/importreadall.sh
jdk/test/sun/security/tools/keytool/p12importks.sh
jdk/test/sun/security/tools/keytool/readjar.sh
jdk/test/sun/security/tools/keytool/selfissued.sh
jdk/test/sun/security/tools/keytool/trystore.sh
jdk/test/sun/security/validator/certreplace.sh
jdk/test/sun/security/validator/samedn.sh
--- a/jdk/test/ProblemList.txt	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/ProblemList.txt	Wed Oct 23 08:32:03 2013 +0800
@@ -273,14 +273,8 @@
 sun/security/pkcs11/Secmod/AddPrivateKey.java			linux-all
 sun/security/pkcs11/Secmod/TrustAnchors.java 			linux-all
 
-# 7041639, Solaris DSA keypair generation bug (Note: jdk_util also affected)
+# 7041639, Solaris DSA keypair generation bug
 java/security/KeyPairGenerator/SolarisShortDSA.java             solaris-all
-sun/security/tools/jarsigner/onlymanifest.sh                    solaris-all
-sun/security/tools/jarsigner/ts.sh                              solaris-all
-sun/security/tools/keytool/emptysubject.sh                      solaris-all
-sun/security/tools/keytool/importreadall.sh                     solaris-all
-sun/security/tools/keytool/readjar.sh                           solaris-all
-sun/security/tools/keytool/selfissued.sh                        solaris-all
 sun/security/tools/keytool/standard.sh                          solaris-all
 
 # 8000439: NPG: REGRESSION : sun/security/krb5/auto/MaxRetries.java fails with timeout
@@ -351,7 +345,4 @@
 # Filed 6772009
 java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java generic-all
 
-# 7041639, Solaris DSA keypair generation bug
-java/util/TimeZone/TimeZoneDatePermissionCheck.sh               solaris-all
-
 ############################################################################
--- a/jdk/test/java/util/TimeZone/TimeZoneDatePermissionCheck.sh	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/java/util/TimeZone/TimeZoneDatePermissionCheck.sh	Wed Oct 23 08:32:03 2013 +0800
@@ -40,6 +40,7 @@
 ${COMPILEJAVA}/bin/keytool ${TESTTOOLVMOPTS} -genkeypair -alias testcert \
   -keystore ${TESTCLASSES}/timezonedatetest.store \
   -storepass testpass -validity 360 \
+  -keyalg rsa \
   -dname "cn=Mark Wildebeest, ou=FreeSoft, o=Red Hat, c=NL" \
   -keypass testpass
 
--- a/jdk/test/java/util/jar/JarInputStream/ExtraFileInMetaInf.java	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/java/util/jar/JarInputStream/ExtraFileInMetaInf.java	Wed Oct 23 08:32:03 2013 +0800
@@ -49,7 +49,7 @@
         new File("ks").delete();
         sun.security.tools.keytool.Main.main(
                 ("-keystore ks -storepass changeit -keypass changeit " +
-                        "-alias a -dname CN=A -genkeypair").split(" "));
+                        "-keyalg rsa -alias a -dname CN=A -genkeypair").split(" "));
         sun.security.tools.jarsigner.Main.main(
                 "-keystore ks -storepass changeit x.jar a".split(" "));
 
--- a/jdk/test/sun/security/pkcs12/PKCS12SameKeyId.java	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/sun/security/pkcs12/PKCS12SameKeyId.java	Wed Oct 23 08:32:03 2013 +0800
@@ -60,7 +60,7 @@
         for (int i=0; i<SIZE; i++) {
             System.err.print(".");
             String cmd = "-keystore " + JKSFILE
-                    + " -storepass changeit -keypass changeit "
+                    + " -storepass changeit -keypass changeit -keyalg rsa "
                     + "-genkeypair -alias p" + i + " -dname CN=" + i;
             sun.security.tools.keytool.Main.main(cmd.split(" "));
         }
--- a/jdk/test/sun/security/tools/jarsigner/TimestampCheck.java	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/sun/security/tools/jarsigner/TimestampCheck.java	Wed Oct 23 08:32:03 2013 +0800
@@ -185,7 +185,7 @@
             DerOutputStream tstInfo2 = new DerOutputStream();
             tstInfo2.putOctetString(tstInfo.toByteArray());
 
-            Signature sig = Signature.getInstance("SHA1withDSA");
+            Signature sig = Signature.getInstance("SHA1withRSA");
             sig.initSign((PrivateKey)(ks.getKey(
                     alias, "changeit".toCharArray())));
             sig.update(tstInfo.toByteArray());
--- a/jdk/test/sun/security/tools/jarsigner/checkusage.sh	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/sun/security/tools/jarsigner/checkusage.sh	Wed Oct 23 08:32:03 2013 +0800
@@ -45,7 +45,7 @@
     ;;
 esac
 
-KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit"
+KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keyalg rsa"
 JAR=$TESTJAVA${FS}bin${FS}jar
 JARSIGNER="$TESTJAVA${FS}bin${FS}jarsigner"
 
--- a/jdk/test/sun/security/tools/jarsigner/collator.sh	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/sun/security/tools/jarsigner/collator.sh	Wed Oct 23 08:32:03 2013 +0800
@@ -47,7 +47,7 @@
 JFILE=collator.jar
 
 KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit \
-        -keystore $KS"
+        -keyalg rsa -keystore $KS"
 JAR=$TESTJAVA${FS}bin${FS}jar
 JARSIGNER="$TESTJAVA${FS}bin${FS}jarsigner -keystore $KS -storepass changeit"
 
--- a/jdk/test/sun/security/tools/jarsigner/crl.sh	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/sun/security/tools/jarsigner/crl.sh	Wed Oct 23 08:32:03 2013 +0800
@@ -45,7 +45,7 @@
 
 KS=crl.jks
 
-KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore $KS"
+KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore $KS -keyalg rsa"
 
 rm $KS 2> /dev/null
 
--- a/jdk/test/sun/security/tools/jarsigner/jvindex.sh	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/sun/security/tools/jarsigner/jvindex.sh	Wed Oct 23 08:32:03 2013 +0800
@@ -47,7 +47,7 @@
 JFILE=jvindex.jar
 
 KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit \
-        -keystore $KS"
+        -keystore $KS -keyalg rsa"
 JAR=$TESTJAVA${FS}bin${FS}jar
 JARSIGNER="$TESTJAVA${FS}bin${FS}jarsigner -keystore $KS -storepass changeit"
 
--- a/jdk/test/sun/security/tools/jarsigner/newsize7.sh	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/sun/security/tools/jarsigner/newsize7.sh	Wed Oct 23 08:32:03 2013 +0800
@@ -51,7 +51,7 @@
 
 KSFILE=ns7.jks
 
-KT="${TESTJAVA}${FS}bin${FS}keytool -keystore ns7.jks -storepass changeit -keypass changeit"
+KT="${TESTJAVA}${FS}bin${FS}keytool -keystore ns7.jks -storepass changeit -keypass changeit -keyalg rsa"
 JAR="${TESTJAVA}${FS}bin${FS}jar"
 JS="${TESTJAVA}${FS}bin${FS}jarsigner -keystore ns7.jks -storepass changeit"
 
--- a/jdk/test/sun/security/tools/jarsigner/onlymanifest.sh	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/sun/security/tools/jarsigner/onlymanifest.sh	Wed Oct 23 08:32:03 2013 +0800
@@ -46,7 +46,7 @@
 JFILE=onlymanifest.jar
 
 KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit \
-        -keystore $KS"
+        -keystore $KS -keyalg rsa"
 JAR=$TESTJAVA${FS}bin${FS}jar
 JARSIGNER=$TESTJAVA${FS}bin${FS}jarsigner
 
--- a/jdk/test/sun/security/tools/jarsigner/passtype.sh	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/sun/security/tools/jarsigner/passtype.sh	Wed Oct 23 08:32:03 2013 +0800
@@ -45,7 +45,7 @@
 KS=pt.jks
 JFILE=pt.jar
 
-KT="$TESTJAVA${FS}bin${FS}keytool -keystore $KS -validity 300"
+KT="$TESTJAVA${FS}bin${FS}keytool -keystore $KS -validity 300 -keyalg rsa"
 JAR=$TESTJAVA${FS}bin${FS}jar
 JARSIGNER=$TESTJAVA${FS}bin${FS}jarsigner
 
--- a/jdk/test/sun/security/tools/jarsigner/samename.sh	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/sun/security/tools/jarsigner/samename.sh	Wed Oct 23 08:32:03 2013 +0800
@@ -47,7 +47,7 @@
 KS=samename.jks
 JFILE=em.jar
 
-KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore $KS"
+KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore $KS -keyalg rsa"
 JAR=$TESTJAVA${FS}bin${FS}jar
 JARSIGNER=$TESTJAVA${FS}bin${FS}jarsigner
 
--- a/jdk/test/sun/security/tools/jarsigner/ts.sh	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/sun/security/tools/jarsigner/ts.sh	Wed Oct 23 08:32:03 2013 +0800
@@ -53,7 +53,7 @@
 JAR="${TESTJAVA}${FS}bin${FS}jar"
 JAVA="${TESTJAVA}${FS}bin${FS}java"
 JAVAC="${TESTJAVA}${FS}bin${FS}javac"
-KT="${TESTJAVA}${FS}bin${FS}keytool -keystore tsks -storepass changeit -keypass changeit"
+KT="${TESTJAVA}${FS}bin${FS}keytool -keystore tsks -storepass changeit -keypass changeit -keyalg rsa"
 
 rm tsks
 echo Nothing > A
--- a/jdk/test/sun/security/tools/keytool/CloseFile.java	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/sun/security/tools/keytool/CloseFile.java	Wed Oct 23 08:32:03 2013 +0800
@@ -59,7 +59,7 @@
     }
 
     static void run(String s) throws Exception {
-        sun.security.tools.keytool.Main.main((s+" -debug").split(" "));
+        sun.security.tools.keytool.Main.main((s+" -debug -keyalg rsa").split(" "));
     }
     static void remove(String filename, boolean check) {
         new File(filename).delete();
--- a/jdk/test/sun/security/tools/keytool/ListKeychainStore.sh	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/sun/security/tools/keytool/ListKeychainStore.sh	Wed Oct 23 08:32:03 2013 +0800
@@ -71,6 +71,7 @@
         -storetype PKCS12 \
         -keystore $TEMPORARY_P12 \
         -storepass $PWD \
+        -keyalg rsa \
         -dname "CN=$i,OU=$i,O=$i,ST=$i,C=US" \
         -alias 7133495-$i
 
--- a/jdk/test/sun/security/tools/keytool/StartDateTest.java	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/sun/security/tools/keytool/StartDateTest.java	Wed Oct 23 08:32:03 2013 +0800
@@ -49,7 +49,7 @@
         new File("jks").delete();
 
         run("-keystore jks -storetype jks -storepass changeit -keypass changeit -alias me " +
-                "-genkeypair -dname CN=Haha -startdate +1y");
+                "-keyalg rsa -genkeypair -dname CN=Haha -startdate +1y");
         cal.setTime(getIssueDate());
         System.out.println(cal);
         if (cal.get(Calendar.YEAR) != year + 1) {
--- a/jdk/test/sun/security/tools/keytool/UnknownAndUnparseable.java	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/sun/security/tools/keytool/UnknownAndUnparseable.java	Wed Oct 23 08:32:03 2013 +0800
@@ -43,7 +43,7 @@
         // Create a cert with an unknown extension: 1.2.3.4, and an invalid
         // KeyUsage extension
         String genkey = s
-                + "-genkeypair -alias a -dname CN=A -ext 1.2.3.4=1234 "
+                + "-genkeypair -alias a -dname CN=A -ext 1.2.3.4=1234 -keyalg rsa "
                 + "-ext " + PKIXExtensions.KeyUsage_Id.toString() + "=5678";
         sun.security.tools.keytool.Main.main(genkey.split(" "));
 
--- a/jdk/test/sun/security/tools/keytool/emptysubject.sh	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/sun/security/tools/keytool/emptysubject.sh	Wed Oct 23 08:32:03 2013 +0800
@@ -45,7 +45,7 @@
 esac
 
 KS=emptysubject.jks
-KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore $KS"
+KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore $KS -keyalg rsa"
 
 rm $KS
 
--- a/jdk/test/sun/security/tools/keytool/importreadall.sh	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/sun/security/tools/keytool/importreadall.sh	Wed Oct 23 08:32:03 2013 +0800
@@ -49,7 +49,7 @@
     ;;
 esac
 
-KEYTOOL="${TESTJAVA}${FS}bin${FS}keytool -keystore importreadall.jks -storepass changeit -keypass changeit"
+KEYTOOL="${TESTJAVA}${FS}bin${FS}keytool -keystore importreadall.jks -storepass changeit -keypass changeit -keyalg rsa"
 
 # In case the test is run twice in the same directory
 
--- a/jdk/test/sun/security/tools/keytool/p12importks.sh	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/sun/security/tools/keytool/p12importks.sh	Wed Oct 23 08:32:03 2013 +0800
@@ -50,7 +50,7 @@
 
 rm jks 2> /dev/null
 $KT -genkeypair -keystore jks -storetype jks -alias me -dname CN=Me \
-	-storepass pass1111 -keypass pass1111 || exit 11
+	-keyalg rsa -storepass pass1111 -keypass pass1111 || exit 11
 
 # Cannot only change storepass
 rm p12 2> /dev/null
@@ -85,7 +85,7 @@
 
 rm jks 2> /dev/null
 $KT -genkeypair -keystore jks -storetype jks -alias me -dname CN=Me \
-	-storepass pass1111 -keypass pass2222 || exit 21
+	-keyalg rsa -storepass pass1111 -keypass pass2222 || exit 21
 
 # Can use old keypass as new storepass so new storepass and keypass are same
 rm p12 2> /dev/null
--- a/jdk/test/sun/security/tools/keytool/readjar.sh	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/sun/security/tools/keytool/readjar.sh	Wed Oct 23 08:32:03 2013 +0800
@@ -46,7 +46,7 @@
 KS=readjar.jks
 rm $KS
 $TESTJAVA${FS}bin${FS}keytool ${TESTTOOLVMOPTS}  -storepass changeit -keypass changeit -keystore $KS \
-        -alias x -dname CN=X -genkeypair
+        -keyalg rsa -alias x -dname CN=X -genkeypair
 $COMPILEJAVA${FS}bin${FS}jar ${TESTTOOLVMOPTS} cvf readjar.jar $KS
 $COMPILEJAVA${FS}bin${FS}jarsigner ${TESTTOOLVMOPTS} -storepass changeit -keystore $KS readjar.jar x
 
--- a/jdk/test/sun/security/tools/keytool/selfissued.sh	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/sun/security/tools/keytool/selfissued.sh	Wed Oct 23 08:32:03 2013 +0800
@@ -45,7 +45,7 @@
 esac
 
 KS=selfsigned.jks
-KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore $KS"
+KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore $KS -keyalg rsa"
 
 rm $KS
 
--- a/jdk/test/sun/security/tools/keytool/trystore.sh	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/sun/security/tools/keytool/trystore.sh	Wed Oct 23 08:32:03 2013 +0800
@@ -43,7 +43,7 @@
 
 rm trystore.jks 2> /dev/null
 
-KEYTOOL="${TESTJAVA}${FS}bin${FS}keytool -storetype jks -keystore trystore.jks"
+KEYTOOL="${TESTJAVA}${FS}bin${FS}keytool -storetype jks -keystore trystore.jks -keyalg rsa"
 $KEYTOOL -genkeypair -alias a -dname CN=A -storepass changeit -keypass changeit
 $KEYTOOL -genkeypair -alias b -dname CN=B -storepass changeit -keypass changeit
 
--- a/jdk/test/sun/security/validator/certreplace.sh	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/sun/security/validator/certreplace.sh	Wed Oct 23 08:32:03 2013 +0800
@@ -48,7 +48,7 @@
 esac
 
 KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit \
-    -keypass changeit -keystore certreplace.jks"
+    -keypass changeit -keystore certreplace.jks -keyalg rsa"
 JAVAC=$COMPILEJAVA${FS}bin${FS}javac
 JAVA=$TESTJAVA${FS}bin${FS}java
 
--- a/jdk/test/sun/security/validator/samedn.sh	Tue Oct 22 19:43:42 2013 -0400
+++ b/jdk/test/sun/security/validator/samedn.sh	Wed Oct 23 08:32:03 2013 +0800
@@ -48,7 +48,7 @@
 esac
 
 KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit \
-    -keypass changeit -keystore samedn.jks"
+    -keypass changeit -keystore samedn.jks -keyalg rsa"
 JAVAC=$COMPILEJAVA${FS}bin${FS}javac
 JAVA=$TESTJAVA${FS}bin${FS}java