Merge
This commit is contained in:
commit
2528789489
@ -2587,9 +2587,9 @@ class Character extends Object implements java.io.Serializable, Comparable<Chara
|
|||||||
* significantly better space and time performance by caching
|
* significantly better space and time performance by caching
|
||||||
* frequently requested values.
|
* frequently requested values.
|
||||||
*
|
*
|
||||||
* This method will always cache values in the range '\u0000'
|
* This method will always cache values in the range {@code
|
||||||
* to '\u007f'", inclusive, and may cache other values outside
|
* '\u005Cu0000'} to {@code '\u005Cu007f'}, inclusive, and may
|
||||||
* of this range.
|
* cache other values outside of this range.
|
||||||
*
|
*
|
||||||
* @param c a char value.
|
* @param c a char value.
|
||||||
* @return a <tt>Character</tt> instance representing <tt>c</tt>.
|
* @return a <tt>Character</tt> instance representing <tt>c</tt>.
|
||||||
|
@ -1978,20 +1978,35 @@ public class JarSigner {
|
|||||||
String[] base64Digests = getDigests(ze, zf, digests, encoder);
|
String[] base64Digests = getDigests(ze, zf, digests, encoder);
|
||||||
|
|
||||||
for (int i=0; i<digests.length; i++) {
|
for (int i=0; i<digests.length; i++) {
|
||||||
String name = digests[i].getAlgorithm()+"-Digest";
|
// The entry name to be written into attrs
|
||||||
String mfDigest = attrs.getValue(name);
|
String name = null;
|
||||||
if (mfDigest == null
|
try {
|
||||||
&& digests[i].getAlgorithm().equalsIgnoreCase("SHA")) {
|
// Find if the digest already exists
|
||||||
// treat "SHA" and "SHA1" the same
|
AlgorithmId aid = AlgorithmId.get(digests[i].getAlgorithm());
|
||||||
mfDigest = attrs.getValue("SHA-Digest");
|
for (Object key: attrs.keySet()) {
|
||||||
|
if (key instanceof Attributes.Name) {
|
||||||
|
String n = ((Attributes.Name)key).toString();
|
||||||
|
if (n.toUpperCase(Locale.ENGLISH).endsWith("-DIGEST")) {
|
||||||
|
String tmp = n.substring(0, n.length() - 7);
|
||||||
|
if (AlgorithmId.get(tmp).equals(aid)) {
|
||||||
|
name = n;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (mfDigest == null) {
|
}
|
||||||
// compute digest and add it to list of attributes
|
}
|
||||||
|
}
|
||||||
|
} catch (NoSuchAlgorithmException nsae) {
|
||||||
|
// Ignored. Writing new digest entry.
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name == null) {
|
||||||
|
name = digests[i].getAlgorithm()+"-Digest";
|
||||||
attrs.putValue(name, base64Digests[i]);
|
attrs.putValue(name, base64Digests[i]);
|
||||||
update=true;
|
update=true;
|
||||||
} else {
|
} else {
|
||||||
// compare digests, and replace the one in the manifest
|
// compare digests, and replace the one in the manifest
|
||||||
// if they are different
|
// if they are different
|
||||||
|
String mfDigest = attrs.getValue(name);
|
||||||
if (!mfDigest.equalsIgnoreCase(base64Digests[i])) {
|
if (!mfDigest.equalsIgnoreCase(base64Digests[i])) {
|
||||||
attrs.putValue(name, base64Digests[i]);
|
attrs.putValue(name, base64Digests[i]);
|
||||||
update=true;
|
update=true;
|
||||||
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* 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")) {
|
|| name.equalsIgnoreCase("ECDSA")) {
|
||||||
return AlgorithmId.sha1WithECDSA_oid;
|
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
|
// See if any of the installed providers supply a mapping from
|
||||||
// the given algorithm name to an OID string
|
// the given algorithm name to an OID string
|
||||||
|
@ -23,11 +23,9 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 5003916 6704655
|
* @bug 5003916 6704655 6873951
|
||||||
* @summary Testing parsing of signatures attributes of nested classes
|
* @summary Testing parsing of signatures attributes of nested classes
|
||||||
* @author Joseph D. Darcy
|
* @author Joseph D. Darcy
|
||||||
* @compile -source 1.5 Probe.java
|
|
||||||
* @run main Probe
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.lang.reflect.*;
|
import java.lang.reflect.*;
|
||||||
@ -35,8 +33,7 @@ import java.lang.annotation.*;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import static java.util.Arrays.*;
|
import static java.util.Arrays.*;
|
||||||
|
|
||||||
@Classes(value={
|
@Classes({"java.util.concurrent.FutureTask",
|
||||||
"java.util.concurrent.FutureTask",
|
|
||||||
"java.util.concurrent.ConcurrentHashMap$EntryIterator",
|
"java.util.concurrent.ConcurrentHashMap$EntryIterator",
|
||||||
"java.util.concurrent.ConcurrentHashMap$KeyIterator",
|
"java.util.concurrent.ConcurrentHashMap$KeyIterator",
|
||||||
"java.util.concurrent.ConcurrentHashMap$ValueIterator",
|
"java.util.concurrent.ConcurrentHashMap$ValueIterator",
|
||||||
@ -58,28 +55,13 @@ import static java.util.Arrays.*;
|
|||||||
"java.util.HashMap$ValueIterator",
|
"java.util.HashMap$ValueIterator",
|
||||||
"java.util.LinkedHashMap$EntryIterator",
|
"java.util.LinkedHashMap$EntryIterator",
|
||||||
"java.util.LinkedHashMap$KeyIterator",
|
"java.util.LinkedHashMap$KeyIterator",
|
||||||
"java.util.LinkedHashMap$ValueIterator"
|
"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"
|
|
||||||
})
|
|
||||||
public class Probe {
|
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);
|
Classes classesAnnotation = (Probe.class).getAnnotation(Classes.class);
|
||||||
List<String> names =
|
List<String> names =
|
||||||
new ArrayList<String>(asList(classesAnnotation.value()));
|
new ArrayList<String>(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;
|
int errs = 0;
|
||||||
for(String name: names) {
|
for(String name: names) {
|
||||||
System.out.println("\nCLASS " + name);
|
System.out.println("\nCLASS " + name);
|
||||||
@ -152,5 +134,4 @@ public class Probe {
|
|||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@interface Classes {
|
@interface Classes {
|
||||||
String [] value(); // list of classes to probe
|
String [] value(); // list of classes to probe
|
||||||
String [] sunClasses(); // list of Sun-production JDK specific classes to probe
|
|
||||||
}
|
}
|
||||||
|
66
jdk/test/sun/security/tools/jarsigner/nameclash.sh
Normal file
66
jdk/test/sun/security/tools/jarsigner/nameclash.sh
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
#
|
||||||
|
# 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 6876328
|
||||||
|
# @summary different names for the same digest algorithms breaks jarsigner
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ "${TESTJAVA}" = "" ] ; then
|
||||||
|
JAVAC_CMD=`which javac`
|
||||||
|
TESTJAVA=`dirname $JAVAC_CMD`/..
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set platform-dependent variables
|
||||||
|
OS=`uname -s`
|
||||||
|
case "$OS" in
|
||||||
|
Windows_* )
|
||||||
|
FS="\\"
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
FS="/"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
KS=nc.jks
|
||||||
|
JFILE=nc.jar
|
||||||
|
|
||||||
|
KT="$TESTJAVA${FS}bin${FS}keytool -storepass changeit -keypass changeit -keystore $KS"
|
||||||
|
JAR=$TESTJAVA${FS}bin${FS}jar
|
||||||
|
JARSIGNER=$TESTJAVA${FS}bin${FS}jarsigner
|
||||||
|
|
||||||
|
rm $KS $JFILE
|
||||||
|
|
||||||
|
$KT -alias a -dname CN=a -keyalg rsa -genkey -validity 300
|
||||||
|
$KT -alias b -dname CN=b -keyalg rsa -genkey -validity 300
|
||||||
|
|
||||||
|
echo A > 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
|
||||||
|
|
39
jdk/test/sun/security/x509/AlgorithmId/SHA256withECDSA.java
Normal file
39
jdk/test/sun/security/x509/AlgorithmId/SHA256withECDSA.java
Normal file
@ -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");
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user