declaringClass,
- Class[] parameterTypes,
- Class[] checkedExceptions,
+ Class>[] parameterTypes,
+ Class>[] checkedExceptions,
int modifiers,
int slot,
String signature,
@@ -275,10 +275,6 @@
* Returns an array of length 0 if the underlying method declares
* no exceptions in its {@code throws} clause.
*
- * If an exception type is a parameterized type, the {@code Type}
- * object returned for it must accurately reflect the actual type
- * parameters used in the source code.
- *
*
If an exception type is a type variable or a parameterized
* type, it is created. Otherwise, it is resolved.
*
@@ -311,11 +307,11 @@
*/
public boolean equals(Object obj) {
if (obj != null && obj instanceof Constructor) {
- Constructor other = (Constructor)obj;
+ Constructor> other = (Constructor>)obj;
if (getDeclaringClass() == other.getDeclaringClass()) {
/* Avoid unnecessary cloning */
- Class[] params1 = parameterTypes;
- Class[] params2 = other.parameterTypes;
+ Class>[] params1 = parameterTypes;
+ Class>[] params2 = other.parameterTypes;
if (params1.length == params2.length) {
for (int i = 0; i < params1.length; i++) {
if (params1[i] != params2[i])
@@ -361,14 +357,14 @@
}
sb.append(Field.getTypeName(getDeclaringClass()));
sb.append("(");
- Class[] params = parameterTypes; // avoid clone
+ Class>[] params = parameterTypes; // avoid clone
for (int j = 0; j < params.length; j++) {
sb.append(Field.getTypeName(params[j]));
if (j < (params.length - 1))
sb.append(",");
}
sb.append(")");
- Class[] exceptions = exceptionTypes; // avoid clone
+ Class>[] exceptions = exceptionTypes; // avoid clone
if (exceptions.length > 0) {
sb.append(" throws ");
for (int k = 0; k < exceptions.length; k++) {
@@ -456,7 +452,7 @@
sb.append(" throws ");
for (int k = 0; k < exceptions.length; k++) {
sb.append((exceptions[k] instanceof Class)?
- ((Class)exceptions[k]).getName():
+ ((Class>)exceptions[k]).getName():
exceptions[k].toString());
if (k < (exceptions.length - 1))
sb.append(",");
@@ -522,7 +518,7 @@
{
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
- Class caller = Reflection.getCallerClass(2);
+ Class> caller = Reflection.getCallerClass(2);
if (securityCheckCache != caller) {
Reflection.ensureMemberAccess(caller, clazz, null, modifiers);
securityCheckCache = caller;
@@ -629,9 +625,9 @@
return AnnotationParser.toArray(declaredAnnotations());
}
- private transient Map declaredAnnotations;
+ private transient Map, Annotation> declaredAnnotations;
- private synchronized Map declaredAnnotations() {
+ private synchronized Map, Annotation> declaredAnnotations() {
if (declaredAnnotations == null) {
declaredAnnotations = AnnotationParser.parseAnnotations(
annotations, sun.misc.SharedSecrets.getJavaLangAccess().
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/java/lang/reflect/Field.java
--- a/jdk/src/share/classes/java/lang/reflect/Field.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Field.java Wed Oct 07 14:15:01 2009 -0700
@@ -58,12 +58,12 @@
public final
class Field extends AccessibleObject implements Member {
- private Class clazz;
+ private Class> clazz;
private int slot;
// This is guaranteed to be interned by the VM in the 1.4
// reflection implementation
private String name;
- private Class type;
+ private Class> type;
private int modifiers;
// Generics and annotations support
private transient String signature;
@@ -81,8 +81,8 @@
// More complicated security check cache needed here than for
// Class.newInstance() and Constructor.newInstance()
- private Class securityCheckCache;
- private Class securityCheckTargetClassCache;
+ private Class> securityCheckCache;
+ private Class> securityCheckTargetClassCache;
// Generics infrastructure
@@ -112,9 +112,9 @@
* instantiation of these objects in Java code from the java.lang
* package via sun.reflect.LangReflectAccess.
*/
- Field(Class declaringClass,
+ Field(Class> declaringClass,
String name,
- Class type,
+ Class> type,
int modifiers,
int slot,
String signature,
@@ -964,10 +964,10 @@
private void doSecurityCheck(Object obj) throws IllegalAccessException {
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
- Class caller = Reflection.getCallerClass(4);
- Class targetClass = ((obj == null || !Modifier.isProtected(modifiers))
- ? clazz
- : obj.getClass());
+ Class> caller = Reflection.getCallerClass(4);
+ Class> targetClass = ((obj == null || !Modifier.isProtected(modifiers))
+ ? clazz
+ : obj.getClass());
synchronized (this) {
if ((securityCheckCache == caller)
@@ -987,10 +987,10 @@
/*
* Utility routine to paper over array type names
*/
- static String getTypeName(Class type) {
+ static String getTypeName(Class> type) {
if (type.isArray()) {
try {
- Class cl = type;
+ Class> cl = type;
int dimensions = 0;
while (cl.isArray()) {
dimensions++;
@@ -1025,9 +1025,9 @@
return AnnotationParser.toArray(declaredAnnotations());
}
- private transient Map declaredAnnotations;
+ private transient Map, Annotation> declaredAnnotations;
- private synchronized Map declaredAnnotations() {
+ private synchronized Map, Annotation> declaredAnnotations() {
if (declaredAnnotations == null) {
declaredAnnotations = AnnotationParser.parseAnnotations(
annotations, sun.misc.SharedSecrets.getJavaLangAccess().
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/java/lang/reflect/Method.java
--- a/jdk/src/share/classes/java/lang/reflect/Method.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Method.java Wed Oct 07 14:15:01 2009 -0700
@@ -61,14 +61,14 @@
public final
class Method extends AccessibleObject implements GenericDeclaration,
Member {
- private Class clazz;
+ private Class> clazz;
private int slot;
// This is guaranteed to be interned by the VM in the 1.4
// reflection implementation
private String name;
- private Class returnType;
- private Class[] parameterTypes;
- private Class[] exceptionTypes;
+ private Class> returnType;
+ private Class>[] parameterTypes;
+ private Class>[] exceptionTypes;
private int modifiers;
// Generics and annotations support
private transient String signature;
@@ -85,8 +85,8 @@
// More complicated security check cache needed here than for
// Class.newInstance() and Constructor.newInstance()
- private Class securityCheckCache;
- private Class securityCheckTargetClassCache;
+ private Class> securityCheckCache;
+ private Class> securityCheckTargetClassCache;
// Generics infrastructure
@@ -114,11 +114,11 @@
* instantiation of these objects in Java code from the java.lang
* package via sun.reflect.LangReflectAccess.
*/
- Method(Class declaringClass,
+ Method(Class> declaringClass,
String name,
- Class[] parameterTypes,
- Class returnType,
- Class[] checkedExceptions,
+ Class>[] parameterTypes,
+ Class> returnType,
+ Class>[] checkedExceptions,
int modifiers,
int slot,
String signature,
@@ -317,10 +317,6 @@
* Returns an array of length 0 if the underlying method declares
* no exceptions in its {@code throws} clause.
*
- * If an exception type is a parameterized type, the {@code Type}
- * object returned for it must accurately reflect the actual type
- * parameters used in the source code.
- *
*
If an exception type is a type variable or a parameterized
* type, it is created. Otherwise, it is resolved.
*
@@ -359,8 +355,8 @@
if (!returnType.equals(other.getReturnType()))
return false;
/* Avoid unnecessary cloning */
- Class[] params1 = parameterTypes;
- Class[] params2 = other.parameterTypes;
+ Class>[] params1 = parameterTypes;
+ Class>[] params2 = other.parameterTypes;
if (params1.length == params2.length) {
for (int i = 0; i < params1.length; i++) {
if (params1[i] != params2[i])
@@ -414,14 +410,14 @@
sb.append(Field.getTypeName(getReturnType()) + " ");
sb.append(Field.getTypeName(getDeclaringClass()) + ".");
sb.append(getName() + "(");
- Class[] params = parameterTypes; // avoid clone
+ Class>[] params = parameterTypes; // avoid clone
for (int j = 0; j < params.length; j++) {
sb.append(Field.getTypeName(params[j]));
if (j < (params.length - 1))
sb.append(",");
}
sb.append(")");
- Class[] exceptions = exceptionTypes; // avoid clone
+ Class>[] exceptions = exceptionTypes; // avoid clone
if (exceptions.length > 0) {
sb.append(" throws ");
for (int k = 0; k < exceptions.length; k++) {
@@ -594,10 +590,10 @@
{
if (!override) {
if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
- Class caller = Reflection.getCallerClass(1);
- Class targetClass = ((obj == null || !Modifier.isProtected(modifiers))
- ? clazz
- : obj.getClass());
+ Class> caller = Reflection.getCallerClass(1);
+ Class> targetClass = ((obj == null || !Modifier.isProtected(modifiers))
+ ? clazz
+ : obj.getClass());
boolean cached;
synchronized (this) {
@@ -706,9 +702,9 @@
return AnnotationParser.toArray(declaredAnnotations());
}
- private transient Map declaredAnnotations;
+ private transient Map, Annotation> declaredAnnotations;
- private synchronized Map declaredAnnotations() {
+ private synchronized Map, Annotation> declaredAnnotations() {
if (declaredAnnotations == null) {
declaredAnnotations = AnnotationParser.parseAnnotations(
annotations, sun.misc.SharedSecrets.getJavaLangAccess().
@@ -735,7 +731,7 @@
public Object getDefaultValue() {
if (annotationDefault == null)
return null;
- Class memberType = AnnotationType.invocationHandlerReturnType(
+ Class> memberType = AnnotationType.invocationHandlerReturnType(
getReturnType());
Object result = AnnotationParser.parseMemberValue(
memberType, ByteBuffer.wrap(annotationDefault),
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/java/lang/reflect/Proxy.java
--- a/jdk/src/share/classes/java/lang/reflect/Proxy.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/Proxy.java Wed Oct 07 14:15:01 2009 -0700
@@ -350,7 +350,7 @@
throw new IllegalArgumentException("interface limit exceeded");
}
- Class proxyClass = null;
+ Class> proxyClass = null;
/* collect interface names to use as key for proxy class cache */
String[] interfaceNames = new String[interfaces.length];
@@ -364,7 +364,7 @@
* interface to the same Class object.
*/
String interfaceName = interfaces[i].getName();
- Class interfaceClass = null;
+ Class> interfaceClass = null;
try {
interfaceClass = Class.forName(interfaceName, false, loader);
} catch (ClassNotFoundException e) {
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/java/lang/reflect/ReflectAccess.java
--- a/jdk/src/share/classes/java/lang/reflect/ReflectAccess.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/java/lang/reflect/ReflectAccess.java Wed Oct 07 14:15:01 2009 -0700
@@ -33,9 +33,9 @@
package to instantiate objects in this package. */
class ReflectAccess implements sun.reflect.LangReflectAccess {
- public Field newField(Class declaringClass,
+ public Field newField(Class> declaringClass,
String name,
- Class type,
+ Class> type,
int modifiers,
int slot,
String signature,
@@ -50,11 +50,11 @@
annotations);
}
- public Method newMethod(Class declaringClass,
+ public Method newMethod(Class> declaringClass,
String name,
- Class[] parameterTypes,
- Class returnType,
- Class[] checkedExceptions,
+ Class>[] parameterTypes,
+ Class> returnType,
+ Class>[] checkedExceptions,
int modifiers,
int slot,
String signature,
@@ -76,8 +76,8 @@
}
public Constructor newConstructor(Class declaringClass,
- Class[] parameterTypes,
- Class[] checkedExceptions,
+ Class>[] parameterTypes,
+ Class>[] checkedExceptions,
int modifiers,
int slot,
String signature,
@@ -102,29 +102,29 @@
m.setMethodAccessor(accessor);
}
- public ConstructorAccessor getConstructorAccessor(Constructor c) {
+ public ConstructorAccessor getConstructorAccessor(Constructor> c) {
return c.getConstructorAccessor();
}
- public void setConstructorAccessor(Constructor c,
+ public void setConstructorAccessor(Constructor> c,
ConstructorAccessor accessor)
{
c.setConstructorAccessor(accessor);
}
- public int getConstructorSlot(Constructor c) {
+ public int getConstructorSlot(Constructor> c) {
return c.getSlot();
}
- public String getConstructorSignature(Constructor c) {
+ public String getConstructorSignature(Constructor> c) {
return c.getSignature();
}
- public byte[] getConstructorAnnotations(Constructor c) {
+ public byte[] getConstructorAnnotations(Constructor> c) {
return c.getRawAnnotations();
}
- public byte[] getConstructorParameterAnnotations(Constructor c) {
+ public byte[] getConstructorParameterAnnotations(Constructor> c) {
return c.getRawParameterAnnotations();
}
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/java/util/zip/ZipEntry.java
--- a/jdk/src/share/classes/java/util/zip/ZipEntry.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/java/util/zip/ZipEntry.java Wed Oct 07 14:15:01 2009 -0700
@@ -26,6 +26,7 @@
package java.util.zip;
import java.util.Date;
+import sun.misc.BootClassLoaderHook;
/**
* This class is used to represent a ZIP file entry.
@@ -109,12 +110,16 @@
* @see #getTime()
*/
public void setTime(long time) {
- // fix for bug 6625963: we bypass time calculations while Kernel is
- // downloading bundles, since they aren't necessary and would cause
- // the Kernel core to depend upon the (very large) time zone data
- if (sun.misc.VM.isBootedKernelVM() &&
- sun.jkernel.DownloadManager.isCurrentThreadDownloading()) {
- this.time = sun.jkernel.DownloadManager.KERNEL_STATIC_MODTIME;
+ // Same value as defined in sun.jkernel.DownloadManager.KERNEL_STATIC_MODTIME
+ // to avoid direct reference to DownoadManager class. Need to revisit
+ // if this is needed any more (see comment in the DownloadManager class)
+ final int KERNEL_STATIC_MODTIME = 10000000;
+ BootClassLoaderHook hook = BootClassLoaderHook.getHook();
+ if (hook != null && hook.isCurrentThreadPrefetching()) {
+ // fix for bug 6625963: we bypass time calculations while Kernel is
+ // downloading bundles, since they aren't necessary and would cause
+ // the Kernel core to depend upon the (very large) time zone data
+ this.time = KERNEL_STATIC_MODTIME;
} else {
this.time = javaToDosTime(time);
}
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/javax/swing/JPopupMenu.java
--- a/jdk/src/share/classes/javax/swing/JPopupMenu.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/javax/swing/JPopupMenu.java Wed Oct 07 14:15:01 2009 -0700
@@ -412,7 +412,7 @@
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(
- SecurityConstants.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION);
+ SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION);
}
} catch (SecurityException se) {
// There is no permission to show popups over the task bar
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/sun/awt/AWTPermissionFactory.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/awt/AWTPermissionFactory.java Wed Oct 07 14:15:01 2009 -0700
@@ -0,0 +1,42 @@
+/*
+ * 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. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package sun.awt;
+
+import java.awt.AWTPermission;
+import sun.security.util.PermissionFactory;
+
+/**
+ * A factory object for AWTPermission objects.
+ */
+
+public class AWTPermissionFactory
+ implements PermissionFactory
+{
+ @Override
+ public AWTPermission newPermission(String name) {
+ return new AWTPermission(name);
+ }
+}
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/sun/jkernel/DownloadManager.java
--- a/jdk/src/share/classes/sun/jkernel/DownloadManager.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/sun/jkernel/DownloadManager.java Wed Oct 07 14:15:01 2009 -0700
@@ -31,6 +31,7 @@
import java.util.jar.*;
import java.util.zip.*;
import sun.misc.Launcher;
+import sun.misc.BootClassLoaderHook;
/**
* Handles the downloading of additional JRE components. The bootstrap class
@@ -39,7 +40,7 @@
*
*@author Ethan Nicholas
*/
-public class DownloadManager {
+public class DownloadManager extends BootClassLoaderHook {
public static final String KERNEL_DOWNLOAD_URL_PROPERTY =
"kernel.download.url";
public static final String KERNEL_DOWNLOAD_ENABLED_PROPERTY =
@@ -1023,7 +1024,8 @@
/**
* Returns true
if the current thread is in the process of
- * downloading a bundle. This is called by ClassLoader.loadLibrary(), so
+ * downloading a bundle. This is called by DownloadManager.loadLibrary()
+ * that is called by System.loadLibrary(), so
* that when we run into a library required by the download process itself,
* we don't call back into DownloadManager in an attempt to download it
* (which would lead to infinite recursion).
@@ -1614,6 +1616,77 @@
static native int getCurrentProcessId();
+ private DownloadManager() {
+ }
+
+ // Invoked by jkernel VM after the VM is initialized
+ static void setBootClassLoaderHook() {
+ if (!isJREComplete()) {
+ sun.misc.BootClassLoaderHook.setHook(new DownloadManager());
+ }
+ }
+
+ // Implementation of the BootClassLoaderHook interface
+ public String loadBootstrapClass(String name) {
+ // Check for download before we look for it. If
+ // DownloadManager ends up downloading it, it will add it to
+ // our search path before we proceed to the findClass().
+ return DownloadManager.getBootClassPathEntryForClass(name);
+ }
+
+ public boolean loadLibrary(String name) {
+ try {
+ if (!DownloadManager.isJREComplete() &&
+ !DownloadManager.isCurrentThreadDownloading()) {
+ return DownloadManager.downloadFile("bin/" +
+ System.mapLibraryName(name));
+ // it doesn't matter if the downloadFile call returns false --
+ // it probably just means that this is a user library, as
+ // opposed to a JRE library
+ }
+ } catch (IOException e) {
+ throw new UnsatisfiedLinkError("Error downloading library " +
+ name + ": " + e);
+ } catch (NoClassDefFoundError e) {
+ // This happens while Java itself is being compiled; DownloadManager
+ // isn't accessible when this code is first invoked. It isn't an
+ // issue, as if we can't find DownloadManager, we can safely assume
+ // that additional code is not available for download.
+ }
+ return false;
+ }
+
+ public boolean prefetchFile(String name) {
+ try {
+ return sun.jkernel.DownloadManager.downloadFile(name);
+ } catch (IOException ioe) {
+ return false;
+ }
+ }
+
+ public String getBootstrapResource(String name) {
+ try {
+ // If this is a known JRE resource, ensure that its bundle is
+ // downloaded. If it isn't known, we just ignore the download
+ // failure and check to see if we can find the resource anyway
+ // (which is possible if the boot class path has been modified).
+ return DownloadManager.getBootClassPathEntryForResource(name);
+ } catch (NoClassDefFoundError e) {
+ // This happens while Java itself is being compiled; DownloadManager
+ // isn't accessible when this code is first invoked. It isn't an
+ // issue, as if we can't find DownloadManager, we can safely assume
+ // that additional code is not available for download.
+ return null;
+ }
+ }
+
+ public File[] getAdditionalBootstrapPaths() {
+ return DownloadManager.getAdditionalBootStrapPaths();
+ }
+
+ public boolean isCurrentThreadPrefetching() {
+ return DownloadManager.isCurrentThreadDownloading();
+ }
public static void main(String[] arg) throws Exception {
AccessController.checkPermission(new AllPermission());
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/sun/misc/BootClassLoaderHook.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/misc/BootClassLoaderHook.java Wed Oct 07 14:15:01 2009 -0700
@@ -0,0 +1,153 @@
+/*
+ * 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. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package sun.misc;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * BootClassLoaderHook defines an interface for a hook to inject
+ * into the bootstrap class loader.
+ *
+ * In jkernel build, the sun.jkernel.DownloadManager is set as
+ * a BootClassLoaderHook by the jkernel VM after the VM is initialized.
+ *
+ * In other JDK builds, no hook is set.
+ */
+public abstract class BootClassLoaderHook {
+ private static BootClassLoaderHook bootLoaderHook = null;
+ public static synchronized BootClassLoaderHook getHook() {
+ return bootLoaderHook;
+ }
+
+ public static synchronized void setHook(BootClassLoaderHook hook) {
+ if (!VM.isBooted()) {
+ throw new InternalError("hook can only be set after VM is booted");
+ }
+ if (bootLoaderHook != null) {
+ throw new InternalError("hook should not be reinitialized");
+ }
+ bootLoaderHook = hook;
+ }
+
+ protected BootClassLoaderHook() {
+ }
+
+ /**
+ * A method to be invoked before a class loader loads
+ * a bootstrap class.
+ *
+ * @param classname the binary name of the class
+ */
+ public static void preLoadClass(String classname) {
+ BootClassLoaderHook hook = getHook();
+ if (hook != null) {
+ hook.loadBootstrapClass(classname);
+ }
+ }
+
+ /**
+ * A method to be invoked before a class loader loads
+ * a resource.
+ *
+ * @param resourcename the resource name
+ */
+ public static void preLoadResource(String resourcename) {
+ BootClassLoaderHook hook = getHook();
+ if (hook != null) {
+ hook.getBootstrapResource(resourcename);
+ }
+ }
+
+ /**
+ * A method to be invoked before a library is loaded.
+ *
+ * @param libname the name of the library
+ */
+ public static void preLoadLibrary(String libname) {
+ BootClassLoaderHook hook = getHook();
+ if (hook != null) {
+ hook.loadLibrary(libname);
+ }
+ }
+
+ private static final File[] EMPTY_FILE_ARRAY = new File[0];
+
+ /**
+ * Returns bootstrap class paths added by the hook.
+ */
+ public static File[] getBootstrapPaths() {
+ BootClassLoaderHook hook = getHook();
+ if (hook != null) {
+ return hook.getAdditionalBootstrapPaths();
+ } else {
+ return EMPTY_FILE_ARRAY;
+ }
+ }
+
+ /**
+ * Returns a pathname of a JAR or class that the hook loads
+ * per this loadClass request; or null.
+ *
+ * @param classname the binary name of the class
+ */
+ public abstract String loadBootstrapClass(String className);
+
+ /**
+ * Returns a pathname of a resource file that the hook loads
+ * per this getResource request; or null.
+ *
+ * @param resourceName the resource name
+ */
+ public abstract String getBootstrapResource(String resourceName);
+
+ /**
+ * Returns true if the hook successfully performs an operation per
+ * this loadLibrary request; or false if it fails.
+ *
+ * @param libname the name of the library
+ */
+ public abstract boolean loadLibrary(String libname);
+
+ /**
+ * Returns additional boot class paths added by the hook that
+ * should be searched by the boot class loader.
+ */
+ public abstract File[] getAdditionalBootstrapPaths();
+
+ /**
+ * Returns true if the current thread is in the process of doing
+ * a prefetching operation.
+ */
+ public abstract boolean isCurrentThreadPrefetching();
+
+ /**
+ * Returns true if the hook successfully prefetches the specified file.
+ *
+ * @param name a platform independent pathname
+ */
+ public abstract boolean prefetchFile(String name);
+}
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/sun/misc/Launcher.java
--- a/jdk/src/share/classes/sun/misc/Launcher.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/sun/misc/Launcher.java Wed Oct 07 14:15:01 2009 -0700
@@ -50,8 +50,6 @@
import sun.security.action.GetPropertyAction;
import sun.security.util.SecurityConstants;
import sun.net.www.ParseUtil;
-import sun.jkernel.Bundle;
-import sun.jkernel.DownloadManager;
/**
* This class is used by the system to launch the main application.
@@ -248,12 +246,7 @@
}
protected Class findClass(String name) throws ClassNotFoundException {
- if (VM.isBootedKernelVM()) {
- // Check for download before we look for it. If
- // DownloadManager ends up downloading it, it will add it to
- // our search path before we proceed to the findClass().
- DownloadManager.getBootClassPathEntryForClass(name);
- }
+ BootClassLoaderHook.preLoadClass(name);
return super.findClass(name);
}
@@ -321,9 +314,7 @@
public Class loadClass(String name, boolean resolve)
throws ClassNotFoundException
{
- if (VM.isBootedKernelVM()) {
- DownloadManager.getBootClassPathEntryForClass(name);
- }
+ BootClassLoaderHook.preLoadClass(name);
int i = name.lastIndexOf('.');
if (i != -1) {
SecurityManager sm = System.getSecurityManager();
@@ -421,19 +412,17 @@
}
bootstrapClassPath = new URLClassPath(urls, factory);
- if (VM.isBootedKernelVM()) {
- final File[] additionalBootStrapPaths =
- DownloadManager.getAdditionalBootStrapPaths();
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- for (int i=0; i Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int)rem;
+ }
+ return 0;
+ }
+
public void close() throws IOException {
ch.close();
}
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/sun/reflect/LangReflectAccess.java
--- a/jdk/src/share/classes/sun/reflect/LangReflectAccess.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/sun/reflect/LangReflectAccess.java Wed Oct 07 14:15:01 2009 -0700
@@ -33,9 +33,9 @@
public interface LangReflectAccess {
/** Creates a new java.lang.reflect.Field. Access checks as per
java.lang.reflect.AccessibleObject are not overridden. */
- public Field newField(Class declaringClass,
+ public Field newField(Class> declaringClass,
String name,
- Class type,
+ Class> type,
int modifiers,
int slot,
String signature,
@@ -43,11 +43,11 @@
/** Creates a new java.lang.reflect.Method. Access checks as per
java.lang.reflect.AccessibleObject are not overridden. */
- public Method newMethod(Class declaringClass,
+ public Method newMethod(Class> declaringClass,
String name,
- Class[] parameterTypes,
- Class returnType,
- Class[] checkedExceptions,
+ Class>[] parameterTypes,
+ Class> returnType,
+ Class>[] checkedExceptions,
int modifiers,
int slot,
String signature,
@@ -58,8 +58,8 @@
/** Creates a new java.lang.reflect.Constructor. Access checks as
per java.lang.reflect.AccessibleObject are not overridden. */
public Constructor newConstructor(Class declaringClass,
- Class[] parameterTypes,
- Class[] checkedExceptions,
+ Class>[] parameterTypes,
+ Class>[] checkedExceptions,
int modifiers,
int slot,
String signature,
@@ -74,24 +74,24 @@
/** Gets the ConstructorAccessor object for a
java.lang.reflect.Constructor */
- public ConstructorAccessor getConstructorAccessor(Constructor c);
+ public ConstructorAccessor getConstructorAccessor(Constructor> c);
/** Sets the ConstructorAccessor object for a
java.lang.reflect.Constructor */
- public void setConstructorAccessor(Constructor c,
+ public void setConstructorAccessor(Constructor> c,
ConstructorAccessor accessor);
/** Gets the "slot" field from a Constructor (used for serialization) */
- public int getConstructorSlot(Constructor c);
+ public int getConstructorSlot(Constructor> c);
/** Gets the "signature" field from a Constructor (used for serialization) */
- public String getConstructorSignature(Constructor c);
+ public String getConstructorSignature(Constructor> c);
/** Gets the "annotations" field from a Constructor (used for serialization) */
- public byte[] getConstructorAnnotations(Constructor c);
+ public byte[] getConstructorAnnotations(Constructor> c);
/** Gets the "parameterAnnotations" field from a Constructor (used for serialization) */
- public byte[] getConstructorParameterAnnotations(Constructor c);
+ public byte[] getConstructorParameterAnnotations(Constructor> c);
//
// Copying routines, needed to quickly fabricate new Field,
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java
--- a/jdk/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java Wed Oct 07 14:15:01 2009 -0700
@@ -40,17 +40,17 @@
* @since 1.5
*/
class AnnotationInvocationHandler implements InvocationHandler, Serializable {
- private final Class type;
+ private final Class extends Annotation> type;
private final Map memberValues;
- AnnotationInvocationHandler(Class type, Map memberValues) {
+ AnnotationInvocationHandler(Class extends Annotation> type, Map memberValues) {
this.type = type;
this.memberValues = memberValues;
}
public Object invoke(Object proxy, Method method, Object[] args) {
String member = method.getName();
- Class[] paramTypes = method.getParameterTypes();
+ Class>[] paramTypes = method.getParameterTypes();
// Handle Object and Annotation methods
if (member.equals("equals") && paramTypes.length == 1 &&
@@ -84,7 +84,7 @@
* if Cloneable had a public clone method.
*/
private Object cloneArray(Object array) {
- Class type = array.getClass();
+ Class> type = array.getClass();
if (type == byte[].class) {
byte[] byteArray = (byte[])array;
@@ -151,7 +151,7 @@
* Translates a member value (in "dynamic proxy return form") into a string
*/
private static String memberValueToString(Object value) {
- Class type = value.getClass();
+ Class> type = value.getClass();
if (!type.isArray()) // primitive, string, class, enum const,
// or annotation
return value.toString();
@@ -229,7 +229,7 @@
* two members are identical object references.
*/
private static boolean memberValueEquals(Object v1, Object v2) {
- Class type = v1.getClass();
+ Class> type = v1.getClass();
// Check for primitive, string, class, enum const, annotation,
// or ExceptionProxy
@@ -301,7 +301,7 @@
* Computes hashCode of a member value (in "dynamic proxy return form")
*/
private static int memberValueHashCode(Object value) {
- Class type = value.getClass();
+ Class> type = value.getClass();
if (!type.isArray()) // primitive, string, class, enum const,
// or annotation
return value.hashCode();
@@ -340,11 +340,11 @@
return;
}
- Map memberTypes = annotationType.memberTypes();
+ Map> memberTypes = annotationType.memberTypes();
for (Map.Entry memberValue : memberValues.entrySet()) {
String name = memberValue.getKey();
- Class memberType = memberTypes.get(name);
+ Class> memberType = memberTypes.get(name);
if (memberType != null) { // i.e. member still exists
Object value = memberValue.getValue();
if (!(memberType.isInstance(value) ||
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java
--- a/jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/sun/reflect/annotation/AnnotationParser.java Wed Oct 07 14:15:01 2009 -0700
@@ -59,10 +59,10 @@
* @throws AnnotationFormatError if an annotation is found to be
* malformed.
*/
- public static Map parseAnnotations(
+ public static Map, Annotation> parseAnnotations(
byte[] rawAnnotations,
ConstantPool constPool,
- Class container) {
+ Class> container) {
if (rawAnnotations == null)
return Collections.emptyMap();
@@ -76,17 +76,18 @@
}
}
- private static Map parseAnnotations2(
+ private static Map, Annotation> parseAnnotations2(
byte[] rawAnnotations,
ConstantPool constPool,
- Class container) {
- Map result = new LinkedHashMap();
+ Class> container) {
+ Map, Annotation> result =
+ new LinkedHashMap, Annotation>();
ByteBuffer buf = ByteBuffer.wrap(rawAnnotations);
int numAnnotations = buf.getShort() & 0xFFFF;
for (int i = 0; i < numAnnotations; i++) {
Annotation a = parseAnnotation(buf, constPool, container, false);
if (a != null) {
- Class klass = a.annotationType();
+ Class extends Annotation> klass = a.annotationType();
AnnotationType type = AnnotationType.getInstance(klass);
if (type.retention() == RetentionPolicy.RUNTIME)
if (result.put(klass, a) != null)
@@ -123,7 +124,7 @@
public static Annotation[][] parseParameterAnnotations(
byte[] rawAnnotations,
ConstantPool constPool,
- Class container) {
+ Class> container) {
try {
return parseParameterAnnotations2(rawAnnotations, constPool, container);
} catch(BufferUnderflowException e) {
@@ -138,7 +139,7 @@
private static Annotation[][] parseParameterAnnotations2(
byte[] rawAnnotations,
ConstantPool constPool,
- Class container) {
+ Class> container) {
ByteBuffer buf = ByteBuffer.wrap(rawAnnotations);
int numParameters = buf.get() & 0xFF;
Annotation[][] result = new Annotation[numParameters][];
@@ -188,15 +189,15 @@
*/
private static Annotation parseAnnotation(ByteBuffer buf,
ConstantPool constPool,
- Class container,
+ Class> container,
boolean exceptionOnMissingAnnotationClass) {
int typeIndex = buf.getShort() & 0xFFFF;
- Class annotationClass = null;
+ Class extends Annotation> annotationClass = null;
String sig = "[unknown]";
try {
try {
sig = constPool.getUTF8At(typeIndex);
- annotationClass = parseSig(sig, container);
+ annotationClass = (Class extends Annotation>)parseSig(sig, container);
} catch (IllegalArgumentException ex) {
// support obsolete early jsr175 format class files
annotationClass = constPool.getClassAt(typeIndex);
@@ -223,7 +224,7 @@
return null;
}
- Map memberTypes = type.memberTypes();
+ Map> memberTypes = type.memberTypes();
Map memberValues =
new LinkedHashMap(type.memberDefaults());
@@ -231,7 +232,7 @@
for (int i = 0; i < numMembers; i++) {
int memberNameIndex = buf.getShort() & 0xFFFF;
String memberName = constPool.getUTF8At(memberNameIndex);
- Class memberType = memberTypes.get(memberName);
+ Class> memberType = memberTypes.get(memberName);
if (memberType == null) {
// Member is no longer present in annotation type; ignore it
@@ -252,7 +253,7 @@
* member -> value map.
*/
public static Annotation annotationForMap(
- Class type, Map memberValues)
+ Class extends Annotation> type, Map memberValues)
{
return (Annotation) Proxy.newProxyInstance(
type.getClassLoader(), new Class[] { type },
@@ -286,14 +287,15 @@
* The member must be of the indicated type. If it is not, this
* method returns an AnnotationTypeMismatchExceptionProxy.
*/
- public static Object parseMemberValue(Class memberType, ByteBuffer buf,
+ public static Object parseMemberValue(Class> memberType,
+ ByteBuffer buf,
ConstantPool constPool,
- Class container) {
+ Class> container) {
Object result = null;
int tag = buf.get();
switch(tag) {
case 'e':
- return parseEnumValue(memberType, buf, constPool, container);
+ return parseEnumValue((Class extends Enum>>)memberType, buf, constPool, container);
case 'c':
result = parseClassValue(buf, constPool, container);
break;
@@ -361,7 +363,7 @@
*/
private static Object parseClassValue(ByteBuffer buf,
ConstantPool constPool,
- Class container) {
+ Class> container) {
int classIndex = buf.getShort() & 0xFFFF;
try {
try {
@@ -379,7 +381,7 @@
}
}
- private static Class> parseSig(String sig, Class container) {
+ private static Class> parseSig(String sig, Class> container) {
if (sig.equals("V")) return void.class;
SignatureParser parser = SignatureParser.make();
TypeSignature typeSig = parser.parseTypeSig(sig);
@@ -389,7 +391,7 @@
Type result = reify.getResult();
return toClass(result);
}
- static Class toClass(Type o) {
+ static Class> toClass(Type o) {
if (o instanceof GenericArrayType)
return Array.newInstance(toClass(((GenericArrayType)o).getGenericComponentType()),
0)
@@ -409,9 +411,9 @@
* u2 const_name_index;
* } enum_const_value;
*/
- private static Object parseEnumValue(Class enumType, ByteBuffer buf,
+ private static Object parseEnumValue(Class extends Enum> enumType, ByteBuffer buf,
ConstantPool constPool,
- Class container) {
+ Class> container) {
int typeNameIndex = buf.getShort() & 0xFFFF;
String typeName = constPool.getUTF8At(typeNameIndex);
int constNameIndex = buf.getShort() & 0xFFFF;
@@ -449,12 +451,12 @@
* If the array values do not match arrayType, an
* AnnotationTypeMismatchExceptionProxy will be returned.
*/
- private static Object parseArray(Class arrayType,
+ private static Object parseArray(Class> arrayType,
ByteBuffer buf,
ConstantPool constPool,
- Class container) {
+ Class> container) {
int length = buf.getShort() & 0xFFFF; // Number of array components
- Class componentType = arrayType.getComponentType();
+ Class> componentType = arrayType.getComponentType();
if (componentType == byte.class) {
return parseByteArray(length, buf, constPool);
@@ -477,11 +479,11 @@
} else if (componentType == Class.class) {
return parseClassArray(length, buf, constPool, container);
} else if (componentType.isEnum()) {
- return parseEnumArray(length, componentType, buf,
+ return parseEnumArray(length, (Class extends Enum>)componentType, buf,
constPool, container);
} else {
assert componentType.isAnnotation();
- return parseAnnotationArray(length, componentType, buf,
+ return parseAnnotationArray(length, (Class extends Annotation>)componentType, buf,
constPool, container);
}
}
@@ -660,8 +662,8 @@
private static Object parseClassArray(int length,
ByteBuffer buf,
ConstantPool constPool,
- Class container) {
- Object[] result = new Class[length];
+ Class> container) {
+ Object[] result = new Class>[length];
boolean typeMismatch = false;
int tag = 0;
@@ -677,10 +679,10 @@
return typeMismatch ? exceptionProxy(tag) : result;
}
- private static Object parseEnumArray(int length, Class enumType,
+ private static Object parseEnumArray(int length, Class extends Enum> enumType,
ByteBuffer buf,
ConstantPool constPool,
- Class container) {
+ Class> container) {
Object[] result = (Object[]) Array.newInstance(enumType, length);
boolean typeMismatch = false;
int tag = 0;
@@ -698,10 +700,10 @@
}
private static Object parseAnnotationArray(int length,
- Class annotationType,
+ Class extends Annotation> annotationType,
ByteBuffer buf,
ConstantPool constPool,
- Class container) {
+ Class> container) {
Object[] result = (Object[]) Array.newInstance(annotationType, length);
boolean typeMismatch = false;
int tag = 0;
@@ -797,7 +799,7 @@
* it is needed.
*/
private static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
- public static Annotation[] toArray(Map annotations) {
+ public static Annotation[] toArray(Map, Annotation> annotations) {
return annotations.values().toArray(EMPTY_ANNOTATION_ARRAY);
}
}
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/sun/reflect/annotation/AnnotationType.java
--- a/jdk/src/share/classes/sun/reflect/annotation/AnnotationType.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/sun/reflect/annotation/AnnotationType.java Wed Oct 07 14:15:01 2009 -0700
@@ -45,7 +45,7 @@
* types. This matches the return value that must be used for a
* dynamic proxy, allowing for a simple isInstance test.
*/
- private final Map memberTypes = new HashMap();
+ private final Map> memberTypes = new HashMap>();
/**
* Member name -> default value mapping.
@@ -76,12 +76,12 @@
* does not represent a valid annotation type
*/
public static synchronized AnnotationType getInstance(
- Class annotationClass)
+ Class extends Annotation> annotationClass)
{
AnnotationType result = sun.misc.SharedSecrets.getJavaLangAccess().
getAnnotationType(annotationClass);
if (result == null)
- result = new AnnotationType((Class>) annotationClass);
+ result = new AnnotationType((Class extends Annotation>) annotationClass);
return result;
}
@@ -93,7 +93,7 @@
* @throw IllegalArgumentException if the specified class object for
* does not represent a valid annotation type
*/
- private AnnotationType(final Class> annotationClass) {
+ private AnnotationType(final Class extends Annotation> annotationClass) {
if (!annotationClass.isAnnotation())
throw new IllegalArgumentException("Not an annotation type");
@@ -110,7 +110,7 @@
if (method.getParameterTypes().length != 0)
throw new IllegalArgumentException(method + " has params");
String name = method.getName();
- Class type = method.getReturnType();
+ Class> type = method.getReturnType();
memberTypes.put(name, invocationHandlerReturnType(type));
members.put(name, method);
@@ -140,7 +140,7 @@
* the specified type (which is assumed to be a legal member type
* for an annotation).
*/
- public static Class invocationHandlerReturnType(Class type) {
+ public static Class> invocationHandlerReturnType(Class> type) {
// Translate primitives to wrappers
if (type == byte.class)
return Byte.class;
@@ -167,7 +167,7 @@
* Returns member types for this annotation type
* (member name -> type mapping).
*/
- public Map memberTypes() {
+ public Map> memberTypes() {
return memberTypes;
}
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/sun/security/krb5/Credentials.java
--- a/jdk/src/share/classes/sun/security/krb5/Credentials.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/Credentials.java Wed Oct 07 14:15:01 2009 -0700
@@ -33,16 +33,11 @@
import sun.security.krb5.internal.*;
import sun.security.krb5.internal.ccache.CredentialsCache;
-import java.util.StringTokenizer;
import sun.security.krb5.internal.ktab.*;
import sun.security.krb5.internal.crypto.EType;
import java.io.File;
import java.io.IOException;
import java.util.Date;
-import java.util.Vector;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
/**
@@ -378,9 +373,9 @@
KRBError error = ke.getError();
// update salt in PrincipalName
- byte[] newSalt = error.getSalt();
- if (newSalt != null && newSalt.length > 0) {
- princ.setSalt(new String(newSalt));
+ String newSalt = error.getSalt();
+ if (newSalt != null && newSalt.length() > 0) {
+ princ.setSalt(newSalt);
}
// refresh keys
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/sun/security/krb5/KrbAsReq.java
--- a/jdk/src/share/classes/sun/security/krb5/KrbAsReq.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/KrbAsReq.java Wed Oct 07 14:15:01 2009 -0700
@@ -1,5 +1,5 @@
/*
- * Portions Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Portions Copyright 2000-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
@@ -56,7 +56,7 @@
private boolean PA_ENC_TIMESTAMP_REQUIRED = false;
private boolean pa_exists = false;
private int pa_etype = 0;
- private byte[] pa_salt = null;
+ private String pa_salt = null;
private byte[] pa_s2kparams = null;
// default is address-less tickets
@@ -88,7 +88,7 @@
* with pre-authentication values
*/
KrbAsReq(PrincipalName principal, EncryptionKey[] keys,
- boolean pa_exists, int etype, byte[] salt, byte[] s2kparams)
+ boolean pa_exists, int etype, String salt, byte[] s2kparams)
throws KrbException, IOException {
this(keys, // for pre-authentication
pa_exists, etype, salt, s2kparams, // pre-auth values
@@ -112,7 +112,7 @@
}
// update with pre-auth info
- public void updatePA(int etype, byte[] salt, byte[] params, PrincipalName name) {
+ public void updatePA(int etype, String salt, byte[] params, PrincipalName name) {
// set the pre-auth values
pa_exists = true;
pa_etype = etype;
@@ -120,9 +120,8 @@
pa_s2kparams = params;
// update salt in PrincipalName
- if (salt != null && salt.length > 0) {
- String newSalt = new String(salt);
- name.setSalt(newSalt);
+ if (salt != null && salt.length() > 0) {
+ name.setSalt(salt);
if (DEBUG) {
System.out.println("Updated salt from pre-auth = " + name.getSalt());
}
@@ -161,7 +160,7 @@
char[] password,
boolean pa_exists,
int etype,
- byte[] salt,
+ String salt,
byte[] s2kparams,
KDCOptions options,
PrincipalName cname,
@@ -246,7 +245,7 @@
EncryptionKey[] keys,
boolean pa_exists,
int etype,
- byte[] salt,
+ String salt,
byte[] s2kparams,
KDCOptions options,
PrincipalName cname,
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/sun/security/krb5/PrincipalName.java
--- a/jdk/src/share/classes/sun/security/krb5/PrincipalName.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/PrincipalName.java Wed Oct 07 14:15:01 2009 -0700
@@ -38,6 +38,7 @@
import java.io.IOException;
import java.math.BigInteger;
import sun.security.krb5.internal.ccache.CCacheOutputStream;
+import sun.security.krb5.internal.util.KerberosString;
/**
@@ -246,7 +247,7 @@
DerValue subSubDer;
while(subDer.getData().available() > 0) {
subSubDer = subDer.getData().getDerValue();
- v.addElement(subSubDer.getGeneralString());
+ v.addElement(new KerberosString(subSubDer).toString());
}
if (v.size() > 0) {
nameStrings = new String[v.size()];
@@ -554,7 +555,7 @@
temp = new DerOutputStream();
DerValue der[] = new DerValue[nameStrings.length];
for (int i = 0; i < nameStrings.length; i++) {
- der[i] = new DerValue(DerValue.tag_GeneralString, nameStrings[i]);
+ der[i] = new KerberosString(nameStrings[i]).toDerValue();
}
temp.putSequence(der);
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x01), temp);
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/sun/security/krb5/Realm.java
--- a/jdk/src/share/classes/sun/security/krb5/Realm.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/Realm.java Wed Oct 07 14:15:01 2009 -0700
@@ -31,11 +31,6 @@
package sun.security.krb5;
-import sun.security.krb5.Config;
-import sun.security.krb5.PrincipalName;
-import sun.security.krb5.KrbException;
-import sun.security.krb5.Asn1Exception;
-import sun.security.krb5.RealmException;
import sun.security.krb5.internal.Krb5;
import sun.security.util.*;
import java.io.IOException;
@@ -43,6 +38,7 @@
import java.util.Vector;
import java.util.Stack;
import java.util.EmptyStackException;
+import sun.security.krb5.internal.util.KerberosString;
/**
* Implements the ASN.1 Realm type.
@@ -109,7 +105,7 @@
if (encoding == null) {
throw new IllegalArgumentException("encoding can not be null");
}
- realm = encoding.getGeneralString();
+ realm = new KerberosString(encoding).toString();
if (realm == null || realm.length() == 0)
throw new RealmException(Krb5.REALM_NULL);
if (!isValidRealmString(realm))
@@ -206,7 +202,7 @@
*/
public byte[] asn1Encode() throws Asn1Exception, IOException {
DerOutputStream out = new DerOutputStream();
- out.putGeneralString(this.realm);
+ out.putDerValue(new KerberosString(this.realm).toDerValue());
return out.toByteArray();
}
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/sun/security/krb5/internal/ETypeInfo.java
--- a/jdk/src/share/classes/sun/security/krb5/internal/ETypeInfo.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/internal/ETypeInfo.java Wed Oct 07 14:15:01 2009 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2005-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
@@ -28,6 +28,7 @@
import sun.security.util.*;
import sun.security.krb5.Asn1Exception;
import java.io.IOException;
+import sun.security.krb5.internal.util.KerberosString;
/**
* Implements the ASN.1 ETYPE-INFO-ENTRY type.
@@ -43,7 +44,7 @@
public class ETypeInfo {
private int etype;
- private byte[] salt = null;
+ private String salt = null;
private static final byte TAG_TYPE = 0;
private static final byte TAG_VALUE = 1;
@@ -51,21 +52,13 @@
private ETypeInfo() {
}
- public ETypeInfo(int etype, byte[] salt) {
+ public ETypeInfo(int etype, String salt) {
this.etype = etype;
- if (salt != null) {
- this.salt = salt.clone();
- }
+ this.salt = salt;
}
public Object clone() {
- ETypeInfo etypeInfo = new ETypeInfo();
- etypeInfo.etype = etype;
- if (salt != null) {
- etypeInfo.salt = new byte[salt.length];
- System.arraycopy(salt, 0, etypeInfo.salt, 0, salt.length);
- }
- return etypeInfo;
+ return new ETypeInfo(etype, salt);
}
/**
@@ -94,7 +87,22 @@
if (encoding.getData().available() > 0) {
der = encoding.getData().getDerValue();
if ((der.getTag() & 0x1F) == 0x01) {
- this.salt = der.getData().getOctetString();
+ byte[] saltBytes = der.getData().getOctetString();
+
+ // Although salt is defined as an OCTET STRING, it's the
+ // encoding from of a string. As RFC 4120 says:
+ //
+ // "The salt, ..., is also completely unspecified with respect
+ // to character set and is probably locale-specific".
+ //
+ // It's known that this field is using the same encoding as
+ // KerberosString in most implementations.
+
+ if (KerberosString.MSNAME) {
+ this.salt = new String(saltBytes, "UTF8");
+ } else {
+ this.salt = new String(saltBytes);
+ }
}
}
@@ -120,7 +128,11 @@
if (salt != null) {
temp = new DerOutputStream();
- temp.putOctetString(salt);
+ if (KerberosString.MSNAME) {
+ temp.putOctetString(salt.getBytes("UTF8"));
+ } else {
+ temp.putOctetString(salt.getBytes());
+ }
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true,
TAG_VALUE), temp);
}
@@ -135,8 +147,8 @@
return etype;
}
- public byte[] getSalt() {
- return ((salt == null) ? null : salt.clone());
+ public String getSalt() {
+ return salt;
}
}
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/sun/security/krb5/internal/ETypeInfo2.java
--- a/jdk/src/share/classes/sun/security/krb5/internal/ETypeInfo2.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/internal/ETypeInfo2.java Wed Oct 07 14:15:01 2009 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2005-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
@@ -28,6 +28,7 @@
import sun.security.util.*;
import sun.security.krb5.Asn1Exception;
import java.io.IOException;
+import sun.security.krb5.internal.util.KerberosString;
/**
* Implements the ASN.1 ETYPE-INFO-ENTRY type.
@@ -54,11 +55,9 @@
private ETypeInfo2() {
}
- public ETypeInfo2(int etype, byte[] salt, byte[] s2kparams) {
+ public ETypeInfo2(int etype, String salt, byte[] s2kparams) {
this.etype = etype;
- if (salt != null) {
- this.saltStr = new String(salt);
- }
+ this.saltStr = salt;
if (s2kparams != null) {
this.s2kparams = s2kparams.clone();
}
@@ -102,7 +101,8 @@
if (encoding.getData().available() > 0) {
if ((encoding.getData().peekByte() & 0x1F) == 0x01) {
der = encoding.getData().getDerValue();
- this.saltStr = der.getData().getGeneralString();
+ this.saltStr = new KerberosString(
+ der.getData().getDerValue()).toString();
}
}
@@ -136,7 +136,7 @@
if (saltStr != null) {
temp = new DerOutputStream();
- temp.putGeneralString(saltStr);
+ temp.putDerValue(new KerberosString(saltStr).toDerValue());
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true,
TAG_VALUE1), temp);
}
@@ -157,8 +157,8 @@
return etype;
}
- public byte[] getSalt() {
- return ((saltStr == null) ? null : saltStr.getBytes());
+ public String getSalt() {
+ return saltStr;
}
public byte[] getParams() {
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/sun/security/krb5/internal/KRBError.java
--- a/jdk/src/share/classes/sun/security/krb5/internal/KRBError.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/internal/KRBError.java Wed Oct 07 14:15:01 2009 -0700
@@ -1,5 +1,5 @@
/*
- * Portions Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Portions Copyright 2000-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
@@ -42,6 +42,7 @@
import java.io.ObjectInputStream;
import java.math.BigInteger;
import java.util.Arrays;
+import sun.security.krb5.internal.util.KerberosString;
/**
* Implements the ASN.1 KRBError type.
*
@@ -97,7 +98,7 @@
// pre-auth info
private int etype = 0;
- private byte[] salt = null;
+ private String salt = null;
private byte[] s2kparams = null;
private static boolean DEBUG = Krb5.DEBUG;
@@ -334,8 +335,8 @@
}
// access pre-auth info
- public final byte[] getSalt() {
- return ((salt == null) ? null : salt.clone());
+ public final String getSalt() {
+ return salt;
}
// access pre-auth info
@@ -415,7 +416,8 @@
if (der.getData().available() >0) {
if ((der.getData().peekByte() & 0x1F) == 0x0B) {
subDer = der.getData().getDerValue();
- eText = subDer.getData().getGeneralString();
+ eText = new KerberosString(subDer.getData().getDerValue())
+ .toString();
}
}
if (der.getData().available() >0) {
@@ -515,7 +517,7 @@
if (eText != null) {
temp = new DerOutputStream();
- temp.putGeneralString(eText);
+ temp.putDerValue(new KerberosString(eText).toDerValue());
bytes.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0x0B), temp);
}
if (eData != null) {
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/sun/security/krb5/internal/crypto/Des.java
--- a/jdk/src/share/classes/sun/security/krb5/internal/crypto/Des.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/internal/crypto/Des.java Wed Oct 07 14:15:01 2009 -0700
@@ -34,17 +34,29 @@
import javax.crypto.spec.SecretKeySpec;
import javax.crypto.SecretKeyFactory;
import javax.crypto.SecretKey;
-import java.security.Security;
-import java.security.Provider;
import java.security.GeneralSecurityException;
import javax.crypto.spec.IvParameterSpec;
import sun.security.krb5.KrbCryptoException;
-import sun.security.krb5.internal.Krb5;
-import java.io.UnsupportedEncodingException;
import java.util.Arrays;
+import sun.security.action.GetPropertyAction;
public final class Des {
+ // RFC 3961 demands that UTF-8 encoding be used in DES's
+ // string-to-key function. For historical reasons, some
+ // implementations use a locale-specific encoding. Even
+ // so, when the client and server use different locales,
+ // they must agree on a common value, normally the one
+ // used when the password is set/reset.
+ //
+ // The following system property is provided to perform the
+ // string-to-key encoding. When set, the specified charset
+ // name is used. Otherwise, the system default charset.
+
+ private final static String CHARSET =
+ java.security.AccessController.doPrivileged(
+ new GetPropertyAction("sun.security.krb5.msinterop.des.s2kcharset"));
+
private static final long[] bad_keys = {
0x0101010101010101L, 0xfefefefefefefefeL,
0x1f1f1f1f1f1f1f1fL, 0xe0e0e0e0e0e0e0e0L,
@@ -226,7 +238,11 @@
// Convert password to byte array
try {
- cbytes = (new String(passwdChars)).getBytes();
+ if (CHARSET == null) {
+ cbytes = (new String(passwdChars)).getBytes();
+ } else {
+ cbytes = (new String(passwdChars)).getBytes(CHARSET);
+ }
} catch (Exception e) {
// clear-up sensitive information
if (cbytes != null) {
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/sun/security/krb5/internal/util/KerberosString.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/security/krb5/internal/util/KerberosString.java Wed Oct 07 14:15:01 2009 -0700
@@ -0,0 +1,82 @@
+/*
+ * 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. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package sun.security.krb5.internal.util;
+
+import java.io.IOException;
+import java.security.AccessController;
+import sun.security.action.GetBooleanAction;
+import sun.security.util.DerValue;
+
+/**
+ * Implements the ASN.1 KerberosString type.
+ *
+ *
+ * KerberosString ::= GeneralString (IA5String)
+ *
+ *
+ * This definition reflects the Network Working Group RFC 4120
+ * specification available at
+ *
+ * http://www.ietf.org/rfc/rfc4120.txt.
+ */
+public final class KerberosString {
+ /**
+ * RFC 4120 defines KerberosString as GeneralString (IA5String), which
+ * only includes ASCII characters. However, other implementations have been
+ * known to use GeneralString to contain UTF-8 encoding. To interop
+ * with these implementations, the following system property is defined.
+ * When set as true, KerberosString is encoded as UTF-8. Note that this
+ * only affects the byte encoding, the tag of the ASN.1 type is still
+ * GeneralString.
+ */
+ public static final boolean MSNAME = AccessController.doPrivileged(
+ new GetBooleanAction("sun.security.krb5.msinterop.kstring"));
+
+ private final String s;
+
+ public KerberosString(String s) {
+ this.s = s;
+ }
+
+ public KerberosString(DerValue der) throws IOException {
+ if (der.tag != DerValue.tag_GeneralString) {
+ throw new IOException(
+ "KerberosString's tag is incorrect: " + der.tag);
+ }
+ s = new String(der.getDataBytes(), MSNAME?"UTF8":"ASCII");
+ }
+
+ public String toString() {
+ return s;
+ }
+
+ public DerValue toDerValue() throws IOException {
+ // No need to cache the result since this method is
+ // only called once.
+ return new DerValue(DerValue.tag_GeneralString,
+ s.getBytes(MSNAME?"UTF8":"ASCII"));
+ }
+}
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/sun/security/provider/PolicyFile.java
--- a/jdk/src/share/classes/sun/security/provider/PolicyFile.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/sun/security/provider/PolicyFile.java Wed Oct 07 14:15:01 2009 -0700
@@ -54,7 +54,6 @@
import java.net.NetPermission;
import java.util.PropertyPermission;
import java.util.concurrent.atomic.AtomicReference;
-import java.awt.AWTPermission;
/*
import javax.security.auth.AuthPermission;
import javax.security.auth.kerberos.ServicePermission;
@@ -1023,8 +1022,6 @@
return new NetPermission(name, actions);
} else if (claz.equals(AllPermission.class)) {
return SecurityConstants.ALL_PERMISSION;
- } else if (claz.equals(AWTPermission.class)) {
- return new AWTPermission(name, actions);
/*
} else if (claz.equals(ReflectPermission.class)) {
return new ReflectPermission(name, actions);
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/sun/security/ssl/CipherSuite.java
--- a/jdk/src/share/classes/sun/security/ssl/CipherSuite.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/CipherSuite.java Wed Oct 07 14:15:01 2009 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2002-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
@@ -74,7 +74,7 @@
// Flag indicating if CipherSuite availability can change dynamically.
// This is the case when we rely on a JCE cipher implementation that
// may not be available in the installed JCE providers.
- // It is true because we do not have a Java ECC implementation.
+ // It is true because we might not have an ECC or Kerberos implementation.
final static boolean DYNAMIC_AVAILABILITY = true;
private final static boolean ALLOW_ECC = Debug.getBooleanProperty
@@ -278,14 +278,22 @@
KeyExchange(String name, boolean allowed) {
this.name = name;
this.allowed = allowed;
- this.alwaysAvailable = allowed && (name.startsWith("EC") == false);
+ this.alwaysAvailable = allowed &&
+ (!name.startsWith("EC")) && (!name.startsWith("KRB"));
}
boolean isAvailable() {
if (alwaysAvailable) {
return true;
}
- return allowed && JsseJce.isEcAvailable();
+
+ if (name.startsWith("EC")) {
+ return (allowed && JsseJce.isEcAvailable());
+ } else if (name.startsWith("KRB")) {
+ return (allowed && JsseJce.isKerberosAvailable());
+ } else {
+ return allowed;
+ }
}
public String toString() {
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/sun/security/ssl/JsseJce.java
--- a/jdk/src/share/classes/sun/security/ssl/JsseJce.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/JsseJce.java Wed Oct 07 14:15:01 2009 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2001-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
@@ -64,6 +64,29 @@
// If yes, then all the EC based crypto we need is available.
private static volatile Boolean ecAvailable;
+ // Flag indicating whether Kerberos crypto is available.
+ // If true, then all the Kerberos-based crypto we need is available.
+ private final static boolean kerberosAvailable;
+ static {
+ boolean temp;
+ try {
+ AccessController.doPrivileged(
+ new PrivilegedExceptionAction() {
+ public Void run() throws Exception {
+ // Test for Kerberos using the bootstrap class loader
+ Class.forName("sun.security.krb5.PrincipalName", true,
+ null);
+ return null;
+ }
+ });
+ temp = true;
+
+ } catch (Exception e) {
+ temp = false;
+ }
+ kerberosAvailable = temp;
+ }
+
static {
// force FIPS flag initialization
// Because isFIPS() is synchronized and cryptoProvider is not modified
@@ -187,6 +210,10 @@
ecAvailable = null;
}
+ static boolean isKerberosAvailable() {
+ return kerberosAvailable;
+ }
+
/**
* Return an JCE cipher implementation for the specified algorithm.
*/
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/sun/security/tools/JarSigner.java
--- a/jdk/src/share/classes/sun/security/tools/JarSigner.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/sun/security/tools/JarSigner.java Wed Oct 07 14:15:01 2009 -0700
@@ -291,13 +291,21 @@
for (n=0; n < args.length; n++) {
String flags = args[n];
+ String modifier = null;
+ if (flags.charAt(0) == '-') {
+ int pos = flags.indexOf(':');
+ if (pos > 0) {
+ modifier = flags.substring(pos+1);
+ flags = flags.substring(0, pos);
+ }
+ }
if (collator.compare(flags, "-keystore") == 0) {
if (++n == args.length) usageNoArg();
keystore = args[n];
} else if (collator.compare(flags, "-storepass") ==0) {
if (++n == args.length) usageNoArg();
- storepass = args[n].toCharArray();
+ storepass = getPass(modifier, args[n]);
} else if (collator.compare(flags, "-storetype") ==0) {
if (++n == args.length) usageNoArg();
storetype = args[n];
@@ -329,7 +337,7 @@
debug = true;
} else if (collator.compare(flags, "-keypass") ==0) {
if (++n == args.length) usageNoArg();
- keypass = args[n].toCharArray();
+ keypass = getPass(modifier, args[n]);
} else if (collator.compare(flags, "-sigfile") ==0) {
if (++n == args.length) usageNoArg();
sigfile = args[n];
@@ -355,13 +363,7 @@
} else if (collator.compare(flags, "-verify") ==0) {
verify = true;
} else if (collator.compare(flags, "-verbose") ==0) {
- verbose = "all";
- } else if (collator.compare(flags, "-verbose:all") ==0) {
- verbose = "all";
- } else if (collator.compare(flags, "-verbose:summary") ==0) {
- verbose = "summary";
- } else if (collator.compare(flags, "-verbose:grouped") ==0) {
- verbose = "grouped";
+ verbose = (modifier != null) ? modifier : "all";
} else if (collator.compare(flags, "-sigalg") ==0) {
if (++n == args.length) usageNoArg();
sigalg = args[n];
@@ -465,18 +467,25 @@
}
}
- void usageNoArg() {
+ static char[] getPass(String modifier, String arg) {
+ char[] output = KeyTool.getPassWithModifier(modifier, arg);
+ if (output != null) return output;
+ usage();
+ return null; // Useless, usage() already exit
+ }
+
+ static void usageNoArg() {
System.out.println(rb.getString("Option lacks argument"));
usage();
}
- void usage() {
+ static void usage() {
System.out.println();
System.out.println(rb.getString("Please type jarsigner -help for usage"));
System.exit(1);
}
- void fullusage() {
+ static void fullusage() {
System.out.println(rb.getString
("Usage: jarsigner [options] jar-file alias"));
System.out.println(rb.getString
diff -r c6231c81f65c -r 63aae8ce7f47 jdk/src/share/classes/sun/security/tools/KeyTool.java
--- a/jdk/src/share/classes/sun/security/tools/KeyTool.java Mon Oct 05 18:22:00 2009 -0700
+++ b/jdk/src/share/classes/sun/security/tools/KeyTool.java Wed Oct 07 14:15:01 2009 -0700
@@ -76,6 +76,7 @@
import sun.security.x509.*;
import static java.security.KeyStore.*;
+import static sun.security.tools.KeyTool.Command.*;
/**
* This tool manages keystores.
@@ -92,7 +93,7 @@
public final class KeyTool {
private boolean debug = false;
- private int command = -1;
+ private Command command = null;
private String sigAlgName = null;
private String keyAlgName = null;
private boolean verbose = false;
@@ -146,24 +147,132 @@
private List v3ext = new ArrayList ();
- private static final int CERTREQ = 1;
- private static final int CHANGEALIAS = 2;
- private static final int DELETE = 3;
- private static final int EXPORTCERT = 4;
- private static final int GENKEYPAIR = 5;
- private static final int GENSECKEY = 6;
- // there is no HELP
- private static final int IDENTITYDB = 7;
- private static final int IMPORTCERT = 8;
- private static final int IMPORTKEYSTORE = 9;
- private static final int KEYCLONE = 10;
- private static final int KEYPASSWD = 11;
- private static final int LIST = 12;
- private static final int PRINTCERT = 13;
- private static final int SELFCERT = 14;
- private static final int STOREPASSWD = 15;
- private static final int GENCERT = 16;
- private static final int PRINTCERTREQ = 17;
+ enum Command {
+ CERTREQ("Generates a certificate request",
+ "-alias", "-sigalg", "-file", "-keypass", "-keystore",
+ "-storepass", "-storetype", "-providername", "-providerclass",
+ "-providerarg", "-providerpath", "-v", "-protected"),
+ CHANGEALIAS("Changes an entry's alias",
+ "-alias", "-destalias", "-keypass", "-keystore", "-storepass",
+ "-storetype", "-providername", "-providerclass", "-providerarg",
+ "-providerpath", "-v", "-protected"),
+ DELETE("Deletes an entry",
+ "-alias", "-keystore", "-storepass", "-storetype",
+ "-providername", "-providerclass", "-providerarg",
+ "-providerpath", "-v", "-protected"),
+ EXPORTCERT("Exports certificate",
+ "-rfc", "-alias", "-file", "-keystore", "-storepass",
+ "-storetype", "-providername", "-providerclass", "-providerarg",
+ "-providerpath", "-v", "-protected"),
+ GENKEYPAIR("Generates a key pair",
+ "-alias", "-keyalg", "-keysize", "-sigalg", "-destalias",
+ "-startdate", "-ext", "-validity", "-keypass", "-keystore",
+ "-storepass", "-storetype", "-providername", "-providerclass",
+ "-providerarg", "-providerpath", "-v", "-protected"),
+ GENSECKEY("Generates a secret key",
+ "-alias", "-keypass", "-keyalg", "-keysize", "-keystore",
+ "-storepass", "-storetype", "-providername", "-providerclass",
+ "-providerarg", "-providerpath", "-v", "-protected"),
+ GENCERT("Generates certificate from a certificate request",
+ "-rfc", "-infile", "-outfile", "-alias", "-sigalg",
+ "-startdate", "-ext", "-validity", "-keypass", "-keystore",
+ "-storepass", "-storetype", "-providername", "-providerclass",
+ "-providerarg", "-providerpath", "-v", "-protected"),
+ IDENTITYDB("Imports entries from a JDK 1.1.x-style identity database",
+ "-file", "-storetype", "-keystore", "-storepass", "-providername",
+ "-providerclass", "-providerarg", "-providerpath", "-v"),
+ IMPORTCERT("Imports a certificate or a certificate chain",
+ "-noprompt", "-trustcacerts", "-protected", "-alias", "-file",
+ "-keypass", "-keystore", "-storepass", "-storetype",
+ "-providername", "-providerclass", "-providerarg",
+ "-providerpath", "-v"),
+ IMPORTKEYSTORE("Imports one or all entries from another keystore",
+ "-srckeystore", "-destkeystore", "-srcstoretype",
+ "-deststoretype", "-srcstorepass", "-deststorepass",
+ "-srcprotected", "-srcprovidername", "-destprovidername",
+ "-srcalias", "-destalias", "-srckeypass", "-destkeypass",
+ "-noprompt", "-providerclass", "-providerarg", "-providerpath",
+ "-v"),
+ KEYCLONE("Clones a key entry",
+ "-alias", "-destalias", "-keypass", "-new", "-storetype",
+ "-keystore", "-storepass", "-providername", "-providerclass",
+ "-providerarg", "-providerpath", "-v"),
+ KEYPASSWD("Changes the key password of an entry",
+ "-alias", "-keypass", "-new", "-keystore", "-storepass",
+ "-storetype", "-providername", "-providerclass", "-providerarg",
+ "-providerpath", "-v"),
+ LIST("Lists entries in a keystore",
+ "-rfc", "-alias", "-keystore", "-storepass", "-storetype",
+ "-providername", "-providerclass", "-providerarg",
+ "-providerpath", "-v", "-protected"),
+ PRINTCERT("Prints the content of a certificate",
+ "-rfc", "-file", "-sslserver", "-v"),
+ PRINTCERTREQ("Prints the content of a certificate request",
+ "-file", "-v"),
+ SELFCERT("Generates a self-signed certificate",
+ "-alias", "-sigalg", "-dname", "-startdate", "-validity", "-keypass",
+ "-storetype", "-keystore", "-storepass", "-providername",
+ "-providerclass", "-providerarg", "-providerpath", "-v"),
+ STOREPASSWD("Changes the store password of a keystore",
+ "-new", "-keystore", "-storepass", "-storetype", "-providername",
+ "-providerclass", "-providerarg", "-providerpath", "-v");
+
+ final String description;
+ final String[] options;
+ Command(String d, String... o) {
+ description = d;
+ options = o;
+ }
+ @Override
+ public String toString() {
+ return "-" + name().toLowerCase(Locale.ENGLISH);
+ }
+ };
+
+ private static String[][] options = {
+ // name, arg, description
+ {"-alias", "", "alias name of the entry to process"},
+ {"-destalias", "", "destination alias"},
+ {"-destkeypass", "", "destination key password"},
+ {"-destkeystore", "", "destination keystore name"},
+ {"-destprotected", null, "destination keystore password protected"},
+ {"-destprovidername", "", "destination keystore provider name"},
+ {"-deststorepass", "", "destination keystore password"},
+ {"-deststoretype", "", "destination keystore type"},
+ {"-dname", "", "distinguished name"},
+ {"-ext", "", "X.509 extension"},
+ {"-file", "", "output file name"},
+ {"-file", "", "input file name"},
+ {"-infile", "", "input file name"},
+ {"-keyalg", "", "key algorithm name"},
+ {"-keypass", "", "key password"},
+ {"-keysize", "", "key bit size"},
+ {"-keystore", "", "keystore name"},
+ {"-new", "", "new password"},
+ {"-noprompt", null, "do not prompt"},
+ {"-outfile", "", "output file name"},
+ {"-protected", null, "password through protected mechanism"},
+ {"-providerarg", "", "provider argument"},
+ {"-providerclass", "", "provider class name"},
+ {"-providername", "", "provider name"},
+ {"-providerpath", "", "provider classpath"},
+ {"-rfc", null, "output in RFC style"},
+ {"-sigalg", "", "signature algorithm name"},
+ {"-srcalias", "", "source alias"},
+ {"-srckeypass", "", "source keystore password"},
+ {"-srckeystore", "", "source keystore name"},
+ {"-srcprotected", null, "source keystore password protected"},
+ {"-srcprovidername", "", "source keystore provider name"},
+ {"-srcstorepass", "", "source keystore password"},
+ {"-srcstoretype", "", "source keystore type"},
+ {"-sslserver", "", "SSL server host and port"},
+ {"-startdate", "", "certificate validity start date/time"},
+ {"-storepass", "", "keystore password"},
+ {"-storetype", "", "keystore type"},
+ {"-trustcacerts", null, "trust certificates from cacerts"},
+ {"-v", null, "verbose output"},
+ {"-validity", "", "validity number of days"},
+ };
private static final Class[] PARAM_STRING = { String.class };
@@ -192,7 +301,7 @@
private void run(String[] args, PrintStream out) throws Exception {
try {
parseArgs(args);
- if (command != -1) {
+ if (command != null) {
doCommands(out);
}
} catch (Exception e) {
@@ -224,59 +333,59 @@
*/
void parseArgs(String[] args) {
- if (args.length == 0) {
- usage();
- return;
- }
-
int i=0;
+ boolean help = args.length == 0;
for (i=0; (i < args.length) && args[i].startsWith("-"); i++) {
String flags = args[i];
+
+ // Check if the last option needs an arg
+ if (i == args.length - 1) {
+ for (String[] option: options) {
+ // Only options with an arg need to be checked
+ if (collator.compare(flags, option[0]) == 0) {
+ if (option[1] != null) errorNeedArgument(flags);
+ break;
+ }
+ }
+ }
+
+ /*
+ * Check modifiers
+ */
+ String modifier = null;
+ int pos = flags.indexOf(':');
+ if (pos > 0) {
+ modifier = flags.substring(pos+1);
+ flags = flags.substring(0, pos);
+ }
/*
* command modes
*/
- if (collator.compare(flags, "-certreq") == 0) {
- command = CERTREQ;
- } else if (collator.compare(flags, "-delete") == 0) {
- command = DELETE;
- } else if (collator.compare(flags, "-export") == 0 ||
- collator.compare(flags, "-exportcert") == 0) {
+ boolean isCommand = false;
+ for (Command c: Command.values()) {
+ if (collator.compare(flags, c.toString()) == 0) {
+ command = c;
+ isCommand = true;
+ break;
+ }
+ }
+
+ if (isCommand) {
+ // already recognized as a command
+ } else if (collator.compare(flags, "-export") == 0) {
command = EXPORTCERT;
- } else if (collator.compare(flags, "-genkey") == 0 ||
- collator.compare(flags, "-genkeypair") == 0) {
+ } else if (collator.compare(flags, "-genkey") == 0) {
command = GENKEYPAIR;
- } else if (collator.compare(flags, "-help") == 0) {
- usage();
- return;
- } else if (collator.compare(flags, "-identitydb") == 0) { // obsolete
- command = IDENTITYDB;
- } else if (collator.compare(flags, "-import") == 0 ||
- collator.compare(flags, "-importcert") == 0) {
+ } else if (collator.compare(flags, "-import") == 0) {
command = IMPORTCERT;
- } else if (collator.compare(flags, "-keyclone") == 0) { // obsolete
- command = KEYCLONE;
- } else if (collator.compare(flags, "-changealias") == 0) {
- command = CHANGEALIAS;
- } else if (collator.compare(flags, "-keypasswd") == 0) {
- command = KEYPASSWD;
- } else if (collator.compare(flags, "-list") == 0) {
- command = LIST;
- } else if (collator.compare(flags, "-printcert") == 0) {
- command = PRINTCERT;
- } else if (collator.compare(flags, "-selfcert") == 0) { // obsolete
- command = SELFCERT;
- } else if (collator.compare(flags, "-storepasswd") == 0) {
- command = STOREPASSWD;
- } else if (collator.compare(flags, "-importkeystore") == 0) {
- command = IMPORTKEYSTORE;
- } else if (collator.compare(flags, "-genseckey") == 0) {
- command = GENSECKEY;
- } else if (collator.compare(flags, "-gencert") == 0) {
- command = GENCERT;
- } else if (collator.compare(flags, "-printcertreq") == 0) {
- command = PRINTCERTREQ;
+ }
+ /*
+ * Help
+ */
+ else if (collator.compare(flags, "-help") == 0) {
+ help = true;
}
/*
@@ -284,101 +393,74 @@
*/
else if (collator.compare(flags, "-keystore") == 0 ||
collator.compare(flags, "-destkeystore") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- ksfname = args[i];
+ ksfname = args[++i];
} else if (collator.compare(flags, "-storepass") == 0 ||
collator.compare(flags, "-deststorepass") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- storePass = args[i].toCharArray();
+ storePass = getPass(modifier, args[++i]);
passwords.add(storePass);
} else if (collator.compare(flags, "-storetype") == 0 ||
collator.compare(flags, "-deststoretype") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- storetype = args[i];
+ storetype = args[++i];
} else if (collator.compare(flags, "-srcstorepass") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- srcstorePass = args[i].toCharArray();
+ srcstorePass = getPass(modifier, args[++i]);
passwords.add(srcstorePass);
} else if (collator.compare(flags, "-srcstoretype") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- srcstoretype = args[i];
+ srcstoretype = args[++i];
} else if (collator.compare(flags, "-srckeypass") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- srckeyPass = args[i].toCharArray();
+ srckeyPass = getPass(modifier, args[++i]);
passwords.add(srckeyPass);
} else if (collator.compare(flags, "-srcprovidername") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- srcProviderName = args[i];
+ srcProviderName = args[++i];
} else if (collator.compare(flags, "-providername") == 0 ||
collator.compare(flags, "-destprovidername") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- providerName = args[i];
+ providerName = args[++i];
} else if (collator.compare(flags, "-providerpath") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- pathlist = args[i];
+ pathlist = args[++i];
} else if (collator.compare(flags, "-keypass") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- keyPass = args[i].toCharArray();
+ keyPass = getPass(modifier, args[++i]);
passwords.add(keyPass);
} else if (collator.compare(flags, "-new") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- newPass = args[i].toCharArray();
+ newPass = getPass(modifier, args[++i]);
passwords.add(newPass);
} else if (collator.compare(flags, "-destkeypass") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- destKeyPass = args[i].toCharArray();
+ destKeyPass = getPass(modifier, args[++i]);
passwords.add(destKeyPass);
} else if (collator.compare(flags, "-alias") == 0 ||
collator.compare(flags, "-srcalias") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- alias = args[i];
+ alias = args[++i];
} else if (collator.compare(flags, "-dest") == 0 ||
collator.compare(flags, "-destalias") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- dest = args[i];
+ dest = args[++i];
} else if (collator.compare(flags, "-dname") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- dname = args[i];
+ dname = args[++i];
} else if (collator.compare(flags, "-keysize") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- keysize = Integer.parseInt(args[i]);
+ keysize = Integer.parseInt(args[++i]);
} else if (collator.compare(flags, "-keyalg") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- keyAlgName = args[i];
+ keyAlgName = args[++i];
} else if (collator.compare(flags, "-sigalg") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- sigAlgName = args[i];
+ sigAlgName = args[++i];
} else if (collator.compare(flags, "-startdate") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- startDate = args[i];
+ startDate = args[++i];
} else if (collator.compare(flags, "-validity") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- validity = Long.parseLong(args[i]);
+ validity = Long.parseLong(args[++i]);
} else if (collator.compare(flags, "-ext") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- v3ext.add(args[i]);
+ v3ext.add(args[++i]);
} else if (collator.compare(flags, "-file") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- filename = args[i];
+ filename = args[++i];
} else if (collator.compare(flags, "-infile") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- infilename = args[i];
+ infilename = args[++i];
} else if (collator.compare(flags, "-outfile") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- outfilename = args[i];
+ outfilename = args[++i];
} else if (collator.compare(flags, "-sslserver") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- sslserver = args[i];
+ sslserver = args[++i];
} else if (collator.compare(flags, "-srckeystore") == 0) {
- if (++i == args.length) errorNeedArgument(flags);
- srcksfname = args[i];
+ srcksfname = args[++i];
} else if ((collator.compare(flags, "-provider") == 0) ||
(collator.compare(flags, "-providerclass") == 0)) {
- if (++i == args.length) errorNeedArgument(flags);
if (providers == null) {
providers = new HashSet> (3);
}
- String providerClass = args[i];
+ String providerClass = args[++i];
String providerArg = null;
if (args.length > (i+1)) {
@@ -418,19 +500,24 @@
}
if (i is not a legal command"));
- Object[] source = {args[i]};
- throw new RuntimeException(form.format(source));
- }
-
- if (command == -1) {
- System.err.println(rb.getString("Usage error: no command provided"));
+ System.err.println(rb.getString("Illegal option: ") + args[i]);
tinyHelp();
}
+
+ if (command == null) {
+ if (help) {
+ usage();
+ } else {
+ System.err.println(rb.getString("Usage error: no command provided"));
+ tinyHelp();
+ }
+ } else if (help) {
+ usage();
+ command = null;
+ }
}
- boolean isKeyStoreRelated(int cmd) {
+ boolean isKeyStoreRelated(Command cmd) {
return cmd != PRINTCERT && cmd != PRINTCERTREQ;
}
@@ -2600,7 +2687,7 @@
do {
if (maxRetry-- < 0) {
throw new RuntimeException(rb.getString(
- "Too may retries, program terminated"));
+ "Too many retries, program terminated"));
}
commonName = inputString(in,
rb.getString("What is your first and last name?"),
@@ -3086,7 +3173,7 @@
do {
if (maxRetry-- < 0) {
throw new RuntimeException(rb.getString(
- "Too may retries, program terminated"));
+ "Too many retries, program terminated"));
}
System.err.print(prompt);
System.err.flush();
@@ -3258,7 +3345,8 @@
int nmatch = 0;
for (int i = 0; i list = Arrays.asList(
- extstr.toLowerCase().substring(8).split(","));
+ extstr.toLowerCase(Locale.ENGLISH).substring(8).split(","));
// First check existence of "all"
if (list.contains("all")) {
ext = reqex; // we know ext was null
@@ -3687,227 +3775,69 @@
* Prints the usage of this tool.
*/
private void usage() {
- System.err.println(rb.getString("keytool usage:\n"));
-
- System.err.println(rb.getString
- ("-certreq [-v] [-protected]"));
- System.err.println(rb.getString
- ("\t [-alias ] [-sigalg ]"));
- System.err.println(rb.getString
- ("\t [-dname ]"));
- System.err.println(rb.getString
- ("\t [-file ] [-keypass ]"));
- System.err.println(rb.getString
- ("\t [-keystore ] [-storepass ]"));
- System.err.println(rb.getString
- ("\t [-storetype ] [-providername ]"));
- System.err.println(rb.getString
- ("\t [-providerclass [-providerarg ]] ..."));
- System.err.println(rb.getString
- ("\t [-providerpath ]"));
- System.err.println();
-
- System.err.println(rb.getString
- ("-changealias [-v] [-protected] -alias -destalias "));
- System.err.println(rb.getString
- ("\t [-keypass ]"));
- System.err.println(rb.getString
- ("\t [-keystore ] [-storepass ]"));
- System.err.println(rb.getString
- ("\t [-storetype ] [-providername ]"));
- System.err.println(rb.getString
- ("\t [-providerclass [-providerarg ]] ..."));
- System.err.println(rb.getString
- ("\t [-providerpath ]"));
- System.err.println();
-
- System.err.println(rb.getString
- ("-delete [-v] [-protected] -alias "));
- System.err.println(rb.getString
- ("\t [-keystore ] [-storepass ]"));
- System.err.println(rb.getString
- ("\t [-storetype ] [-providername ]"));
- System.err.println(rb.getString
- ("\t [-providerclass [-providerarg ]] ..."));
- System.err.println(rb.getString
- ("\t [-providerpath ]"));
- System.err.println();
-
- System.err.println(rb.getString
- ("-exportcert [-v] [-rfc] [-protected]"));
- System.err.println(rb.getString
- ("\t [-alias ] [-file ]"));
- System.err.println(rb.getString
- ("\t [-keystore ] [-storepass ]"));
- System.err.println(rb.getString
- ("\t [-storetype ] [-providername ]"));
- System.err.println(rb.getString
- ("\t [-providerclass [-providerarg ]] ..."));
- System.err.println(rb.getString
- ("\t [-providerpath ]"));
- System.err.println();
-
- System.err.println(rb.getString
- ("-genkeypair [-v] [-protected]"));
- System.err.println(rb.getString
- ("\t [-alias ]"));
- System.err.println(rb.getString
- ("\t [-keyalg ] [-keysize ]"));
- System.err.println(rb.getString
- ("\t [-sigalg ] [-dname ]"));
- System.err.println(rb.getString
- ("\t [-startdate ]"));
- System.err.println(rb.getString
- ("\t [-ext [:critical][=]]..."));
- System.err.println(rb.getString
- ("\t [-validity ] [-keypass ]"));
- System.err.println(rb.getString
- ("\t [-keystore ] [-storepass ]"));
- System.err.println(rb.getString
- ("\t [-storetype ] [-providername ]"));
- System.err.println(rb.getString
- ("\t [-providerclass [-providerarg ]] ..."));
- System.err.println(rb.getString
- ("\t [-providerpath ]"));
- System.err.println();
-
- System.err.println(rb.getString
- ("-gencert [-v] [-rfc] [-protected]"));
- System.err.println(rb.getString
- ("\t [-infile ] [-outfile ]"));
- System.err.println(rb.getString
- ("\t [-alias ]"));
- System.err.println(rb.getString
- ("\t [-dname ]"));
- System.err.println(rb.getString
- ("\t [-sigalg ]"));
- System.err.println(rb.getString
- ("\t [-startdate ]"));
- System.err.println(rb.getString
- ("\t [-ext [:critical][=]]..."));
- System.err.println(rb.getString
- ("\t [-validity ] [-keypass ]"));
- System.err.println(rb.getString
- ("\t [-keystore ] [-storepass ]"));
- System.err.println(rb.getString
- ("\t [-storetype ] [-providername ]"));
- System.err.println(rb.getString
- ("\t [-providerclass [-providerarg ]] ..."));
- System.err.println(rb.getString
- ("\t [-providerpath ]"));
- System.err.println();
-
- System.err.println(rb.getString
- ("-genseckey [-v] [-protected]"));
- System.err.println(rb.getString
- ("\t [-alias ] [-keypass ]"));
- System.err.println(rb.getString
- ("\t [-keyalg ] [-keysize ]"));
- System.err.println(rb.getString
- ("\t [-keystore ] [-storepass ]"));
- System.err.println(rb.getString
- ("\t [-storetype ] [-providername ]"));
- System.err.println(rb.getString
- ("\t [-providerclass [-providerarg ]] ..."));
- System.err.println(rb.getString
- ("\t [-providerpath ]"));
- System.err.println();
-
- System.err.println(rb.getString("-help"));
- System.err.println();
-
- System.err.println(rb.getString
- ("-importcert [-v] [-noprompt] [-trustcacerts] [-protected]"));
- System.err.println(rb.getString
- ("\t [-alias ]"));
- System.err.println(rb.getString
- ("\t [-file ] [-keypass ]"));
- System.err.println(rb.getString
- ("\t [-keystore ] [-storepass ]"));
- System.err.println(rb.getString
- ("\t [-storetype ] [-providername ]"));
- System.err.println(rb.getString
- ("\t [-providerclass [-providerarg ]] ..."));
- System.err.println(rb.getString
- ("\t [-providerpath ]"));
- System.err.println();
-
- System.err.println(rb.getString
- ("-importkeystore [-v] "));
- System.err.println(rb.getString
- ("\t [-srckeystore ] [-destkeystore ]"));
- System.err.println(rb.getString
- ("\t [-srcstoretype ] [-deststoretype ]"));
- System.err.println(rb.getString
- ("\t [-srcstorepass ] [-deststorepass ]"));
- System.err.println(rb.getString
- ("\t [-srcprotected] [-destprotected]"));
- System.err.println(rb.getString
- ("\t [-srcprovidername ]\n\t [-destprovidername ]"));
- System.err.println(rb.getString
- ("\t [-srcalias [-destalias ]"));
- System.err.println(rb.getString
- ("\t [-srckeypass ] [-destkeypass ]]"));
- System.err.println(rb.getString
- ("\t [-noprompt]"));
- System.err.println(rb.getString
- ("\t [-providerclass [-providerarg ]] ..."));
- System.err.println(rb.getString
- ("\t [-providerpath ]"));
- System.err.println();
-
- System.err.println(rb.getString
- ("-keypasswd [-v] [-alias ]"));
- System.err.println(rb.getString
- ("\t [-keypass ] [-new ]"));
- System.err.println(rb.getString
- ("\t [-keystore ] [-storepass ]"));
- System.err.println(rb.getString
- ("\t [-storetype ] [-providername ]"));
- System.err.println(rb.getString
- ("\t [-providerclass [-providerarg ]] ..."));
- System.err.println(rb.getString
- ("\t [-providerpath ]"));
- System.err.println();
-
- System.err.println(rb.getString
- ("-list [-v | -rfc] [-protected]"));
- System.err.println(rb.getString
- ("\t [-alias ]"));
- System.err.println(rb.getString
- ("\t [-keystore ] [-storepass ]"));
- System.err.println(rb.getString
- ("\t [-storetype ] [-providername ]"));
- System.err.println(rb.getString
- ("\t [-providerclass [-providerarg ]] ..."));
- System.err.println(rb.getString
- ("\t [-providerpath ]"));
- System.err.println();
-
- System.err.println(rb.getString
- ("-printcert [-v] [-rfc] [-file | -sslserver ]"));
- System.err.println();
-
- System.err.println(rb.getString
- ("-printcertreq [-v] [-file ]"));
- System.err.println();
-
- System.err.println(rb.getString
- ("-storepasswd [-v] [-new ]"));
- System.err.println(rb.getString
- ("\t [-keystore ] [-storepass ]"));
- System.err.println(rb.getString
- ("\t [-storetype ] [-providername ]"));
- System.err.println(rb.getString
- ("\t [-providerclass [-providerarg