Merge
This commit is contained in:
commit
40272426a0
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1996, 2015, Oracle and/or its affiliates. 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
|
||||||
@ -54,6 +54,8 @@ import sun.reflect.Reflection;
|
|||||||
import sun.reflect.ReflectionFactory;
|
import sun.reflect.ReflectionFactory;
|
||||||
import sun.reflect.misc.ReflectUtil;
|
import sun.reflect.misc.ReflectUtil;
|
||||||
|
|
||||||
|
import static java.io.ObjectStreamField.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serialization's descriptor for classes. It contains the name and
|
* Serialization's descriptor for classes. It contains the name and
|
||||||
* serialVersionUID of the class. The ObjectStreamClass for a specific class
|
* serialVersionUID of the class. The ObjectStreamClass for a specific class
|
||||||
@ -1519,61 +1521,14 @@ public class ObjectStreamClass implements Serializable {
|
|||||||
* if class names equal, false otherwise.
|
* if class names equal, false otherwise.
|
||||||
*/
|
*/
|
||||||
private static boolean classNamesEqual(String name1, String name2) {
|
private static boolean classNamesEqual(String name1, String name2) {
|
||||||
name1 = name1.substring(name1.lastIndexOf('.') + 1);
|
int idx1 = name1.lastIndexOf('.') + 1;
|
||||||
name2 = name2.substring(name2.lastIndexOf('.') + 1);
|
int idx2 = name2.lastIndexOf('.') + 1;
|
||||||
return name1.equals(name2);
|
int len1 = name1.length() - idx1;
|
||||||
|
int len2 = name2.length() - idx2;
|
||||||
|
return len1 == len2 &&
|
||||||
|
name1.regionMatches(idx1, name2, idx2, len1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns JVM type signature for given primitive.
|
|
||||||
*/
|
|
||||||
private static String getPrimitiveSignature(Class<?> cl) {
|
|
||||||
if (cl == Integer.TYPE)
|
|
||||||
return "I";
|
|
||||||
else if (cl == Byte.TYPE)
|
|
||||||
return "B";
|
|
||||||
else if (cl == Long.TYPE)
|
|
||||||
return "J";
|
|
||||||
else if (cl == Float.TYPE)
|
|
||||||
return "F";
|
|
||||||
else if (cl == Double.TYPE)
|
|
||||||
return "D";
|
|
||||||
else if (cl == Short.TYPE)
|
|
||||||
return "S";
|
|
||||||
else if (cl == Character.TYPE)
|
|
||||||
return "C";
|
|
||||||
else if (cl == Boolean.TYPE)
|
|
||||||
return "Z";
|
|
||||||
else if (cl == Void.TYPE)
|
|
||||||
return "V";
|
|
||||||
else
|
|
||||||
throw new InternalError();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns JVM type signature for given class.
|
|
||||||
*/
|
|
||||||
static String getClassSignature(Class<?> cl) {
|
|
||||||
if (cl.isPrimitive())
|
|
||||||
return getPrimitiveSignature(cl);
|
|
||||||
else
|
|
||||||
return appendClassSignature(new StringBuilder(), cl).toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static StringBuilder appendClassSignature(StringBuilder sbuf, Class<?> cl) {
|
|
||||||
while (cl.isArray()) {
|
|
||||||
sbuf.append('[');
|
|
||||||
cl = cl.getComponentType();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cl.isPrimitive())
|
|
||||||
sbuf.append(getPrimitiveSignature(cl));
|
|
||||||
else
|
|
||||||
sbuf.append('L').append(cl.getName().replace('.', '/')).append(';');
|
|
||||||
|
|
||||||
return sbuf;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns JVM type signature for given list of parameters and return type.
|
* Returns JVM type signature for given list of parameters and return type.
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1996, 2015, Oracle and/or its affiliates. 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
|
||||||
@ -91,7 +91,7 @@ public class ObjectStreamField
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.unshared = unshared;
|
this.unshared = unshared;
|
||||||
signature = ObjectStreamClass.getClassSignature(type).intern();
|
signature = getClassSignature(type).intern();
|
||||||
field = null;
|
field = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,6 +123,58 @@ public class ObjectStreamField
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns JVM type signature for given primitive.
|
||||||
|
*/
|
||||||
|
private static String getPrimitiveSignature(Class<?> cl) {
|
||||||
|
if (cl == Integer.TYPE)
|
||||||
|
return "I";
|
||||||
|
else if (cl == Byte.TYPE)
|
||||||
|
return "B";
|
||||||
|
else if (cl == Long.TYPE)
|
||||||
|
return "J";
|
||||||
|
else if (cl == Float.TYPE)
|
||||||
|
return "F";
|
||||||
|
else if (cl == Double.TYPE)
|
||||||
|
return "D";
|
||||||
|
else if (cl == Short.TYPE)
|
||||||
|
return "S";
|
||||||
|
else if (cl == Character.TYPE)
|
||||||
|
return "C";
|
||||||
|
else if (cl == Boolean.TYPE)
|
||||||
|
return "Z";
|
||||||
|
else if (cl == Void.TYPE)
|
||||||
|
return "V";
|
||||||
|
else
|
||||||
|
throw new InternalError();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns JVM type signature for given class.
|
||||||
|
*/
|
||||||
|
static String getClassSignature(Class<?> cl) {
|
||||||
|
if (cl.isPrimitive()) {
|
||||||
|
return getPrimitiveSignature(cl);
|
||||||
|
} else {
|
||||||
|
return appendClassSignature(new StringBuilder(), cl).toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static StringBuilder appendClassSignature(StringBuilder sbuf, Class<?> cl) {
|
||||||
|
while (cl.isArray()) {
|
||||||
|
sbuf.append('[');
|
||||||
|
cl = cl.getComponentType();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cl.isPrimitive()) {
|
||||||
|
sbuf.append(getPrimitiveSignature(cl));
|
||||||
|
} else {
|
||||||
|
sbuf.append('L').append(cl.getName().replace('.', '/')).append(';');
|
||||||
|
}
|
||||||
|
|
||||||
|
return sbuf;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an ObjectStreamField representing the given field with the
|
* Creates an ObjectStreamField representing the given field with the
|
||||||
* specified unshared setting. For compatibility with the behavior of
|
* specified unshared setting. For compatibility with the behavior of
|
||||||
@ -137,7 +189,7 @@ public class ObjectStreamField
|
|||||||
name = field.getName();
|
name = field.getName();
|
||||||
Class<?> ftype = field.getType();
|
Class<?> ftype = field.getType();
|
||||||
type = (showType || ftype.isPrimitive()) ? ftype : Object.class;
|
type = (showType || ftype.isPrimitive()) ? ftype : Object.class;
|
||||||
signature = ObjectStreamClass.getClassSignature(ftype).intern();
|
signature = getClassSignature(ftype).intern();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1415,8 +1415,8 @@ final class ServerHandshaker extends Handshaker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// need EC cert signed using EC
|
// need EC cert
|
||||||
if (setupPrivateKeyAndChain("EC_EC") == false) {
|
if (setupPrivateKeyAndChain("EC") == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (setupEphemeralECDHKeys() == false) {
|
if (setupEphemeralECDHKeys() == false) {
|
||||||
@ -1424,15 +1424,15 @@ final class ServerHandshaker extends Handshaker {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case K_ECDH_RSA:
|
case K_ECDH_RSA:
|
||||||
// need EC cert signed using RSA
|
// need EC cert
|
||||||
if (setupPrivateKeyAndChain("EC_RSA") == false) {
|
if (setupPrivateKeyAndChain("EC") == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
setupStaticECDHKeys();
|
setupStaticECDHKeys();
|
||||||
break;
|
break;
|
||||||
case K_ECDH_ECDSA:
|
case K_ECDH_ECDSA:
|
||||||
// need EC cert signed using EC
|
// need EC cert
|
||||||
if (setupPrivateKeyAndChain("EC_EC") == false) {
|
if (setupPrivateKeyAndChain("EC") == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
setupStaticECDHKeys();
|
setupStaticECDHKeys();
|
||||||
|
@ -173,6 +173,7 @@ jdk_security3 = \
|
|||||||
com/sun/security \
|
com/sun/security \
|
||||||
-com/sun/security/jgss \
|
-com/sun/security/jgss \
|
||||||
com/sun/org/apache/xml/internal/security \
|
com/sun/org/apache/xml/internal/security \
|
||||||
|
jdk/security \
|
||||||
sun/security \
|
sun/security \
|
||||||
-sun/security/krb5 \
|
-sun/security/krb5 \
|
||||||
-sun/security/jgss \
|
-sun/security/jgss \
|
||||||
@ -453,6 +454,7 @@ needs_jdk = \
|
|||||||
:jdk_jdi \
|
:jdk_jdi \
|
||||||
com/sun/tools \
|
com/sun/tools \
|
||||||
demo \
|
demo \
|
||||||
|
jdk/security/jarsigner \
|
||||||
sun/security/tools/jarsigner \
|
sun/security/tools/jarsigner \
|
||||||
sun/security/tools/policytool \
|
sun/security/tools/policytool \
|
||||||
sun/rmi/rmic \
|
sun/rmi/rmic \
|
||||||
|
@ -71,13 +71,17 @@ public class Function {
|
|||||||
" -keypass changeit -dname" +
|
" -keypass changeit -dname" +
|
||||||
" CN=RSA -alias r -genkeypair -keyalg rsa").split(" "));
|
" CN=RSA -alias r -genkeypair -keyalg rsa").split(" "));
|
||||||
|
|
||||||
KeyStore ks = KeyStore.getInstance("JKS");
|
JarSigner.Builder jsb;
|
||||||
ks.load(new FileInputStream("ks"), "changeit".toCharArray());
|
|
||||||
PrivateKey key = (PrivateKey)ks.getKey("r", "changeit".toCharArray());
|
try (FileInputStream fis = new FileInputStream("ks")) {
|
||||||
Certificate cert = ks.getCertificate("r");
|
KeyStore ks = KeyStore.getInstance("JKS");
|
||||||
JarSigner.Builder jsb = new JarSigner.Builder(key,
|
ks.load(fis, "changeit".toCharArray());
|
||||||
CertificateFactory.getInstance("X.509").generateCertPath(
|
PrivateKey key = (PrivateKey)ks.getKey("r", "changeit".toCharArray());
|
||||||
Collections.singletonList(cert)));
|
Certificate cert = ks.getCertificate("r");
|
||||||
|
jsb = new JarSigner.Builder(key,
|
||||||
|
CertificateFactory.getInstance("X.509").generateCertPath(
|
||||||
|
Collections.singletonList(cert)));
|
||||||
|
}
|
||||||
|
|
||||||
jsb.digestAlgorithm("SHA1");
|
jsb.digestAlgorithm("SHA1");
|
||||||
jsb.signatureAlgorithm("SHA1withRSA");
|
jsb.signatureAlgorithm("SHA1withRSA");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user