[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commit-cp] classpath/tools/gnu/classpath/tools jarsignerMe...
From: |
Raif S. Naffah |
Subject: |
[commit-cp] classpath/tools/gnu/classpath/tools jarsignerMe... |
Date: |
Mon, 12 Jun 2006 05:14:07 +0000 |
CVSROOT: /cvsroot/classpath
Module name: classpath
Changes by: Raif S. Naffah <raif> 06/06/12 05:14:07
Modified files:
tools/gnu/classpath/tools/jarsigner: Messages.java SFHelper.java
Main.java JarVerifier.java
HashUtils.java
JarSigner.java
tools/gnu/classpath/tools/keytool: IdentityDBCmd.java
KeyCloneCmd.java
KeyPasswdCmd.java
PrintCertCmd.java
ListCmd.java
StorePasswdCmd.java
DeleteCmd.java
CertReqCmd.java Messages.java
CACertCmd.java GenKeyCmd.java
ImportCmd.java ExportCmd.java
SelfCertCmd.java Command.java
Main.java
Log message:
2006-06-12 Raif S. Naffah <address@hidden>
* tools/gnu/classpath/tools/keytool/StorePasswdCmd.java:
Condition all
trace/debug code based on Configuration.DEBUG.
* tools/gnu/classpath/tools/keytool/SelfCertCmd.java: Likewise.
* tools/gnu/classpath/tools/keytool/PrintCertCmd.java: Likewise.
* tools/gnu/classpath/tools/keytool/Messages.java: Likewise.
* tools/gnu/classpath/tools/keytool/Main.java: Likewise.
* tools/gnu/classpath/tools/keytool/ListCmd.java: Likewise.
* tools/gnu/classpath/tools/keytool/KeyPasswdCmd.java: Likewise.
* tools/gnu/classpath/tools/keytool/KeyCloneCmd.java: Likewise.
* tools/gnu/classpath/tools/keytool/ImportCmd.java: Likewise.
* tools/gnu/classpath/tools/keytool/IdentityDBCmd.java:
Likewise.
* tools/gnu/classpath/tools/keytool/GenKeyCmd.java: Likewise.
* tools/gnu/classpath/tools/keytool/ExportCmd.java: Likewise.
* tools/gnu/classpath/tools/keytool/DeleteCmd.java: Likewise.
* tools/gnu/classpath/tools/keytool/Command.java: Likewise.
* tools/gnu/classpath/tools/keytool/CertReqCmd.java: Likewise.
* tools/gnu/classpath/tools/keytool/CACertCmd.java: Likewise.
* tools/gnu/classpath/tools/jarsigner/SFHelper.java: Likewise.
* tools/gnu/classpath/tools/jarsigner/Messages.java: Likewise.
* tools/gnu/classpath/tools/jarsigner/Main.java: Likewise.
* tools/gnu/classpath/tools/jarsigner/JarVerifier.java:
Likewise.
* tools/gnu/classpath/tools/jarsigner/JarSigner.java: Likewise.
* tools/gnu/classpath/tools/jarsigner/HashUtils.java: Likewise.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/jarsigner/Messages.java?cvsroot=classpath&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/jarsigner/SFHelper.java?cvsroot=classpath&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/jarsigner/Main.java?cvsroot=classpath&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/jarsigner/JarVerifier.java?cvsroot=classpath&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/jarsigner/HashUtils.java?cvsroot=classpath&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/jarsigner/JarSigner.java?cvsroot=classpath&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/keytool/IdentityDBCmd.java?cvsroot=classpath&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/keytool/KeyCloneCmd.java?cvsroot=classpath&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/keytool/KeyPasswdCmd.java?cvsroot=classpath&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/keytool/PrintCertCmd.java?cvsroot=classpath&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/keytool/ListCmd.java?cvsroot=classpath&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/keytool/StorePasswdCmd.java?cvsroot=classpath&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/keytool/DeleteCmd.java?cvsroot=classpath&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/keytool/CertReqCmd.java?cvsroot=classpath&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/keytool/Messages.java?cvsroot=classpath&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/keytool/CACertCmd.java?cvsroot=classpath&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/keytool/GenKeyCmd.java?cvsroot=classpath&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/keytool/ImportCmd.java?cvsroot=classpath&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/keytool/ExportCmd.java?cvsroot=classpath&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/keytool/SelfCertCmd.java?cvsroot=classpath&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/keytool/Command.java?cvsroot=classpath&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/classpath/tools/gnu/classpath/tools/keytool/Main.java?cvsroot=classpath&r1=1.3&r2=1.4
Patches:
Index: jarsigner/Messages.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/jarsigner/Messages.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- jarsigner/Messages.java 21 May 2006 01:49:03 -0000 1.2
+++ jarsigner/Messages.java 12 Jun 2006 05:14:06 -0000 1.3
@@ -38,6 +38,8 @@
package gnu.classpath.tools.jarsigner;
+import gnu.classpath.Configuration;
+
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
@@ -99,6 +101,7 @@
}
catch (IllegalArgumentException x)
{
+ if (Configuration.DEBUG)
log.fine("Exception while rendering a message format keyed by ["
+ key + "]: " + mf.toPattern());
return constructMessage(mf.toPattern(), args);
Index: jarsigner/SFHelper.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/jarsigner/SFHelper.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- jarsigner/SFHelper.java 2 May 2006 01:00:22 -0000 1.5
+++ jarsigner/SFHelper.java 12 Jun 2006 05:14:06 -0000 1.6
@@ -38,6 +38,7 @@
package gnu.classpath.tools.jarsigner;
+import gnu.classpath.Configuration;
import gnu.java.security.OID;
import gnu.java.security.Registry;
import gnu.java.security.der.DER;
@@ -142,7 +143,8 @@
ByteArrayOutputStream baos = new ByteArrayOutputStream();
JarUtils.writeSFManifest(sfMainAttributes, sfEntries, baos);
sfBytes = baos.toByteArray();
- log.finest("\n" + Util.dumpString(sfBytes, "+++ sfBytes ")); //$NON-NLS-1$
//$NON-NLS-2$
+ if (Configuration.DEBUG)
+ log.fine("\n" + Util.dumpString(sfBytes, "+++ sfBytes ")); //$NON-NLS-1$
//$NON-NLS-2$
jar.write(sfBytes);
jar.flush();
@@ -216,7 +218,8 @@
if (this.state != SF_GENERATED)
throw new IllegalStateException(Messages.getString("SFHelper.4"));
//$NON-NLS-1$
- log.finest("+++ signer private key = " + signerKey); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ log.fine("+++ signer private key = " + signerKey); //$NON-NLS-1$
ISignature signatureAlgorithm;
ISignatureCodec signatureCodec;
OID digestEncryptionAlgorithmOID;
@@ -241,7 +244,8 @@
signatureAlgorithm.update(sfBytes, 0, sfBytes.length);
Object signature = signatureAlgorithm.sign();
byte[] signedSFBytes = signatureCodec.encodeSignature(signature);
- log.finest("\n" + Util.dumpString(signedSFBytes, "+++ signedSFBytes "));
//$NON-NLS-1$ //$NON-NLS-2$
+ if (Configuration.DEBUG)
+ log.fine("\n" + Util.dumpString(signedSFBytes, "+++ signedSFBytes "));
//$NON-NLS-1$ //$NON-NLS-2$
Set digestAlgorithms = new HashSet();
List digestAlgorithm = new ArrayList(2);
@@ -322,7 +326,8 @@
String name = entry.getName();
InputStream jeis = jar.getInputStream(entry);
String hash = util.hashStream(jeis);
- log.finer("Hash of " + name + " = " + hash); //$NON-NLS-1$ //$NON-NLS-2$
+ if (Configuration.DEBUG)
+ log.fine("Hash of " + name + " = " + hash); //$NON-NLS-1$ //$NON-NLS-2$
Attributes mainfestAttributes = manifest.getAttributes(name);
if (mainfestAttributes == null)
@@ -344,9 +349,12 @@
}
sfAttributes.putValue(Main.DIGEST, sfHash);
- log.finest("Name: " + name); //$NON-NLS-1$
- log.finest(Main.DIGEST + ": " + sfHash); //$NON-NLS-1$
- log.finest(""); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ {
+ log.fine("Name: " + name); //$NON-NLS-1$
+ log.fine(Main.DIGEST + ": " + sfHash); //$NON-NLS-1$
+ log.fine(""); //$NON-NLS-1$
+ }
}
/**
@@ -365,6 +373,7 @@
manifest.write(baos);
baos.flush();
String manifestHash = util.hashByteArray(baos.toByteArray());
+ if (Configuration.DEBUG)
log.fine("Hashed Manifest " + manifestHash); //$NON-NLS-1$
sfMainAttributes.putValue(Main.DIGEST_MANIFEST, manifestHash);
Index: jarsigner/Main.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/jarsigner/Main.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- jarsigner/Main.java 15 May 2006 11:47:08 -0000 1.12
+++ jarsigner/Main.java 12 Jun 2006 05:14:06 -0000 1.13
@@ -38,6 +38,7 @@
package gnu.classpath.tools.jarsigner;
+import gnu.classpath.Configuration;
import gnu.classpath.SystemProperties;
import gnu.classpath.tools.common.CallbackUtil;
import gnu.classpath.tools.common.ProviderUtil;
@@ -131,8 +132,8 @@
public static final void main(String[] args)
{
+ if (Configuration.DEBUG)
log.entering(Main.class.getName(), "main", args); //$NON-NLS-1$
-
Main tool = new Main();
int result = 1;
try
@@ -143,11 +144,13 @@
}
catch (SecurityException x)
{
+ if (Configuration.DEBUG)
log.throwing(Main.class.getName(), "main", x); //$NON-NLS-1$
System.err.println(Messages.getString("Main.7") + x.getMessage());
//$NON-NLS-1$
}
catch (Exception x)
{
+ if (Configuration.DEBUG)
log.throwing(Main.class.getName(), "main", x); //$NON-NLS-1$
System.err.println(Messages.getString("Main.9") + x); //$NON-NLS-1$
}
@@ -155,7 +158,7 @@
{
tool.teardown();
}
-
+ if (Configuration.DEBUG)
log.exiting(Main.class.getName(), "main", Integer.valueOf(result));
//$NON-NLS-1$
System.exit(result);
}
@@ -171,8 +174,8 @@
*/
private void processArgs(String[] args) throws Exception
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "processArgs", args); //$NON-NLS-1$
-
cmdLineParser = new ToolParser();
cmdLineParser.initializeParser();
cmdLineParser.parse(args, new ToolParserCallback());
@@ -180,35 +183,40 @@
setupCommonParams();
if (verify)
{
- log.finer("Will verify with the following parameters:"); //$NON-NLS-1$
- log.finer(" jar-file = '" + jarFileName + "'"); //$NON-NLS-1$
//$NON-NLS-2$
- log.finer("Options:"); //$NON-NLS-1$
- log.finer(" provider = '" + providerClassName + "'");
//$NON-NLS-1$ //$NON-NLS-2$
- log.finer(" verbose ? " + verbose); //$NON-NLS-1$
- log.finer(" certs ? " + certs); //$NON-NLS-1$
- log.finer(" internalsf ? " + internalSF); //$NON-NLS-1$
- log.finer(" sectionsonly ? " + sectionsOnly); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ {
+ log.fine("Will verify with the following parameters:");
//$NON-NLS-1$
+ log.fine(" jar-file = '" + jarFileName + "'"); //$NON-NLS-1$
//$NON-NLS-2$
+ log.fine("Options:"); //$NON-NLS-1$
+ log.fine(" provider = '" + providerClassName + "'");
//$NON-NLS-1$ //$NON-NLS-2$
+ log.fine(" verbose ? " + verbose); //$NON-NLS-1$
+ log.fine(" certs ? " + certs); //$NON-NLS-1$
+ log.fine(" internalsf ? " + internalSF); //$NON-NLS-1$
+ log.fine(" sectionsonly ? " + sectionsOnly); //$NON-NLS-1$
+ }
}
else // sign
{
setupSigningParams();
-
- log.finer("Will sign with the following parameters:"); //$NON-NLS-1$
- log.finer(" jar-file = '" + jarFileName + "'"); //$NON-NLS-1$
//$NON-NLS-2$
- log.finer(" alias = '" + alias + "'"); //$NON-NLS-1$
//$NON-NLS-2$
- log.finer("Options:"); //$NON-NLS-1$
- log.finer(" keystore = '" + ksURL + "'"); //$NON-NLS-1$
//$NON-NLS-2$
- log.finer(" storetype = '" + ksType + "'"); //$NON-NLS-1$
//$NON-NLS-2$
- log.finer(" storepass = '" + ksPassword + "'"); //$NON-NLS-1$
//$NON-NLS-2$
- log.finer(" keypass = '" + password + "'"); //$NON-NLS-1$
//$NON-NLS-2$
- log.finer(" sigfile = '" + sigFileName + "'"); //$NON-NLS-1$
//$NON-NLS-2$
- log.finer(" signedjar = '" + signedJarFileName + "'");
//$NON-NLS-1$ //$NON-NLS-2$
- log.finer(" provider = '" + providerClassName + "'");
//$NON-NLS-1$ //$NON-NLS-2$
- log.finer(" verbose ? " + verbose); //$NON-NLS-1$
- log.finer(" internalsf ? " + internalSF); //$NON-NLS-1$
- log.finer(" sectionsonly ? " + sectionsOnly); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ {
+ log.fine("Will sign with the following parameters:"); //$NON-NLS-1$
+ log.fine(" jar-file = '" + jarFileName + "'"); //$NON-NLS-1$
//$NON-NLS-2$
+ log.fine(" alias = '" + alias + "'"); //$NON-NLS-1$
//$NON-NLS-2$
+ log.fine("Options:"); //$NON-NLS-1$
+ log.fine(" keystore = '" + ksURL + "'"); //$NON-NLS-1$
//$NON-NLS-2$
+ log.fine(" storetype = '" + ksType + "'"); //$NON-NLS-1$
//$NON-NLS-2$
+ log.fine(" storepass = '" + ksPassword + "'"); //$NON-NLS-1$
//$NON-NLS-2$
+ log.fine(" keypass = '" + password + "'"); //$NON-NLS-1$
//$NON-NLS-2$
+ log.fine(" sigfile = '" + sigFileName + "'"); //$NON-NLS-1$
//$NON-NLS-2$
+ log.fine(" signedjar = '" + signedJarFileName + "'");
//$NON-NLS-1$ //$NON-NLS-2$
+ log.fine(" provider = '" + providerClassName + "'");
//$NON-NLS-1$ //$NON-NLS-2$
+ log.fine(" verbose ? " + verbose); //$NON-NLS-1$
+ log.fine(" internalsf ? " + internalSF); //$NON-NLS-1$
+ log.fine(" sectionsonly ? " + sectionsOnly); //$NON-NLS-1$
}
-
+ }
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "processArgs"); //$NON-NLS-1$
}
@@ -222,8 +230,8 @@
*/
private void start() throws Exception
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "start"); //$NON-NLS-1$
-
if (verify)
{
JarVerifier jv = new JarVerifier(this);
@@ -234,7 +242,7 @@
JarSigner js = new JarSigner(this);
js.start();
}
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "start"); //$NON-NLS-1$
}
@@ -249,11 +257,12 @@
*/
private void teardown()
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "teardown"); //$NON-NLS-1$
-
if (providerInstalled)
ProviderUtil.removeProvider(provider.getName());
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "teardown"); //$NON-NLS-1$
}
@@ -279,8 +288,8 @@
private void setupCommonParams() throws InstantiationException,
IllegalAccessException, ClassNotFoundException, IOException
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "setupCommonParams"); //$NON-NLS-1$
-
File jar = new File(jarFileName);
if (! jar.exists())
throw new FileNotFoundException(jarFileName);
@@ -298,17 +307,22 @@
String providerName = provider.getName();
Provider installedProvider = Security.getProvider(providerName);
if (installedProvider != null)
+ {
+ if (Configuration.DEBUG)
log.finer("Provider " + providerName + " is already installed");
//$NON-NLS-1$ //$NON-NLS-2$
+ }
else // install it
installNewProvider();
}
if (! verbose && certs)
{
+ if (Configuration.DEBUG)
log.fine("Option <certs> is set but <verbose> is not. Ignored");
//$NON-NLS-1$
certs = false;
}
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "setupCommonParams"); //$NON-NLS-1$
}
@@ -319,10 +333,10 @@
*/
private void installNewProvider()
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "installNewProvider");
//$NON-NLS-1$
-
providerInstalled = ProviderUtil.addProvider(provider) != -1;
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "installNewProvider"); //$NON-NLS-1$
}
@@ -349,8 +363,8 @@
NoSuchAlgorithmException, CertificateException,
UnsupportedCallbackException, UnrecoverableKeyException
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "setupSigningParams");
//$NON-NLS-1$
-
if (ksURL == null || ksURL.trim().length() == 0)
{
String userHome = SystemProperties.getProperty("user.home");
//$NON-NLS-1$
@@ -424,7 +438,8 @@
signerPrivateKey = (PrivateKey) key;
signerCertificateChain = store.getCertificateChain(alias);
- log.finest(String.valueOf(signerCertificateChain));
+ if (Configuration.DEBUG)
+ log.fine(String.valueOf(signerCertificateChain));
if (sigFileName == null)
sigFileName = alias;
@@ -449,6 +464,7 @@
if (signedJarFileName == null)
signedJarFileName = jarFileName;
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "setupSigningParams"); //$NON-NLS-1$
}
@@ -547,7 +563,8 @@
if (! verify) // must have an ALIAS. use "mykey" if undefined
if (fileAndAlias.size() < 2)
{
- log.finer("Missing ALIAS argument. Will use [mykey] instead");
//$NON-NLS-1$
+ if (Configuration.DEBUG)
+ log.fine("Missing ALIAS argument. Will use [mykey] instead");
//$NON-NLS-1$
alias = "mykey"; //$NON-NLS-1$
}
else
Index: jarsigner/JarVerifier.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/jarsigner/JarVerifier.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- jarsigner/JarVerifier.java 2 May 2006 01:00:22 -0000 1.5
+++ jarsigner/JarVerifier.java 12 Jun 2006 05:14:06 -0000 1.6
@@ -38,6 +38,7 @@
package gnu.classpath.tools.jarsigner;
+import gnu.classpath.Configuration;
import gnu.java.security.OID;
import gnu.java.security.Registry;
import gnu.java.security.pkcs.PKCS7SignedData;
@@ -94,8 +95,8 @@
void start() throws Exception
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "start"); //$NON-NLS-1$
-
String jarFileName = main.getJarFileName();
jarFile = new JarFile(jarFileName);
@@ -144,7 +145,7 @@
System.out.println(Messages.getFormattedString("JarVerifier.7",
//$NON-NLS-1$
Integer.valueOf(limit)));
}
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "start"); //$NON-NLS-1$
}
@@ -162,9 +163,11 @@
private boolean verifySF(String sigFileName) throws CRLException,
CertificateException, ZipException, IOException
{
+ if (Configuration.DEBUG)
+ {
log.entering(this.getClass().getName(), "verifySF"); //$NON-NLS-1$
- log.finest("About to verify signature of " + sigFileName + "...");
//$NON-NLS-1$ //$NON-NLS-2$
-
+ log.fine("About to verify signature of " + sigFileName + "...");
//$NON-NLS-1$ //$NON-NLS-2$
+ }
// 1. find the corresponding .DSA file for this .SF file
JarEntry dsaEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName
+ JarUtils.DSA_SUFFIX);
@@ -186,12 +189,14 @@
if (encryptedDigest == null)
throw new SecurityException(Messages.getString("JarVerifier.16"));
//$NON-NLS-1$
- log.finest("\n" + Util.dumpString(encryptedDigest, "--- signedSFBytes "));
//$NON-NLS-1$ //$NON-NLS-2$
+ if (Configuration.DEBUG)
+ log.fine("\n" + Util.dumpString(encryptedDigest, "--- signedSFBytes "));
//$NON-NLS-1$ //$NON-NLS-2$
// 5. get the signer public key
Certificate cert = pkcs7SignedData.getCertificates()[0];
PublicKey verifierKey = cert.getPublicKey();
- log.finest("--- verifier public key = " + verifierKey); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ log.fine("--- verifier public key = " + verifierKey); //$NON-NLS-1$
// 6. verify the signature file signature
OID digestEncryptionAlgorithmOID =
signerInfo.getDigestEncryptionAlgorithmId();
@@ -225,10 +230,12 @@
signatureAlgorithm.update(buffer, 0, n);
boolean result = signatureAlgorithm.verify(herSignature);
- log.finer("Signature block [" + sigFileName + "] is " //$NON-NLS-1$
//$NON-NLS-2$
+ if (Configuration.DEBUG)
+ {
+ log.fine("Signature block [" + sigFileName + "] is " //$NON-NLS-1$
//$NON-NLS-2$
+ (result ? "" : "NOT ") + "OK"); //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
-
log.exiting(this.getClass().getName(), "verifySF",
Boolean.valueOf(result)); //$NON-NLS-1$
+ }
return result;
}
@@ -250,8 +257,8 @@
*/
private boolean verifySFEntries(String alias) throws IOException
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "verifySFEntries"); //$NON-NLS-1$
-
// 1. read the signature file
JarEntry jarEntry = jarFile.getJarEntry(JarUtils.META_INF + alias
+ JarUtils.SF_SUFFIX);
@@ -291,8 +298,9 @@
break;
}
- log.exiting(this.getClass().getName(), "verifySFEntries",
- Boolean.valueOf(result)); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ log.exiting(this.getClass().getName(), "verifySFEntries", //$NON-NLS-1$
+ Boolean.valueOf(result));
return result;
}
@@ -319,7 +327,8 @@
{
String expectedValue = getEntryHash(JarFile.MANIFEST_NAME);
boolean result = expectedValue.equalsIgnoreCase(hash);
- log.finest("Is " + name + " OK? " + result); //$NON-NLS-1$ //$NON-NLS-2$
+ if (Configuration.DEBUG)
+ log.fine("Is " + name + " OK? " + result); //$NON-NLS-1$ //$NON-NLS-2$
return result;
}
Index: jarsigner/HashUtils.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/jarsigner/HashUtils.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- jarsigner/HashUtils.java 29 Apr 2006 07:39:19 -0000 1.4
+++ jarsigner/HashUtils.java 12 Jun 2006 05:14:06 -0000 1.5
@@ -38,6 +38,7 @@
package gnu.classpath.tools.jarsigner;
+import gnu.classpath.Configuration;
import gnu.java.security.hash.Sha160;
import gnu.java.security.util.Base64;
import gnu.java.util.jar.JarUtils;
@@ -76,8 +77,8 @@
sha.update(buffer, 0, n);
count += n;
}
-
byte[] hash = sha.digest();
+ if (Configuration.DEBUG)
log.finest("Hashed " + count + " byte(s)");
String result = Base64.encode(hash);
return result;
@@ -92,6 +93,7 @@
{
sha.update(ba);
byte[] hash = sha.digest();
+ if (Configuration.DEBUG)
log.finest("Hashed " + ba.length + " byte(s)");
String result = Base64.encode(hash);
return result;
Index: jarsigner/JarSigner.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/jarsigner/JarSigner.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- jarsigner/JarSigner.java 13 May 2006 00:34:57 -0000 1.6
+++ jarsigner/JarSigner.java 12 Jun 2006 05:14:06 -0000 1.7
@@ -38,6 +38,7 @@
package gnu.classpath.tools.jarsigner;
+import gnu.classpath.Configuration;
import gnu.classpath.SystemProperties;
import gnu.java.util.jar.JarUtils;
@@ -69,8 +70,8 @@
void start() throws Exception
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "start"); //$NON-NLS-1$
-
JarFile jarFile = new JarFile(main.getJarFileName());
SFHelper sfHelper = new SFHelper(jarFile);
@@ -119,19 +120,22 @@
String signaturesFileName = main.getSigFileName();
String sfFileName = JarUtils.META_INF + signaturesFileName
+ JarUtils.SF_SUFFIX;
- log.finest("Processing " + sfFileName); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ log.fine("Processing " + sfFileName); //$NON-NLS-1$
JarEntry sfEntry = new JarEntry(sfFileName);
sfEntry.setTime(System.currentTimeMillis());
outSignedJarFile.putNextEntry(sfEntry);
sfHelper.writeSF(outSignedJarFile);
- log.finer("Created .SF file"); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ log.fine("Created .SF file"); //$NON-NLS-1$
if (main.isVerbose())
System.out.println(Messages.getString("JarSigner.8") + sfFileName);
//$NON-NLS-1$
// 4. create the .DSA file
String dsaFileName = JarUtils.META_INF + signaturesFileName
+ JarUtils.DSA_SUFFIX;
- log.finest("Processing " + dsaFileName); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ log.fine("Processing " + dsaFileName); //$NON-NLS-1$
JarEntry dsaEntry = new JarEntry(dsaFileName);
dsaEntry.setTime(System.currentTimeMillis());
outSignedJarFile.putNextEntry(dsaEntry);
@@ -139,7 +143,8 @@
main.getSignerPrivateKey(),
main.getSignerCertificateChain(),
main.isInternalSF());
- log.finer("Created .DSA file"); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ log.fine("Created .DSA file"); //$NON-NLS-1$
if (main.isVerbose())
System.out.println(Messages.getString("JarSigner.8") + dsaFileName);
//$NON-NLS-1$
@@ -147,11 +152,12 @@
outSignedJarFile.close();
fos.close();
signedJarFile.renameTo(new File(main.getSignedJarFileName()));
- log.finer("Renamed signed JAR file"); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ log.fine("Renamed signed JAR file"); //$NON-NLS-1$
if (main.isVerbose())
System.out.println(SystemProperties.getProperty("line.separator")
//$NON-NLS-1$
+ Messages.getString("JarSigner.14")); //$NON-NLS-1$
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "start"); //$NON-NLS-1$
}
Index: keytool/IdentityDBCmd.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/keytool/IdentityDBCmd.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- keytool/IdentityDBCmd.java 1 Jun 2006 19:50:36 -0000 1.4
+++ keytool/IdentityDBCmd.java 12 Jun 2006 05:14:07 -0000 1.5
@@ -38,6 +38,7 @@
package gnu.classpath.tools.keytool;
+import gnu.classpath.Configuration;
import gnu.classpath.tools.getopt.ClasspathToolParser;
import gnu.classpath.tools.getopt.Option;
import gnu.classpath.tools.getopt.OptionException;
@@ -149,21 +150,23 @@
{
setInputStreamParam(_idbFileName);
setKeyStoreParams(_providerClassName, _ksType, _ksPassword, _ksURL);
-
- log.finer("-identitydb handler will use the following options:");
//$NON-NLS-1$
- log.finer(" -file=" + _idbFileName); //$NON-NLS-1$
- log.finer(" -storetype=" + storeType); //$NON-NLS-1$
- log.finer(" -keystore=" + storeURL); //$NON-NLS-1$
- log.finer(" -provider=" + provider); //$NON-NLS-1$
- log.finer(" -v=" + verbose); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ {
+ log.fine("-identitydb handler will use the following options:");
//$NON-NLS-1$
+ log.fine(" -file=" + _idbFileName); //$NON-NLS-1$
+ log.fine(" -storetype=" + storeType); //$NON-NLS-1$
+ log.fine(" -keystore=" + storeURL); //$NON-NLS-1$
+ log.fine(" -provider=" + provider); //$NON-NLS-1$
+ log.fine(" -v=" + verbose); //$NON-NLS-1$
+ }
}
// own methods --------------------------------------------------------------
Parser getParser()
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "getParser"); //$NON-NLS-1$
-
Parser result = new ClasspathToolParser(Main.IDENTITYDB_CMD, true);
result.setHeader(Messages.getString("IdentityDBCmd.7")); //$NON-NLS-1$
result.setFooter(Messages.getString("IdentityDBCmd.8")); //$NON-NLS-1$
@@ -222,7 +225,7 @@
}
});
result.add(options);
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "getParser", result); //$NON-NLS-1$
return result;
}
Index: keytool/KeyCloneCmd.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/keytool/KeyCloneCmd.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- keytool/KeyCloneCmd.java 1 Jun 2006 19:50:36 -0000 1.4
+++ keytool/KeyCloneCmd.java 12 Jun 2006 05:14:07 -0000 1.5
@@ -38,6 +38,7 @@
package gnu.classpath.tools.keytool;
+import gnu.classpath.Configuration;
import gnu.classpath.tools.getopt.ClasspathToolParser;
import gnu.classpath.tools.getopt.Option;
import gnu.classpath.tools.getopt.OptionException;
@@ -209,22 +210,24 @@
setAliasParam(_alias);
setKeyPasswordNoPrompt(_password);
setDestinationAlias(_destAlias);
-
- log.finer("-keyclone handler will use the following options:");
//$NON-NLS-1$
- log.finer(" -alias=" + alias); //$NON-NLS-1$
- log.finer(" -dest=" + destinationAlias); //$NON-NLS-1$
- log.finer(" -storetype=" + storeType); //$NON-NLS-1$
- log.finer(" -keystore=" + storeURL); //$NON-NLS-1$
- log.finer(" -provider=" + provider); //$NON-NLS-1$
- log.finer(" -v=" + verbose); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ {
+ log.fine("-keyclone handler will use the following options:");
//$NON-NLS-1$
+ log.fine(" -alias=" + alias); //$NON-NLS-1$
+ log.fine(" -dest=" + destinationAlias); //$NON-NLS-1$
+ log.fine(" -storetype=" + storeType); //$NON-NLS-1$
+ log.fine(" -keystore=" + storeURL); //$NON-NLS-1$
+ log.fine(" -provider=" + provider); //$NON-NLS-1$
+ log.fine(" -v=" + verbose); //$NON-NLS-1$
+ }
}
void start() throws KeyStoreException, NoSuchAlgorithmException, IOException,
UnsupportedCallbackException, UnrecoverableKeyException,
CertificateException
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "start"); //$NON-NLS-1$
-
if (store.containsAlias(destinationAlias))
throw new SecurityException(Messages.getString("KeyCloneCmd.23"));
//$NON-NLS-1$
@@ -236,7 +239,7 @@
store.setKeyEntry(destinationAlias, privateKey, newKeyPasswordChars,
chain);
saveKeyStore();
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "start"); //$NON-NLS-1$
}
@@ -244,8 +247,8 @@
Parser getParser()
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "getParser"); //$NON-NLS-1$
-
Parser result = new ClasspathToolParser(Main.KEYCLONE_CMD, true);
result.setHeader(Messages.getString("KeyCloneCmd.22")); //$NON-NLS-1$
result.setFooter(Messages.getString("KeyCloneCmd.21")); //$NON-NLS-1$
@@ -331,7 +334,7 @@
}
});
result.add(options);
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "getParser", result); //$NON-NLS-1$
return result;
}
Index: keytool/KeyPasswdCmd.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/keytool/KeyPasswdCmd.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- keytool/KeyPasswdCmd.java 1 Jun 2006 19:50:36 -0000 1.4
+++ keytool/KeyPasswdCmd.java 12 Jun 2006 05:14:07 -0000 1.5
@@ -38,6 +38,7 @@
package gnu.classpath.tools.keytool;
+import gnu.classpath.Configuration;
import gnu.classpath.SystemProperties;
import gnu.classpath.tools.getopt.ClasspathToolParser;
import gnu.classpath.tools.getopt.Option;
@@ -195,22 +196,24 @@
setKeyStoreParams(_providerClassName, _ksType, _ksPassword, _ksURL);
setAliasParam(_alias);
setKeyPasswordNoPrompt(_password);
-
- log.finer("-keypasswd handler will use the following options:");
//$NON-NLS-1$
- log.finer(" -alias=" + alias); //$NON-NLS-1$
- log.finer(" -new=" + _newPassword); //$NON-NLS-1$
- log.finer(" -storetype=" + storeType); //$NON-NLS-1$
- log.finer(" -keystore=" + storeURL); //$NON-NLS-1$
- log.finer(" -provider=" + provider); //$NON-NLS-1$
- log.finer(" -v=" + verbose); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ {
+ log.fine("-keypasswd handler will use the following options:");
//$NON-NLS-1$
+ log.fine(" -alias=" + alias); //$NON-NLS-1$
+ log.fine(" -new=" + _newPassword); //$NON-NLS-1$
+ log.fine(" -storetype=" + storeType); //$NON-NLS-1$
+ log.fine(" -keystore=" + storeURL); //$NON-NLS-1$
+ log.fine(" -provider=" + provider); //$NON-NLS-1$
+ log.fine(" -v=" + verbose); //$NON-NLS-1$
+ }
}
void start() throws KeyStoreException, NoSuchAlgorithmException, IOException,
UnsupportedCallbackException, UnrecoverableKeyException,
CertificateException
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "start"); //$NON-NLS-1$
-
// 1. get the key entry and certificate chain associated to alias
Key privateKey = getAliasPrivateKey();
Certificate[] chain = store.getCertificateChain(alias);
@@ -221,7 +224,7 @@
// 3. persist the key store
saveKeyStore();
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "start"); //$NON-NLS-1$
}
@@ -229,8 +232,8 @@
Parser getParser()
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "getParser"); //$NON-NLS-1$
-
Parser result = new ClasspathToolParser(Main.KEYPASSWD_CMD, true);
result.setHeader(Messages.getString("KeyPasswdCmd.23")); //$NON-NLS-1$
result.setFooter(Messages.getString("KeyPasswdCmd.22")); //$NON-NLS-1$
@@ -307,7 +310,7 @@
}
});
result.add(options);
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "getParser", result); //$NON-NLS-1$
return result;
}
Index: keytool/PrintCertCmd.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/keytool/PrintCertCmd.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- keytool/PrintCertCmd.java 14 May 2006 08:20:18 -0000 1.2
+++ keytool/PrintCertCmd.java 12 Jun 2006 05:14:07 -0000 1.3
@@ -38,6 +38,7 @@
package gnu.classpath.tools.keytool;
+import gnu.classpath.Configuration;
import gnu.classpath.tools.getopt.ClasspathToolParser;
import gnu.classpath.tools.getopt.Option;
import gnu.classpath.tools.getopt.OptionException;
@@ -86,22 +87,24 @@
void setup() throws Exception
{
setInputStreamParam(_certFileName);
-
- log.finer("-printcert handler will use the following options:");
//$NON-NLS-1$
- log.finer(" -file=" + _certFileName); //$NON-NLS-1$
- log.finer(" -v=" + verbose); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ {
+ log.fine("-printcert handler will use the following options:");
//$NON-NLS-1$
+ log.fine(" -file=" + _certFileName); //$NON-NLS-1$
+ log.fine(" -v=" + verbose); //$NON-NLS-1$
+ }
}
void start() throws CertificateException
{
+ if (Configuration.DEBUG)
log.entering(getClass().getName(), "start"); //$NON-NLS-1$
-
CertificateFactory x509Factory =
CertificateFactory.getInstance(Main.X_509);
Certificate certificate = x509Factory.generateCertificate(inStream);
PrintWriter writer = new PrintWriter(System.out, true);
writer.println();
printVerbose(certificate, writer);
-
+ if (Configuration.DEBUG)
log.exiting(getClass().getName(), "start"); //$NON-NLS-1$
}
@@ -109,8 +112,8 @@
Parser getParser()
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "getParser"); //$NON-NLS-1$
-
Parser result = new ClasspathToolParser(Main.PRINTCERT_CMD, true);
result.setHeader(Messages.getString("PrintCertCmd.5")); //$NON-NLS-1$
result.setFooter(Messages.getString("PrintCertCmd.6")); //$NON-NLS-1$
@@ -133,7 +136,7 @@
}
});
result.add(options);
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "getParser", result); //$NON-NLS-1$
return result;
}
Index: keytool/ListCmd.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/keytool/ListCmd.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- keytool/ListCmd.java 1 Jun 2006 19:50:36 -0000 1.4
+++ keytool/ListCmd.java 12 Jun 2006 05:14:07 -0000 1.5
@@ -38,6 +38,7 @@
package gnu.classpath.tools.keytool;
+import gnu.classpath.Configuration;
import gnu.classpath.tools.getopt.ClasspathToolParser;
import gnu.classpath.tools.getopt.Option;
import gnu.classpath.tools.getopt.OptionException;
@@ -181,32 +182,36 @@
if (verbose & rfc)
{
- log.warning("Both -v and -rfc options were found on the command line.
" //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ log.fine("Both -v and -rfc options were found on the command line. "
//$NON-NLS-1$
+ "Only the former will be considered"); //$NON-NLS-1$
rfc = false;
}
-
- log.finer("-list handler will use the following options:"); //$NON-NLS-1$
- log.finer(" -alias=" + alias); //$NON-NLS-1$
- log.finer(" -storetype=" + storeType); //$NON-NLS-1$
- log.finer(" -keystore=" + storeURL); //$NON-NLS-1$
- log.finer(" -provider=" + provider); //$NON-NLS-1$
- log.finer(" -v=" + verbose); //$NON-NLS-1$
- log.finer(" -rfc=" + rfc); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ {
+ log.fine("-list handler will use the following options:");
//$NON-NLS-1$
+ log.fine(" -alias=" + alias); //$NON-NLS-1$
+ log.fine(" -storetype=" + storeType); //$NON-NLS-1$
+ log.fine(" -keystore=" + storeURL); //$NON-NLS-1$
+ log.fine(" -provider=" + provider); //$NON-NLS-1$
+ log.fine(" -v=" + verbose); //$NON-NLS-1$
+ log.fine(" -rfc=" + rfc); //$NON-NLS-1$
+ }
}
void start() throws KeyStoreException, CertificateEncodingException,
IOException
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "start"); //$NON-NLS-1$
-
PrintWriter writer = new PrintWriter(outStream, true);
writer.println(Messages.getFormattedString("ListCmd.21",
store.getType())); //$NON-NLS-1$
writer.println(Messages.getFormattedString("ListCmd.22", //$NON-NLS-1$
store.getProvider().getName()));
if (all)
{
- log.finest("About to list all aliases in key store..."); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ log.fine("About to list all aliases in key store..."); //$NON-NLS-1$
writer.println();
writer.println(Messages.getFormattedString("ListCmd.24", //$NON-NLS-1$
Integer.valueOf(store.size())));
@@ -219,7 +224,7 @@
}
else
list1Alias(alias, writer);
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "start"); //$NON-NLS-1$
}
@@ -227,8 +232,8 @@
Parser getParser()
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "getParser"); //$NON-NLS-1$
-
Parser result = new ClasspathToolParser(Main.LIST_CMD, true);
result.setHeader(Messages.getString("ListCmd.20")); //$NON-NLS-1$
result.setFooter(Messages.getString("ListCmd.19")); //$NON-NLS-1$
@@ -295,7 +300,7 @@
}
});
result.add(options);
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "getParser", result); //$NON-NLS-1$
return result;
}
@@ -314,12 +319,12 @@
private void list1Alias(String anAlias, PrintWriter writer)
throws KeyStoreException, CertificateEncodingException, IOException
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "list1Alias", anAlias);
//$NON-NLS-1$
-
writer.println();
writer.println(Messages.getFormattedString("ListCmd.30", anAlias));
//$NON-NLS-1$
- writer.println(Messages.getFormattedString("ListCmd.31",
store.getCreationDate(anAlias))); //$NON-NLS-1$
-
+ writer.println(Messages.getFormattedString("ListCmd.31", //$NON-NLS-1$
+
store.getCreationDate(anAlias)));
if (store.isCertificateEntry(anAlias))
{
writer.println(Messages.getString("ListCmd.32")); //$NON-NLS-1$
@@ -335,6 +340,7 @@
else
throw new
IllegalArgumentException(Messages.getFormattedString("ListCmd.34", //$NON-NLS-1$
anAlias));
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "list1Alias"); //$NON-NLS-1$
}
Index: keytool/StorePasswdCmd.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/keytool/StorePasswdCmd.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- keytool/StorePasswdCmd.java 1 Jun 2006 19:50:36 -0000 1.4
+++ keytool/StorePasswdCmd.java 12 Jun 2006 05:14:07 -0000 1.5
@@ -38,6 +38,7 @@
package gnu.classpath.tools.keytool;
+import gnu.classpath.Configuration;
import gnu.classpath.SystemProperties;
import gnu.classpath.tools.getopt.ClasspathToolParser;
import gnu.classpath.tools.getopt.Option;
@@ -159,21 +160,23 @@
{
setKeyStoreParams(_providerClassName, _ksType, _ksPassword, _ksURL);
setNewKeystorePassword(_newPassword);
-
- log.finer("-storepasswd handler will use the following options:");
//$NON-NLS-1$
- log.finer(" -storetype=" + storeType); //$NON-NLS-1$
- log.finer(" -keystore=" + storeURL); //$NON-NLS-1$
- log.finer(" -provider=" + provider); //$NON-NLS-1$
- log.finer(" -v=" + verbose); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ {
+ log.fine("-storepasswd handler will use the following options:");
//$NON-NLS-1$
+ log.fine(" -storetype=" + storeType); //$NON-NLS-1$
+ log.fine(" -keystore=" + storeURL); //$NON-NLS-1$
+ log.fine(" -provider=" + provider); //$NON-NLS-1$
+ log.fine(" -v=" + verbose); //$NON-NLS-1$
+ }
}
void start() throws KeyStoreException, NoSuchAlgorithmException,
CertificateException, IOException
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "start"); //$NON-NLS-1$
-
saveKeyStore(newStorePasswordChars);
-
+ if (Configuration.DEBUG)
log.exiting(getClass().getName(), "start"); //$NON-NLS-1$
}
@@ -181,8 +184,8 @@
Parser getParser()
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "getParser"); //$NON-NLS-1$
-
Parser result = new ClasspathToolParser(Main.STOREPASSWD_CMD, true);
result.setHeader(Messages.getString("StorePasswdCmd.18")); //$NON-NLS-1$
result.setFooter(Messages.getString("StorePasswdCmd.17")); //$NON-NLS-1$
@@ -241,7 +244,7 @@
}
});
result.add(options);
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "getParser", result); //$NON-NLS-1$
return result;
}
Index: keytool/DeleteCmd.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/keytool/DeleteCmd.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- keytool/DeleteCmd.java 1 Jun 2006 19:50:36 -0000 1.4
+++ keytool/DeleteCmd.java 12 Jun 2006 05:14:07 -0000 1.5
@@ -38,6 +38,7 @@
package gnu.classpath.tools.keytool;
+import gnu.classpath.Configuration;
import gnu.classpath.tools.getopt.ClasspathToolParser;
import gnu.classpath.tools.getopt.Option;
import gnu.classpath.tools.getopt.OptionException;
@@ -158,24 +159,26 @@
{
setKeyStoreParams(_providerClassName, _ksType, _ksPassword, _ksURL);
setTheAlias(_alias);
-
- log.finer("-delete handler will use the following options:"); //$NON-NLS-1$
- log.finer(" -alias=" + alias); //$NON-NLS-1$
- log.finer(" -storetype=" + storeType); //$NON-NLS-1$
- log.finer(" -keystore=" + storeURL); //$NON-NLS-1$
- log.finer(" -provider=" + provider); //$NON-NLS-1$
- log.finer(" -v=" + verbose); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ {
+ log.fine("-delete handler will use the following options:");
//$NON-NLS-1$
+ log.fine(" -alias=" + alias); //$NON-NLS-1$
+ log.fine(" -storetype=" + storeType); //$NON-NLS-1$
+ log.fine(" -keystore=" + storeURL); //$NON-NLS-1$
+ log.fine(" -provider=" + provider); //$NON-NLS-1$
+ log.fine(" -v=" + verbose); //$NON-NLS-1$
+ }
}
void start() throws KeyStoreException, NoSuchAlgorithmException,
CertificateException, IOException
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "start"); //$NON-NLS-1$
-
ensureStoreContainsAlias();
store.deleteEntry(alias);
saveKeyStore();
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "start"); //$NON-NLS-1$
}
@@ -183,8 +186,8 @@
Parser getParser()
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "getParser"); //$NON-NLS-1$
-
Parser result = new ClasspathToolParser(Main.DELETE_CMD, true);
result.setHeader(Messages.getString("DeleteCmd.18")); //$NON-NLS-1$
result.setFooter(Messages.getString("DeleteCmd.17")); //$NON-NLS-1$
@@ -243,7 +246,7 @@
}
});
result.add(options);
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "getParser", result); //$NON-NLS-1$
return result;
}
Index: keytool/CertReqCmd.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/keytool/CertReqCmd.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- keytool/CertReqCmd.java 1 Jun 2006 19:50:36 -0000 1.4
+++ keytool/CertReqCmd.java 12 Jun 2006 05:14:07 -0000 1.5
@@ -38,6 +38,7 @@
package gnu.classpath.tools.keytool;
+import gnu.classpath.Configuration;
import gnu.classpath.tools.getopt.ClasspathToolParser;
import gnu.classpath.tools.getopt.Option;
import gnu.classpath.tools.getopt.OptionException;
@@ -258,24 +259,26 @@
setKeyStoreParams(_providerClassName, _ksType, _ksPassword, _ksURL);
setAliasParam(_alias);
setKeyPasswordNoPrompt(_password);
-
- log.finer("-certreq handler will use the following options:");
//$NON-NLS-1$
- log.finer(" -alias=" + alias); //$NON-NLS-1$
- log.finer(" -sigalg=" + _sigAlgorithm); //$NON-NLS-1$
- log.finer(" -file=" + _certReqFileName); //$NON-NLS-1$
- log.finer(" -storetype=" + storeType); //$NON-NLS-1$
- log.finer(" -keystore=" + storeURL); //$NON-NLS-1$
- log.finer(" -provider=" + provider); //$NON-NLS-1$
- log.finer(" -v=" + verbose); //$NON-NLS-1$
- log.finer(" -attributes=" + nullAttributes); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ {
+ log.fine("-certreq handler will use the following options:");
//$NON-NLS-1$
+ log.fine(" -alias=" + alias); //$NON-NLS-1$
+ log.fine(" -sigalg=" + _sigAlgorithm); //$NON-NLS-1$
+ log.fine(" -file=" + _certReqFileName); //$NON-NLS-1$
+ log.fine(" -storetype=" + storeType); //$NON-NLS-1$
+ log.fine(" -keystore=" + storeURL); //$NON-NLS-1$
+ log.fine(" -provider=" + provider); //$NON-NLS-1$
+ log.fine(" -v=" + verbose); //$NON-NLS-1$
+ log.fine(" -attributes=" + nullAttributes); //$NON-NLS-1$
+ }
}
void start() throws KeyStoreException, NoSuchAlgorithmException, IOException,
UnsupportedCallbackException, UnrecoverableKeyException,
InvalidKeyException, SignatureException
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "start"); //$NON-NLS-1$
-
// 1. get the key entry and certificate chain associated to alias
Key privateKey = getAliasPrivateKey();
Certificate[] chain = store.getCertificateChain(alias);
@@ -305,7 +308,7 @@
}
writer.close();
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "start"); //$NON-NLS-1$
}
@@ -313,8 +316,8 @@
Parser getParser()
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "getParser"); //$NON-NLS-1$
-
Parser result = new ClasspathToolParser(Main.CERTREQ_CMD, true);
result.setHeader(Messages.getString("CertReqCmd.25")); //$NON-NLS-1$
result.setFooter(Messages.getString("CertReqCmd.24")); //$NON-NLS-1$
@@ -408,7 +411,7 @@
}
});
result.add(options);
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "getParser", result); //$NON-NLS-1$
return result;
}
Index: keytool/Messages.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/keytool/Messages.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- keytool/Messages.java 21 May 2006 01:49:04 -0000 1.2
+++ keytool/Messages.java 12 Jun 2006 05:14:07 -0000 1.3
@@ -38,6 +38,8 @@
package gnu.classpath.tools.keytool;
+import gnu.classpath.Configuration;
+
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
@@ -99,6 +101,7 @@
}
catch (IllegalArgumentException x)
{
+ if (Configuration.DEBUG)
log.fine("Exception while rendering a message format keyed by ["
+ key + "]: " + mf.toPattern());
return constructMessage(mf.toPattern(), args);
Index: keytool/CACertCmd.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/keytool/CACertCmd.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- keytool/CACertCmd.java 11 Jun 2006 10:40:51 -0000 1.1
+++ keytool/CACertCmd.java 12 Jun 2006 05:14:07 -0000 1.2
@@ -38,6 +38,7 @@
package gnu.classpath.tools.keytool;
+import gnu.classpath.Configuration;
import gnu.classpath.tools.getopt.ClasspathToolParser;
import gnu.classpath.tools.getopt.Option;
import gnu.classpath.tools.getopt.OptionException;
@@ -164,17 +165,21 @@
{
setInputStreamParam(_certFileName);
setKeyStoreParams(_providerClassName, _ksType, _ksPassword, _ksURL);
- log.finer("-cacert handler will use the following options:"); //$NON-NLS-1$
- log.finer(" -file=" + _certFileName); //$NON-NLS-1$
- log.finer(" -storetype=" + storeType); //$NON-NLS-1$
- log.finer(" -keystore=" + storeURL); //$NON-NLS-1$
- log.finer(" -provider=" + provider); //$NON-NLS-1$
- log.finer(" -v=" + verbose); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ {
+ log.fine("-cacert handler will use the following options:");
//$NON-NLS-1$
+ log.fine(" -file=" + _certFileName); //$NON-NLS-1$
+ log.fine(" -storetype=" + storeType); //$NON-NLS-1$
+ log.fine(" -keystore=" + storeURL); //$NON-NLS-1$
+ log.fine(" -provider=" + provider); //$NON-NLS-1$
+ log.fine(" -v=" + verbose); //$NON-NLS-1$
+ }
}
void start() throws CertificateException, KeyStoreException,
NoSuchAlgorithmException, IOException
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "start"); //$NON-NLS-1$
alias = getAliasFromFileName(_certFileName);
if (store.containsAlias(alias))
@@ -182,13 +187,15 @@
alias));
x509Factory = CertificateFactory.getInstance("X.509"); //$NON-NLS-1$
Certificate certificate = x509Factory.generateCertificate(inStream);
- log.finest("certificate = " + certificate); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ log.fine("certificate = " + certificate); //$NON-NLS-1$
store.setCertificateEntry(alias, certificate);
saveKeyStore();
if (verbose)
System.out.println(Messages.getFormattedString("CACertCmd.1",
//$NON-NLS-1$
new Object[] {
_certFileName,
alias }));
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "start"); //$NON-NLS-1$
}
@@ -199,6 +206,7 @@
*/
Parser getParser()
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "getParser"); //$NON-NLS-1$
Parser result = new ClasspathToolParser(Main.CACERT_CMD, true);
result.setHeader(Messages.getString("CACertCmd.2")); //$NON-NLS-1$
@@ -258,6 +266,7 @@
}
});
result.add(options);
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "getParser", result); //$NON-NLS-1$
return result;
}
@@ -276,6 +285,7 @@
*/
private String getAliasFromFileName(String fileName)
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "getAliasFromFileName", fileName);
//$NON-NLS-1$
// get the basename
fileName = new File(fileName).getName();
@@ -296,6 +306,7 @@
chars[i] = '_';
}
String result = new String(chars);
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "getAliasFromFileName", result);
//$NON-NLS-1$
return result;
}
Index: keytool/GenKeyCmd.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/keytool/GenKeyCmd.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- keytool/GenKeyCmd.java 1 Jun 2006 19:50:36 -0000 1.4
+++ keytool/GenKeyCmd.java 12 Jun 2006 05:14:07 -0000 1.5
@@ -38,6 +38,7 @@
package gnu.classpath.tools.keytool;
+import gnu.classpath.Configuration;
import gnu.classpath.tools.getopt.ClasspathToolParser;
import gnu.classpath.tools.getopt.Option;
import gnu.classpath.tools.getopt.OptionException;
@@ -309,52 +310,60 @@
setKeySize(_keySizeStr);
setDName(_dName);
setValidityParam(_validityStr);
-
- log.finer("-genkey handler will use the following options:"); //$NON-NLS-1$
- log.finer(" -alias=" + alias); //$NON-NLS-1$
- log.finer(" -keyalg=" + keyPairGenerator.getAlgorithm()); //$NON-NLS-1$
- log.finer(" -keysize=" + keySize); //$NON-NLS-1$
- log.finer(" -sigalg=" + signatureAlgorithm.getAlgorithm()); //$NON-NLS-1$
- log.finer(" -dname=" + distinguishedName); //$NON-NLS-1$
- log.finer(" -validity=" + validityInDays); //$NON-NLS-1$
- log.finer(" -storetype=" + storeType); //$NON-NLS-1$
- log.finer(" -keystore=" + storeURL); //$NON-NLS-1$
- log.finer(" -provider=" + provider); //$NON-NLS-1$
- log.finer(" -v=" + verbose); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ {
+ log.fine("-genkey handler will use the following options:");
//$NON-NLS-1$
+ log.fine(" -alias=" + alias); //$NON-NLS-1$
+ log.fine(" -keyalg=" + keyPairGenerator.getAlgorithm()); //$NON-NLS-1$
+ log.fine(" -keysize=" + keySize); //$NON-NLS-1$
+ log.fine(" -sigalg=" + signatureAlgorithm.getAlgorithm());
//$NON-NLS-1$
+ log.fine(" -dname=" + distinguishedName); //$NON-NLS-1$
+ log.fine(" -validity=" + validityInDays); //$NON-NLS-1$
+ log.fine(" -storetype=" + storeType); //$NON-NLS-1$
+ log.fine(" -keystore=" + storeURL); //$NON-NLS-1$
+ log.fine(" -provider=" + provider); //$NON-NLS-1$
+ log.fine(" -v=" + verbose); //$NON-NLS-1$
+ }
}
void start() throws CertificateException, KeyStoreException,
InvalidKeyException, SignatureException, IOException,
NoSuchAlgorithmException
{
+ if (Configuration.DEBUG)
+ {
log.entering(this.getClass().getName(), "start"); //$NON-NLS-1$
-
+ log.fine("About to generate key-pair..."); //$NON-NLS-1$
+ }
// 1. generate a new key-pair
- log.finer("About to generate key-pair..."); //$NON-NLS-1$
keyPairGenerator.initialize(keySize);
KeyPair kp = keyPairGenerator.generateKeyPair();
PublicKey publicKey = kp.getPublic();
PrivateKey privateKey = kp.getPrivate();
// 2. generate a self-signed certificate
- log.finer("About to generate a self-signed certificate..."); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ log.fine("About to generate a self-signed certificate..."); //$NON-NLS-1$
byte[] derBytes = getSelfSignedCertificate(distinguishedName,
publicKey,
privateKey);
- log.finest(Util.dumpString(derBytes, "derBytes ")); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ log.fine(Util.dumpString(derBytes, "derBytes ")); //$NON-NLS-1$
CertificateFactory x509Factory =
CertificateFactory.getInstance(Main.X_509);
ByteArrayInputStream bais = new ByteArrayInputStream(derBytes);
Certificate certificate = x509Factory.generateCertificate(bais);
- log.finest("certificate = " + certificate); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ log.fine("certificate = " + certificate); //$NON-NLS-1$
// 3. store it, w/ its private key, associating them to alias
Certificate[] chain = new Certificate[] { certificate };
- log.finest("About to store newly generated material in key store...");
//$NON-NLS-1$
+ if (Configuration.DEBUG)
+ log.fine("About to store newly generated material in key store...");
//$NON-NLS-1$
store.setKeyEntry(alias, privateKey, keyPasswordChars, chain);
// 4. persist the key store
saveKeyStore();
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "start"); //$NON-NLS-1$
}
@@ -362,8 +371,8 @@
Parser getParser()
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "getParser"); //$NON-NLS-1$
-
Parser result = new ClasspathToolParser(Main.GENKEY_CMD, true);
result.setHeader(Messages.getString("GenKeyCmd.57")); //$NON-NLS-1$
result.setFooter(Messages.getString("GenKeyCmd.58")); //$NON-NLS-1$
@@ -476,7 +485,7 @@
}
});
result.add(options);
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "getParser", result); //$NON-NLS-1$
return result;
}
@@ -574,7 +583,7 @@
name = sb.toString().trim();
}
-
+ if (Configuration.DEBUG)
log.fine("dName=[" + name + "]"); //$NON-NLS-1$ //$NON-NLS-2$
distinguishedName = new X500DistinguishedName(name);
}
Index: keytool/ImportCmd.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/keytool/ImportCmd.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- keytool/ImportCmd.java 1 Jun 2006 19:50:36 -0000 1.5
+++ keytool/ImportCmd.java 12 Jun 2006 05:14:07 -0000 1.6
@@ -38,6 +38,7 @@
package gnu.classpath.tools.keytool;
+import gnu.classpath.Configuration;
import gnu.classpath.SystemProperties;
import gnu.classpath.tools.getopt.ClasspathToolParser;
import gnu.classpath.tools.getopt.Option;
@@ -294,24 +295,26 @@
setKeyStoreParams(_providerClassName, _ksType, _ksPassword, _ksURL);
setAliasParam(_alias);
setKeyPasswordNoPrompt(_password);
-
- log.finer("-import handler will use the following options:"); //$NON-NLS-1$
- log.finer(" -alias=" + alias); //$NON-NLS-1$
- log.finer(" -file=" + _certFileName); //$NON-NLS-1$
- log.finer(" -noprompt=" + noPrompt); //$NON-NLS-1$
- log.finer(" -trustcacerts=" + trustCACerts); //$NON-NLS-1$
- log.finer(" -storetype=" + storeType); //$NON-NLS-1$
- log.finer(" -keystore=" + storeURL); //$NON-NLS-1$
- log.finer(" -provider=" + provider); //$NON-NLS-1$
- log.finer(" -v=" + verbose); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ {
+ log.fine("-import handler will use the following options:");
//$NON-NLS-1$
+ log.fine(" -alias=" + alias); //$NON-NLS-1$
+ log.fine(" -file=" + _certFileName); //$NON-NLS-1$
+ log.fine(" -noprompt=" + noPrompt); //$NON-NLS-1$
+ log.fine(" -trustcacerts=" + trustCACerts); //$NON-NLS-1$
+ log.fine(" -storetype=" + storeType); //$NON-NLS-1$
+ log.fine(" -keystore=" + storeURL); //$NON-NLS-1$
+ log.fine(" -provider=" + provider); //$NON-NLS-1$
+ log.fine(" -v=" + verbose); //$NON-NLS-1$
+ }
}
void start() throws CertificateException, KeyStoreException, IOException,
UnsupportedCallbackException, NoSuchAlgorithmException,
CertPathValidatorException, UnrecoverableKeyException
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "start"); //$NON-NLS-1$
-
if (trustCACerts)
{
String fs = SystemProperties.getProperty("file.separator");
//$NON-NLS-1$
@@ -336,7 +339,7 @@
ensureAliasIsKeyEntry();
importCertificateReply();
}
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "start"); //$NON-NLS-1$
}
@@ -344,8 +347,8 @@
Parser getParser()
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "getParser"); //$NON-NLS-1$
-
Parser result = new ClasspathToolParser(Main.IMPORT_CMD, true);
result.setHeader(Messages.getString("ImportCmd.27")); //$NON-NLS-1$
result.setFooter(Messages.getString("ImportCmd.26")); //$NON-NLS-1$
@@ -438,7 +441,7 @@
}
});
result.add(options);
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "getParser", result); //$NON-NLS-1$
return result;
}
@@ -480,10 +483,11 @@
UnsupportedCallbackException, CertPathValidatorException,
UnrecoverableKeyException
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "importNewTrustedCertificate");
//$NON-NLS-1$
-
Certificate certificate = x509Factory.generateCertificate(inStream);
- log.finest("certificate = " + certificate); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ log.fine("certificate = " + certificate); //$NON-NLS-1$
LinkedList orderedReply = new LinkedList();
orderedReply.addLast(certificate);
@@ -495,7 +499,7 @@
}
else
System.out.println(Messages.getString("ImportCmd.28")); //$NON-NLS-1$
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "importNewTrustedCertificate");
//$NON-NLS-1$
}
@@ -525,8 +529,8 @@
NoSuchAlgorithmException, CertPathValidatorException,
UnrecoverableKeyException
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "importCertificateReply");
//$NON-NLS-1$
-
Collection certificates = x509Factory.generateCertificates(inStream);
ensureReplyIsOurs(certificates);
// we now have established that the public keys are the same.
@@ -535,7 +539,7 @@
importCertificate((Certificate) certificates.iterator().next());
else
importChain(certificates);
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "importCertificateReply");
//$NON-NLS-1$
}
@@ -564,8 +568,8 @@
KeyStoreException, UnrecoverableKeyException, IOException,
UnsupportedCallbackException, CertificateException
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "importCertificate", certificate);
//$NON-NLS-1$
-
LinkedList reply = new LinkedList();
reply.addLast(certificate);
@@ -576,7 +580,7 @@
Key privateKey = getAliasPrivateKey();
store.setKeyEntry(alias, privateKey, keyPasswordChars, newChain);
saveKeyStore();
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "importCertificate"); //$NON-NLS-1$
}
@@ -608,8 +612,8 @@
CertPathValidatorException, KeyStoreException, UnrecoverableKeyException,
IOException, UnsupportedCallbackException, CertificateException
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "importChain", chain);
//$NON-NLS-1$
-
LinkedList reply = orderChain(chain);
if (findTrustAndUpdate(reply, ! noPrompt))
{
@@ -618,7 +622,7 @@
store.setKeyEntry(alias, privateKey, keyPasswordChars, newChain);
saveKeyStore();
}
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "importChain"); //$NON-NLS-1$
}
@@ -638,10 +642,11 @@
private void ensureReplyIsOurs(Collection certificates) throws IOException,
UnsupportedCallbackException, KeyStoreException
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "ensureReplyIsOurs"); //$NON-NLS-1$
-
Certificate certificate = (Certificate) certificates.iterator().next();
- log.finest("certificate = " + certificate); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ log.fine("certificate = " + certificate); //$NON-NLS-1$
Certificate[] chain = store.getCertificateChain(alias);
if (chain == null)
throw new
IllegalArgumentException(Messages.getFormattedString("ImportCmd.37",
//$NON-NLS-1$
@@ -673,7 +678,7 @@
anchorPublicKey.getClass().getName() }));
if (! sameKey)
throw new IllegalArgumentException(Messages.getString("ImportCmd.41"));
//$NON-NLS-1$
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "ensureReplyIsOurs"); //$NON-NLS-1$
}
@@ -726,6 +731,7 @@
*/
private LinkedList orderChain(Collection chain)
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "orderChain"); //$NON-NLS-1$
LinkedList in = new LinkedList(chain);
int initialCount = in.size();
@@ -750,7 +756,8 @@
new Object[] {
Integer.valueOf(result.size()),
Integer.valueOf(initialCount) }));
}
- log.entering(this.getClass().getName(), "orderChain", result);
//$NON-NLS-1$
+ if (Configuration.DEBUG)
+ log.exiting(this.getClass().getName(), "orderChain", result);
//$NON-NLS-1$
return result;
}
@@ -786,6 +793,7 @@
KeyStoreException, UnrecoverableKeyException,
UnsupportedCallbackException,
CertificateEncodingException
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "findTrustAndUpdate");
//$NON-NLS-1$
CertPathValidator validator = CertPathValidator.getInstance("PKIX");
//$NON-NLS-1$
X509CertPath certPath = new X509CertPath(reply);
@@ -824,7 +832,8 @@
reply.addLast(trustedCert);
result = true;
}
- log.entering(this.getClass().getName(), "findTrustAndUpdate", //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ log.exiting(this.getClass().getName(), "findTrustAndUpdate",
//$NON-NLS-1$
Boolean.valueOf(result));
return result;
}
@@ -832,8 +841,8 @@
private PKIXCertPathValidatorResult findTrustInStore(X509CertPath certPath,
CertPathValidator
validator)
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "findTrustInStore"); //$NON-NLS-1$
-
PKIXCertPathValidatorResult result;
try
{
@@ -847,7 +856,7 @@
x);
result = null;
}
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "findTrustInStore", result);
//$NON-NLS-1$
return result;
}
@@ -864,6 +873,7 @@
*/
private PKIXParameters getCertPathParameters(String type, String pathName)
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "getCertPathParameters",
//$NON-NLS-1$
new Object[] { type, pathName });
FileInputStream stream = null;
@@ -877,6 +887,7 @@
}
catch (Exception x)
{
+ if (Configuration.DEBUG)
log.log(Level.FINE, "Exception in getCertPathParameters(). Ignore",
x); //$NON-NLS-1$
}
finally
@@ -890,6 +901,7 @@
{
}
}
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "getCertPathParameters", result);
//$NON-NLS-1$
return result;
}
@@ -898,6 +910,7 @@
X509CertPath certPath,
PKIXParameters params)
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "validate"); //$NON-NLS-1$
PKIXCertPathValidatorResult result = null;
if (params != null)
@@ -908,8 +921,10 @@
}
catch (Exception x)
{
+ if (Configuration.DEBUG)
log.log(Level.FINE, "Exception in validate(). Ignore", x);
//$NON-NLS-1$
}
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "validate", result); //$NON-NLS-1$
return result;
}
Index: keytool/ExportCmd.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/keytool/ExportCmd.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- keytool/ExportCmd.java 1 Jun 2006 19:50:36 -0000 1.5
+++ keytool/ExportCmd.java 12 Jun 2006 05:14:07 -0000 1.6
@@ -38,6 +38,7 @@
package gnu.classpath.tools.keytool;
+import gnu.classpath.Configuration;
import gnu.classpath.tools.getopt.ClasspathToolParser;
import gnu.classpath.tools.getopt.Option;
import gnu.classpath.tools.getopt.OptionException;
@@ -188,32 +189,36 @@
setOutputStreamParam(_certFileName);
setKeyStoreParams(_providerClassName, _ksType, _ksPassword, _ksURL);
setAliasParam(_alias);
-
- log.finer("-export handler will use the following options:"); //$NON-NLS-1$
- log.finer(" -alias=" + alias); //$NON-NLS-1$
- log.finer(" -file=" + _certFileName); //$NON-NLS-1$
- log.finer(" -storetype=" + storeType); //$NON-NLS-1$
- log.finer(" -keystore=" + storeURL); //$NON-NLS-1$
- log.finer(" -provider=" + provider); //$NON-NLS-1$
- log.finer(" -rfc=" + rfc); //$NON-NLS-1$
- log.finer(" -v=" + verbose); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ {
+ log.fine("-export handler will use the following options:");
//$NON-NLS-1$
+ log.fine(" -alias=" + alias); //$NON-NLS-1$
+ log.fine(" -file=" + _certFileName); //$NON-NLS-1$
+ log.fine(" -storetype=" + storeType); //$NON-NLS-1$
+ log.fine(" -keystore=" + storeURL); //$NON-NLS-1$
+ log.fine(" -provider=" + provider); //$NON-NLS-1$
+ log.fine(" -rfc=" + rfc); //$NON-NLS-1$
+ log.fine(" -v=" + verbose); //$NON-NLS-1$
+ }
}
void start() throws KeyStoreException, CertificateEncodingException,
IOException
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "start"); //$NON-NLS-1$
-
ensureStoreContainsAlias();
Certificate certificate;
if (store.isCertificateEntry(alias))
{
- log.finer("Alias [" + alias + "] is a trusted certificate");
//$NON-NLS-1$ //$NON-NLS-2$
+ if (Configuration.DEBUG)
+ log.fine("Alias [" + alias + "] is a trusted certificate");
//$NON-NLS-1$ //$NON-NLS-2$
certificate = store.getCertificate(alias);
}
else
{
- log.finer("Alias [" + alias + "] is a key entry"); //$NON-NLS-1$
//$NON-NLS-2$
+ if (Configuration.DEBUG)
+ log.fine("Alias [" + alias + "] is a key entry"); //$NON-NLS-1$
//$NON-NLS-2$
Certificate[] chain = store.getCertificateChain(alias);
certificate = chain[0];
}
@@ -231,6 +236,7 @@
outStream.write(derBytes);
// stream is closed in Command.teardown()
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "start"); //$NON-NLS-1$
}
@@ -238,8 +244,8 @@
Parser getParser()
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "getParser"); //$NON-NLS-1$
-
Parser result = new ClasspathToolParser(Main.EXPORT_CMD, true);
result.setHeader(Messages.getString("ExportCmd.17")); //$NON-NLS-1$
result.setFooter(Messages.getString("ExportCmd.18")); //$NON-NLS-1$
@@ -315,7 +321,7 @@
}
});
result.add(options);
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "getParser", result); //$NON-NLS-1$
return result;
}
Index: keytool/SelfCertCmd.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/keytool/SelfCertCmd.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- keytool/SelfCertCmd.java 1 Jun 2006 19:50:36 -0000 1.4
+++ keytool/SelfCertCmd.java 12 Jun 2006 05:14:07 -0000 1.5
@@ -38,6 +38,7 @@
package gnu.classpath.tools.keytool;
+import gnu.classpath.Configuration;
import gnu.classpath.tools.getopt.ClasspathToolParser;
import gnu.classpath.tools.getopt.Option;
import gnu.classpath.tools.getopt.OptionException;
@@ -264,24 +265,26 @@
setAliasParam(_alias);
setKeyPasswordNoPrompt(_password);
setValidityParam(_validityStr);
-
- log.finer("-selfcert handler will use the following options:");
//$NON-NLS-1$
- log.finer(" -alias=" + alias); //$NON-NLS-1$
- log.finer(" -sigalg=" + _sigAlgorithm); //$NON-NLS-1$
- log.finer(" -dname=" + _dName); //$NON-NLS-1$
- log.finer(" -validity=" + validityInDays); //$NON-NLS-1$
- log.finer(" -storetype=" + storeType); //$NON-NLS-1$
- log.finer(" -keystore=" + storeURL); //$NON-NLS-1$
- log.finer(" -provider=" + provider); //$NON-NLS-1$
- log.finer(" -v=" + verbose); //$NON-NLS-1$
+ if (Configuration.DEBUG)
+ {
+ log.fine("-selfcert handler will use the following options:");
//$NON-NLS-1$
+ log.fine(" -alias=" + alias); //$NON-NLS-1$
+ log.fine(" -sigalg=" + _sigAlgorithm); //$NON-NLS-1$
+ log.fine(" -dname=" + _dName); //$NON-NLS-1$
+ log.fine(" -validity=" + validityInDays); //$NON-NLS-1$
+ log.fine(" -storetype=" + storeType); //$NON-NLS-1$
+ log.fine(" -keystore=" + storeURL); //$NON-NLS-1$
+ log.fine(" -provider=" + provider); //$NON-NLS-1$
+ log.fine(" -v=" + verbose); //$NON-NLS-1$
+ }
}
void start() throws KeyStoreException, NoSuchAlgorithmException,
UnrecoverableKeyException, IOException, UnsupportedCallbackException,
InvalidKeyException, SignatureException, CertificateException
{
+ if (Configuration.DEBUG)
log.entering(getClass().getName(), "start"); //$NON-NLS-1$
-
// 1. get the key entry and certificate chain associated to alias
Key privateKey = getAliasPrivateKey();
Certificate[] chain = store.getCertificateChain(alias);
@@ -310,7 +313,7 @@
// 7. persist the key store
saveKeyStore();
-
+ if (Configuration.DEBUG)
log.exiting(getClass().getName(), "start"); //$NON-NLS-1$
}
@@ -318,8 +321,8 @@
Parser getParser()
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "getParser"); //$NON-NLS-1$
-
Parser result = new ClasspathToolParser(Main.SELFCERT_CMD, true);
result.setHeader(Messages.getString("SelfCertCmd.14")); //$NON-NLS-1$
result.setFooter(Messages.getString("SelfCertCmd.15")); //$NON-NLS-1$
@@ -414,7 +417,7 @@
}
});
result.add(options);
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "getParser", result); //$NON-NLS-1$
return result;
}
Index: keytool/Command.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/keytool/Command.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- keytool/Command.java 1 Jun 2006 19:31:46 -0000 1.5
+++ keytool/Command.java 12 Jun 2006 05:14:07 -0000 1.6
@@ -38,6 +38,7 @@
package gnu.classpath.tools.keytool;
+import gnu.classpath.Configuration;
import gnu.classpath.SystemProperties;
import gnu.classpath.tools.common.CallbackUtil;
import gnu.classpath.tools.common.ProviderUtil;
@@ -242,11 +243,11 @@
*/
String[] processArgs(String[] args)
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "processArgs", args); //$NON-NLS-1$
-
Parser cmdOptionsParser = getParser();
String[] result = cmdOptionsParser.parse(args);
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "processArgs", result);
//$NON-NLS-1$
return result;
}
@@ -312,8 +313,8 @@
*/
void teardown()
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "teardown"); //$NON-NLS-1$
-
if (storeStream != null)
try
{
@@ -321,6 +322,7 @@
}
catch (IOException ignored)
{
+ if (Configuration.DEBUG)
log.fine("Exception while closing key store URL stream. Ignored: "
//$NON-NLS-1$
+ ignored);
}
@@ -357,6 +359,7 @@
if (providerNdx > 0)
ProviderUtil.removeProvider(provider.getName());
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "teardown"); //$NON-NLS-1$
}
@@ -401,15 +404,18 @@
*/
protected void setProviderClassNameParam(String className)
{
- log.finest("setProviderClassNameParam(" + className + ")"); //$NON-NLS-1$
//$NON-NLS-2$
+ if (Configuration.DEBUG)
+ log.fine("setProviderClassNameParam(" + className + ")"); //$NON-NLS-1$
//$NON-NLS-2$
if (className != null && className.trim().length() > 0)
{
className = className.trim();
SecurityProviderInfo spi = ProviderUtil.addProvider(className);
provider = spi.getProvider();
if (provider == null)
+ {
+ if (Configuration.DEBUG)
log.fine("Was unable to add provider from class " + className);
-
+ }
providerNdx = spi.getPosition();
}
}
@@ -426,7 +432,8 @@
*/
protected void setKeystoreTypeParam(String type)
{
- log.finest("setKeystoreTypeParam(" + type + ")"); //$NON-NLS-1$
//$NON-NLS-2$
+ if (Configuration.DEBUG)
+ log.fine("setKeystoreTypeParam(" + type + ")"); //$NON-NLS-1$
//$NON-NLS-2$
if (type == null || type.trim().length() == 0)
storeType = KeyStore.getDefaultType();
else
@@ -525,7 +532,8 @@
KeyStoreException, UnsupportedCallbackException,
NoSuchAlgorithmException,
CertificateException
{
- log.finest("setKeystoreURLParam(" + url + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (Configuration.DEBUG)
+ log.fine("setKeystoreURLParam(" + url + ")"); //$NON-NLS-1$ //$NON-NLS-2$
if (url == null || url.trim().length() == 0)
{
String userHome = SystemProperties.getProperty("user.home");
//$NON-NLS-1$
@@ -551,6 +559,7 @@
storeStream = storeURL.openStream();
if (storeStream.available() == 0)
{
+ if (Configuration.DEBUG)
log.fine("Store is empty. Will use <null> when loading, to create
it"); //$NON-NLS-1$
newKeyStore = true;
}
@@ -564,6 +573,7 @@
if (provider != null)
throw x;
+ if (Configuration.DEBUG)
log.fine("Exception while getting key store with default provider(s)."
//$NON-NLS-1$
+ " Will prompt user for another provider and continue");
//$NON-NLS-1$
String prompt = Messages.getString("Command.40"); //$NON-NLS-1$
@@ -596,6 +606,7 @@
}
catch (IOException x)
{
+ if (Configuration.DEBUG)
log.fine("Exception while closing the key store input stream: " + x
//$NON-NLS-1$
+ ". Ignore"); //$NON-NLS-1$
}
@@ -818,9 +829,9 @@
PrivateKey privateKey)
throws IOException, SignatureException, InvalidKeyException
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "getSelfSignedCertificate",
//$NON-NLS-1$
new Object[] { distinguishedName, publicKey, privateKey });
-
byte[] versionBytes = new DERValue(DER.INTEGER,
BigInteger.ZERO).getEncoded();
DERValue derVersion = new DERValue(DER.CONSTRUCTED | DER.CONTEXT | 0,
versionBytes.length, versionBytes,
null);
@@ -901,7 +912,7 @@
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DERWriter.write(baos, derCertificate);
byte[] result = baos.toByteArray();
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "getSelfSignedCertificate");
//$NON-NLS-1$
return result;
}
@@ -992,8 +1003,8 @@
protected void saveKeyStore(char[] password) throws IOException,
KeyStoreException, NoSuchAlgorithmException, CertificateException
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "saveKeyStore"); //$NON-NLS-1$
-
URLConnection con = storeURL.openConnection();
con.setDoOutput(true);
con.setUseCaches(false);
@@ -1004,7 +1015,7 @@
store.store(out, password);
out.flush();
out.close();
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "saveKeyStore"); //$NON-NLS-1$
}
Index: keytool/Main.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/keytool/Main.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- keytool/Main.java 11 Jun 2006 10:40:51 -0000 1.3
+++ keytool/Main.java 12 Jun 2006 05:14:07 -0000 1.4
@@ -38,6 +38,7 @@
package gnu.classpath.tools.keytool;
+import gnu.classpath.Configuration;
import gnu.classpath.tools.common.ProviderUtil;
import gnu.classpath.tools.getopt.ClasspathToolParser;
import gnu.classpath.tools.getopt.Option;
@@ -133,8 +134,8 @@
public static final void main(String[] args)
{
+ if (Configuration.DEBUG)
log.entering(Main.class.getName(), "main", args); //$NON-NLS-1$
-
Main tool = new Main();
int result = 1;
try
@@ -151,12 +152,14 @@
}
catch (SecurityException x)
{
+ if (Configuration.DEBUG)
log.throwing(Main.class.getName(), "main", x); //$NON-NLS-1$
System.err.println(Messages.getFormattedString("Main.6", //$NON-NLS-1$
x.getMessage()));
}
catch (Exception x)
{
+ if (Configuration.DEBUG)
log.throwing(Main.class.getName(), "main", x); //$NON-NLS-1$
System.err.println(Messages.getFormattedString("Main.8", x));
//$NON-NLS-1$
}
@@ -166,7 +169,7 @@
if (tool.shutdownThread != null)
Runtime.getRuntime().removeShutdownHook(tool.shutdownThread);
}
-
+ if (Configuration.DEBUG)
log.exiting(Main.class.getName(), "main", Integer.valueOf(result));
//$NON-NLS-1$
System.exit(result);
}
@@ -175,19 +178,19 @@
private void setup()
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "setup"); //$NON-NLS-1$
-
cmdLineParser = getParser();
gnuCryptoProviderNdx = ProviderUtil.addProvider(new GnuCrypto());
gnuCallbacksNdx = ProviderUtil.addProvider(new GnuCallbacks());
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "setup"); //$NON-NLS-1$
}
private void start(String[] args) throws Exception
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "start"); //$NON-NLS-1$
-
if (args == null || args.length == 0)
throw new OptionException(""); //$NON-NLS-1$
@@ -234,14 +237,14 @@
args = cmd.processArgs(cmdArgs);
cmd.doCommand();
}
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "start"); //$NON-NLS-1$
}
private Parser getParser()
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "getParser"); //$NON-NLS-1$
-
Parser result = new ClasspathToolParser(KEYTOOL_TOOL, true);
result.setHeader(Messages.getString("Main.19")); //$NON-NLS-1$
result.setFooter(Messages.getString("Main.20")); //$NON-NLS-1$
@@ -273,15 +276,15 @@
cmdGroup.add(new NoParseOption(CACERT_CMD,
Messages.getString("Main.5")));
//$NON-NLS-1$
result.add(cmdGroup);
-
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "getParser", result); //$NON-NLS-1$
return result;
}
void teardown()
{
+ if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "teardown"); //$NON-NLS-1$
-
// if we added our own providers remove them
if (gnuCryptoProviderNdx > 0)
ProviderUtil.removeProvider(Registry.GNU_CRYPTO);
@@ -289,6 +292,7 @@
if (gnuCallbacksNdx > 0)
ProviderUtil.removeProvider("GNU-CALLBACKS"); //$NON-NLS-1$
+ if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "teardown"); //$NON-NLS-1$
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [commit-cp] classpath/tools/gnu/classpath/tools jarsignerMe...,
Raif S. Naffah <=