From fe71efb327c1c17cc8f93e3dabc94d0a15556bda Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Fri, 4 Sep 2009 14:58:01 +0800 Subject: [PATCH 1/4] 6876328: different names for the same digest algorithms breaks jarsigner Reviewed-by: mullan --- .../classes/sun/security/tools/JarSigner.java | 31 ++++++--- .../sun/security/tools/jarsigner/nameclash.sh | 66 +++++++++++++++++++ 2 files changed, 89 insertions(+), 8 deletions(-) create mode 100644 jdk/test/sun/security/tools/jarsigner/nameclash.sh diff --git a/jdk/src/share/classes/sun/security/tools/JarSigner.java b/jdk/src/share/classes/sun/security/tools/JarSigner.java index fd0797a854d..c62018c99b0 100644 --- a/jdk/src/share/classes/sun/security/tools/JarSigner.java +++ b/jdk/src/share/classes/sun/security/tools/JarSigner.java @@ -1978,20 +1978,35 @@ public class JarSigner { String[] base64Digests = getDigests(ze, zf, digests, encoder); for (int i=0; i A +$JAR cvf $JFILE A + +$JARSIGNER -keystore $KS -storepass changeit $JFILE a -digestalg SHA1 || exit 1 +$JARSIGNER -keystore $KS -storepass changeit $JFILE b -digestalg SHA-1 || exit 2 + +$JARSIGNER -keystore $KS -verify -debug -strict $JFILE || exit 3 + +exit 0 + From 58285b80f7ff0a52daff79200e68eb7f27e6d10d Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Fri, 4 Sep 2009 14:59:20 +0800 Subject: [PATCH 2/4] 6871847: AlgorithmId.get("SHA256withECDSA") not available Reviewed-by: vinnie --- .../sun/security/x509/AlgorithmId.java | 14 ++++++- .../x509/AlgorithmId/SHA256withECDSA.java | 39 +++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 jdk/test/sun/security/x509/AlgorithmId/SHA256withECDSA.java diff --git a/jdk/src/share/classes/sun/security/x509/AlgorithmId.java b/jdk/src/share/classes/sun/security/x509/AlgorithmId.java index 7dea6a14bec..fb6104dbce9 100644 --- a/jdk/src/share/classes/sun/security/x509/AlgorithmId.java +++ b/jdk/src/share/classes/sun/security/x509/AlgorithmId.java @@ -1,5 +1,5 @@ /* - * Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1996-2009 Sun Microsystems, Inc. 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 @@ -531,6 +531,18 @@ public class AlgorithmId implements Serializable, DerEncoder { || name.equalsIgnoreCase("ECDSA")) { return AlgorithmId.sha1WithECDSA_oid; } + if (name.equalsIgnoreCase("SHA224withECDSA")) { + return AlgorithmId.sha224WithECDSA_oid; + } + if (name.equalsIgnoreCase("SHA256withECDSA")) { + return AlgorithmId.sha256WithECDSA_oid; + } + if (name.equalsIgnoreCase("SHA384withECDSA")) { + return AlgorithmId.sha384WithECDSA_oid; + } + if (name.equalsIgnoreCase("SHA512withECDSA")) { + return AlgorithmId.sha512WithECDSA_oid; + } // See if any of the installed providers supply a mapping from // the given algorithm name to an OID string diff --git a/jdk/test/sun/security/x509/AlgorithmId/SHA256withECDSA.java b/jdk/test/sun/security/x509/AlgorithmId/SHA256withECDSA.java new file mode 100644 index 00000000000..a1b81118a57 --- /dev/null +++ b/jdk/test/sun/security/x509/AlgorithmId/SHA256withECDSA.java @@ -0,0 +1,39 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 6871847 + * @summary AlgorithmId.get("SHA256withECDSA") not available + */ + +import sun.security.x509.*; + +public class SHA256withECDSA { + public static void main(String[] args) throws Exception { + AlgorithmId.get("SHA224withECDSA"); + AlgorithmId.get("SHA256withECDSA"); + AlgorithmId.get("SHA384withECDSA"); + AlgorithmId.get("SHA512withECDSA"); + } +} From f8db2dee43ecc4ba84f25c4579ade1168fed16d0 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Fri, 4 Sep 2009 13:11:17 -0700 Subject: [PATCH 3/4] 6873951: test/java/lang/reflect/Generics/Probe.java fails Reviewed-by: alanb --- .../java/lang/reflect/Generics/Probe.java | 69 +++++++------------ 1 file changed, 25 insertions(+), 44 deletions(-) diff --git a/jdk/test/java/lang/reflect/Generics/Probe.java b/jdk/test/java/lang/reflect/Generics/Probe.java index 30d6f21e5a3..4d92aa884ad 100644 --- a/jdk/test/java/lang/reflect/Generics/Probe.java +++ b/jdk/test/java/lang/reflect/Generics/Probe.java @@ -23,11 +23,9 @@ /* * @test - * @bug 5003916 6704655 + * @bug 5003916 6704655 6873951 * @summary Testing parsing of signatures attributes of nested classes * @author Joseph D. Darcy - * @compile -source 1.5 Probe.java - * @run main Probe */ import java.lang.reflect.*; @@ -35,51 +33,35 @@ import java.lang.annotation.*; import java.util.*; import static java.util.Arrays.*; -@Classes(value={ - "java.util.concurrent.FutureTask", - "java.util.concurrent.ConcurrentHashMap$EntryIterator", - "java.util.concurrent.ConcurrentHashMap$KeyIterator", - "java.util.concurrent.ConcurrentHashMap$ValueIterator", - "java.util.AbstractList$ListItr", - "java.util.EnumMap$EntryIterator", - "java.util.EnumMap$KeyIterator", - "java.util.EnumMap$ValueIterator", - "java.util.IdentityHashMap$EntryIterator", - "java.util.IdentityHashMap$KeyIterator", - "java.util.IdentityHashMap$ValueIterator", - "java.util.WeakHashMap$EntryIterator", - "java.util.WeakHashMap$KeyIterator", - "java.util.WeakHashMap$ValueIterator", - "java.util.TreeMap$EntryIterator", - "java.util.TreeMap$KeyIterator", - "java.util.TreeMap$ValueIterator", - "java.util.HashMap$EntryIterator", - "java.util.HashMap$KeyIterator", - "java.util.HashMap$ValueIterator", - "java.util.LinkedHashMap$EntryIterator", - "java.util.LinkedHashMap$KeyIterator", - "java.util.LinkedHashMap$ValueIterator" - }, - sunClasses={ - "javax.crypto.SunJCE_c", - "javax.crypto.SunJCE_e", - "javax.crypto.SunJCE_f", - "javax.crypto.SunJCE_j", - "javax.crypto.SunJCE_k", - "javax.crypto.SunJCE_l" - }) +@Classes({"java.util.concurrent.FutureTask", + "java.util.concurrent.ConcurrentHashMap$EntryIterator", + "java.util.concurrent.ConcurrentHashMap$KeyIterator", + "java.util.concurrent.ConcurrentHashMap$ValueIterator", + "java.util.AbstractList$ListItr", + "java.util.EnumMap$EntryIterator", + "java.util.EnumMap$KeyIterator", + "java.util.EnumMap$ValueIterator", + "java.util.IdentityHashMap$EntryIterator", + "java.util.IdentityHashMap$KeyIterator", + "java.util.IdentityHashMap$ValueIterator", + "java.util.WeakHashMap$EntryIterator", + "java.util.WeakHashMap$KeyIterator", + "java.util.WeakHashMap$ValueIterator", + "java.util.TreeMap$EntryIterator", + "java.util.TreeMap$KeyIterator", + "java.util.TreeMap$ValueIterator", + "java.util.HashMap$EntryIterator", + "java.util.HashMap$KeyIterator", + "java.util.HashMap$ValueIterator", + "java.util.LinkedHashMap$EntryIterator", + "java.util.LinkedHashMap$KeyIterator", + "java.util.LinkedHashMap$ValueIterator"}) public class Probe { - public static void main (String[] args) throws Throwable { + public static void main (String... args) throws Throwable { Classes classesAnnotation = (Probe.class).getAnnotation(Classes.class); List names = new ArrayList(asList(classesAnnotation.value())); - if (System.getProperty("java.runtime.name").startsWith("Java(TM)")) { - // Sun production JDK; test crypto classes too - for(String name: classesAnnotation.sunClasses()) - names.add(name); - } - int errs = 0; for(String name: names) { System.out.println("\nCLASS " + name); @@ -152,5 +134,4 @@ public class Probe { @Retention(RetentionPolicy.RUNTIME) @interface Classes { String [] value(); // list of classes to probe - String [] sunClasses(); // list of Sun-production JDK specific classes to probe } From 86d587f77cf4022981745d72146d54f90c680cd1 Mon Sep 17 00:00:00 2001 From: Martin Buchholz Date: Fri, 4 Sep 2009 13:44:36 -0700 Subject: [PATCH 4/4] 6879368: Remove stray quote in Character javadoc Remove stray quote in Character.valueOf javadoc, using Ulf's \u005CuXXXX technique Reviewed-by: darcy --- jdk/src/share/classes/java/lang/Character.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jdk/src/share/classes/java/lang/Character.java b/jdk/src/share/classes/java/lang/Character.java index 65a3fc40184..bc4284c20df 100644 --- a/jdk/src/share/classes/java/lang/Character.java +++ b/jdk/src/share/classes/java/lang/Character.java @@ -2587,9 +2587,9 @@ class Character extends Object implements java.io.Serializable, ComparableCharacter instance representing c.