diff options
author | Raif S. Naffah <raif@swiftdsl.com.au> | 2006-04-29 07:39:19 +0000 |
---|---|---|
committer | Raif S. Naffah <raif@swiftdsl.com.au> | 2006-04-29 07:39:19 +0000 |
commit | d20dbc855f03963774872fbfbbf7c49f5ed26629 (patch) | |
tree | 9885c6165dfc0fe2c6c5ee24e83325cac7bd0a9a | |
parent | ee22e5b3100875100c0f0e4b25436563372ddec7 (diff) | |
download | classpath-d20dbc855f03963774872fbfbbf7c49f5ed26629.tar.gz |
2006-04-29 Raif S. Naffah <raif@swiftdsl.com.au>
* tools/jarsigner.sh.in: Changed license to GPL + Exception.
Use -Xbootclasspath/p instead of -cp when invoking the main class.
* tools/gnu/classpath/tools/jarsigner/Main.java:
Changed license to GPL + Exception.
(handler): New field.
(getCallbackHandler): New method.
(setupSigningParams): Use above method.
* tools/gnu/classpath/tools/jarsigner/HashUtils.java:
Changed license to GPL + Exception.
* tools/gnu/classpath/tools/jarsigner/SFHelper.java: Likewise.
* tools/gnu/classpath/tools/jarsigner/JarVerifier.java: Likewise.
* tools/gnu/classpath/tools/jarsigner/JarSigner.java: Likewise.
* tools/gnu/classpath/tools/jarsigner/jarsigner.txt: Updated copyright.
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | tools/gnu/classpath/tools/jarsigner/HashUtils.java | 19 | ||||
-rw-r--r-- | tools/gnu/classpath/tools/jarsigner/JarSigner.java | 19 | ||||
-rw-r--r-- | tools/gnu/classpath/tools/jarsigner/JarVerifier.java | 19 | ||||
-rw-r--r-- | tools/gnu/classpath/tools/jarsigner/Main.java | 97 | ||||
-rw-r--r-- | tools/gnu/classpath/tools/jarsigner/SFHelper.java | 19 | ||||
-rw-r--r-- | tools/gnu/classpath/tools/jarsigner/jarsigner.txt | 2 | ||||
-rw-r--r-- | tools/jarsigner.sh.in | 21 |
8 files changed, 200 insertions, 12 deletions
@@ -1,5 +1,21 @@ 2006-04-29 Raif S. Naffah <raif@swiftdsl.com.au> + * tools/jarsigner.sh.in: Changed license to GPL + Exception. + Use -Xbootclasspath/p instead of -cp when invoking the main class. + * tools/gnu/classpath/tools/jarsigner/Main.java: + Changed license to GPL + Exception. + (handler): New field. + (getCallbackHandler): New method. + (setupSigningParams): Use above method. + * tools/gnu/classpath/tools/jarsigner/HashUtils.java: + Changed license to GPL + Exception. + * tools/gnu/classpath/tools/jarsigner/SFHelper.java: Likewise. + * tools/gnu/classpath/tools/jarsigner/JarVerifier.java: Likewise. + * tools/gnu/classpath/tools/jarsigner/JarSigner.java: Likewise. + * tools/gnu/classpath/tools/jarsigner/jarsigner.txt: Updated copyright. + +2006-04-29 Raif S. Naffah <raif@swiftdsl.com.au> + * gnu/javax/security/auth/callback/ConsoleCallbackHandler.java (handleConfirmation): Use print instead of println. (handleConfirmation): When case is YES_NO_OPTION, print default option diff --git a/tools/gnu/classpath/tools/jarsigner/HashUtils.java b/tools/gnu/classpath/tools/jarsigner/HashUtils.java index a81a0d34d..2286063f1 100644 --- a/tools/gnu/classpath/tools/jarsigner/HashUtils.java +++ b/tools/gnu/classpath/tools/jarsigner/HashUtils.java @@ -16,7 +16,24 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. */ +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ package gnu.classpath.tools.jarsigner; diff --git a/tools/gnu/classpath/tools/jarsigner/JarSigner.java b/tools/gnu/classpath/tools/jarsigner/JarSigner.java index 1b58c5072..e6106a600 100644 --- a/tools/gnu/classpath/tools/jarsigner/JarSigner.java +++ b/tools/gnu/classpath/tools/jarsigner/JarSigner.java @@ -16,7 +16,24 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. */ +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ package gnu.classpath.tools.jarsigner; diff --git a/tools/gnu/classpath/tools/jarsigner/JarVerifier.java b/tools/gnu/classpath/tools/jarsigner/JarVerifier.java index 8bca89270..1d3a98dda 100644 --- a/tools/gnu/classpath/tools/jarsigner/JarVerifier.java +++ b/tools/gnu/classpath/tools/jarsigner/JarVerifier.java @@ -16,7 +16,24 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. */ +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ package gnu.classpath.tools.jarsigner; diff --git a/tools/gnu/classpath/tools/jarsigner/Main.java b/tools/gnu/classpath/tools/jarsigner/Main.java index 794055f45..360a88e56 100644 --- a/tools/gnu/classpath/tools/jarsigner/Main.java +++ b/tools/gnu/classpath/tools/jarsigner/Main.java @@ -16,7 +16,24 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. */ +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ package gnu.classpath.tools.jarsigner; @@ -96,6 +113,8 @@ public class Main private char[] passwordChars; private PrivateKey signerPrivateKey; private Certificate[] signerCertificateChain; + /** The callback handler to use when needing to interact with user. */ + private CallbackHandler handler; private Main() { @@ -423,10 +442,9 @@ public class Main if (ksPassword == null) { // ask the user to provide one - CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter keystore password: ", false); - handler.handle(new Callback[] { pcb }); + getCallbackHandler().handle(new Callback[] { pcb }); ksPasswordChars = pcb.getPassword(); } else @@ -456,10 +474,9 @@ public class Main catch (UnrecoverableKeyException x) { // ask the user to provide one - CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter key password for " + alias + ": ", false); - handler.handle(new Callback[] { pcb }); + getCallbackHandler().handle(new Callback[] { pcb }); passwordChars = pcb.getPassword(); // take 2 key = store.getKey(alias, passwordChars); @@ -548,4 +565,74 @@ public class Main { return this.signedJarFileName; } + + /** + * Return a CallbackHandler which uses the Console (System.in and System.out) + * for interacting with the user. + * <p> + * This method first finds all currently installed security providers capable + * of providing such service and then in turn attempts to instantiate the + * handler from those providers. As soon as one provider returns a non-null + * instance of the callback handler, the search stops and that instance is + * set to be used from now on. + * <p> + * If no installed providers were found, this method falls back on the GNU + * provider, by-passing the Security search mechanism. The default console + * callback handler implementation is {@link ConsoleCallbackHandler}. + * + * @return a console-based {@link CallbackHandler}. + */ + protected CallbackHandler getCallbackHandler() + { + if (handler == null) + { + String service = "CallbackHandler.Console"; //$NON-NLS-1$ + Provider[] providers = Security.getProviders(service); + if (providers != null) + for (int i = 0; i < providers.length; i++) + { + Provider p = providers[i]; + String className = p.getProperty(service); + if (className != null) + try + { + handler = (CallbackHandler) Class.forName(className).newInstance(); + } + catch (InstantiationException x) + { + log.fine("InstantiationException while creating [" //$NON-NLS-1$ + + className + "] from provider [" + p.getName() //$NON-NLS-1$ + + "]. Ignore"); //$NON-NLS-1$ + } + catch (IllegalAccessException x) + { + log.fine("IllegalAccessException while creating [" //$NON-NLS-1$ + + className + "] from provider [" + p.getName() //$NON-NLS-1$ + + "]. Ignore"); //$NON-NLS-1$ + } + catch (ClassNotFoundException x) + { + log.fine("ClassNotFoundException while creating [" //$NON-NLS-1$ + + className + "] from provider [" + p.getName() //$NON-NLS-1$ + + "]. Ignore"); //$NON-NLS-1$ + } + + if (handler != null) + { + + log.fine("Will use [" + handler.getClass().getName() //$NON-NLS-1$ + + "] from [" + p.getName() + "]"); //$NON-NLS-1$ //$NON-NLS-2$ + break; + } + } + + if (handler == null) + { + log.fine("No console callback handler found. Will use ours"); //$NON-NLS-1$ + handler = new ConsoleCallbackHandler(); + } + } + + return handler; + } } diff --git a/tools/gnu/classpath/tools/jarsigner/SFHelper.java b/tools/gnu/classpath/tools/jarsigner/SFHelper.java index 38caa44aa..cf72cfc2a 100644 --- a/tools/gnu/classpath/tools/jarsigner/SFHelper.java +++ b/tools/gnu/classpath/tools/jarsigner/SFHelper.java @@ -16,7 +16,24 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. */ +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ package gnu.classpath.tools.jarsigner; diff --git a/tools/gnu/classpath/tools/jarsigner/jarsigner.txt b/tools/gnu/classpath/tools/jarsigner/jarsigner.txt index a4e4c02ef..499c81fc9 100644 --- a/tools/gnu/classpath/tools/jarsigner/jarsigner.txt +++ b/tools/gnu/classpath/tools/jarsigner/jarsigner.txt @@ -1,6 +1,6 @@ Java ARchive (JAR) file signing and verification tool. -Copyright 2006 Free Software Foundation, Inc. +Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. diff --git a/tools/jarsigner.sh.in b/tools/jarsigner.sh.in index ced5c8cd0..cea95a288 100644 --- a/tools/jarsigner.sh.in +++ b/tools/jarsigner.sh.in @@ -1,6 +1,6 @@ #!/bin/sh -## Copyright 2006 Free Software Foundation, Inc. +## Copyright (C) 2006 Free Software Foundation, Inc. ## ## This file is a part of GNU Classpath. ## @@ -19,6 +19,23 @@ ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 ## USA. ## +## Linking this library statically or dynamically with other modules is +## making a combined work based on this library. Thus, the terms and +## conditions of the GNU General Public License cover the whole +## combination. +## +## As a special exception, the copyright holders of this library give you +## permission to link this library with independent modules to produce an +## executable, regardless of the license terms of these independent +## modules, and to copy and distribute the resulting executable under +## terms of your choice, provided that you also meet, for each linked +## independent module, the terms and conditions of the license of that +## module. An independent module is a module which is not derived from +## or based on this library. If you modify this library, you may extend +## this exception to your version of the library, but you are not +## obligated to do so. If you do not wish to do so, delete this +## exception statement from your version. +## ## ## A simple shell script to launch the GNU Classpath jarsigner tool. ## @@ -43,4 +60,4 @@ if [ -z "${JAVA}" ] ; then fi fi -exec "${JAVA}" -cp "${tools_cp}" gnu.classpath.tools.jarsigner.Main $@ +exec "${JAVA}" -Xbootclasspath/p:"${tools_cp}" gnu.classpath.tools.jarsigner.Main $@ |