|
From: <pe...@us...> - 2004-02-19 15:40:53
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/tools/commandline In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16761/src/java/org/neuclear/id/tools/commandline Modified Files: BuildAllTopLevel.java CommandLineSigner.java Log Message: Various cleanups and corrections Index: BuildAllTopLevel.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/tools/commandline/BuildAllTopLevel.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** BuildAllTopLevel.java 18 Feb 2004 00:14:31 -0000 1.6 --- BuildAllTopLevel.java 19 Feb 2004 15:30:21 -0000 1.7 *************** *** 32,35 **** --- 32,38 ---- $Id$ $Log$ + Revision 1.7 2004/02/19 15:30:21 pelle + Various cleanups and corrections + Revision 1.6 2004/02/18 00:14:31 pelle Many, many clean ups. I've readded Targets in a new method. *************** *** 85,92 **** */ public final class BuildAllTopLevel { public static SignedNamedObject createIdentities(final String name, final Signer signer, final PublicKeySource pubsource) throws NeuClearException, XMLException { final IdentityBuilder id = new IdentityBuilder(pubsource.getPublicKey(name)); System.out.println("Signing: " + name); ! return id.convert(name,signer); } --- 88,98 ---- */ public final class BuildAllTopLevel { + private BuildAllTopLevel() { //Dont Instantiate + } + public static SignedNamedObject createIdentities(final String name, final Signer signer, final PublicKeySource pubsource) throws NeuClearException, XMLException { final IdentityBuilder id = new IdentityBuilder(pubsource.getPublicKey(name)); System.out.println("Signing: " + name); ! return id.convert(name, signer); } Index: CommandLineSigner.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/tools/commandline/CommandLineSigner.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** CommandLineSigner.java 18 Feb 2004 00:14:31 -0000 1.9 --- CommandLineSigner.java 19 Feb 2004 15:30:21 -0000 1.10 *************** *** 1,4 **** --- 1,7 ---- /* $Id$ * $Log$ + * Revision 1.10 2004/02/19 15:30:21 pelle + * Various cleanups and corrections + * * Revision 1.9 2004/02/18 00:14:31 pelle * Many, many clean ups. I've readded Targets in a new method. *************** *** 215,219 **** package org.neuclear.id.tools.commandline; - import org.apache.commons.cli.*; import org.dom4j.Document; import org.neuclear.commons.LowLevelException; --- 218,221 ---- *************** *** 243,253 **** */ public class CommandLineSigner { ! private final String EXECUTABLE ; public CommandLineSigner(final String[] args) throws UserCancellationException { CryptoTools.ensureProvider(); ! EXECUTABLE=Utility.getExecutable(getClass()); options = createOptions(); ! cmd=parseOptions(args); checkArguments(); if (cmd.hasOption('v')) { --- 245,255 ---- */ public class CommandLineSigner { ! private final String executable; public CommandLineSigner(final String[] args) throws UserCancellationException { CryptoTools.ensureProvider(); ! executable = Utility.getExecutable(getClass()); options = createOptions(); ! cmd = parseOptions(args); checkArguments(); if (cmd.hasOption('v')) { *************** *** 271,275 **** } // agent=(PassPhraseAgent)Configuration.getComponent(PassPhraseAgent.class,"neuclear-id"); ! final InteractiveAgent agent = cmd.hasOption('g')?(InteractiveAgent)new GuiDialogAgent():new ConsoleAgent(); sig = createSigner(agent); alias = cmd.getOptionValue("a"); --- 273,277 ---- } // agent=(PassPhraseAgent)Configuration.getComponent(PassPhraseAgent.class,"neuclear-id"); ! final InteractiveAgent agent = cmd.hasOption('g') ? (InteractiveAgent) new GuiDialogAgent() : new ConsoleAgent(); sig = createSigner(agent); alias = cmd.getOptionValue("a"); *************** *** 305,309 **** final CommandLineSigner signer = new CommandLineSigner(args); signer.execute(); ! } catch (UserCancellationException e){ System.out.println("Bye"); } catch (Exception e) { --- 307,311 ---- final CommandLineSigner signer = new CommandLineSigner(args); signer.execute(); ! } catch (UserCancellationException e) { System.out.println("Bye"); } catch (Exception e) { *************** *** 313,317 **** public final void checkArguments() { ! if (!hasArguments()||cmd.hasOption('h')) { printHelp(); System.exit(1); --- 315,319 ---- public final void checkArguments() { ! if (!hasArguments() || cmd.hasOption('h')) { printHelp(); System.exit(1); *************** *** 322,329 **** final HelpFormatter help = new HelpFormatter(); help.setDescPadding(10); ! help.printHelp("\n"+EXECUTABLE +getExtraHelp()+ " [--outputfile signed/test.id] \n" + ! EXECUTABLE+" --verify neu://neuclear.org\n" + ! EXECUTABLE+" --inputfile jo...@yo... \n" , options); } --- 324,331 ---- final HelpFormatter help = new HelpFormatter(); help.setDescPadding(10); ! help.printHelp("\n" + executable + getExtraHelp() + " [--outputfile signed/test.id] \n" + ! executable + " --verify neu://neuclear.org\n" + ! executable + " --inputfile jo...@yo... \n", options); } *************** *** 337,348 **** public final void execute() throws UserCancellationException { ! final Builder subject = build(); try { if (!sig.canSignFor(alias)) { if (!Utility.isEmpty(of)) ! of = "signthis.xml"; System.out.println("Key with alias: " + alias + " doesnt exist in our keystore. \nSaving unsigned Identity as: " + of); ! } else if(!subject.isSigned()) { System.out.println("Signing by " + alias + " ..."); subject.sign(alias, sig); --- 339,350 ---- public final void execute() throws UserCancellationException { ! final Builder subject = build(); try { if (!sig.canSignFor(alias)) { if (!Utility.isEmpty(of)) ! of = "signthis.xml"; System.out.println("Key with alias: " + alias + " doesnt exist in our keystore. \nSaving unsigned Identity as: " + of); ! } else if (!subject.isSigned()) { System.out.println("Signing by " + alias + " ..."); subject.sign(alias, sig); *************** *** 359,366 **** XMLTools.writeFile(dest, subject.getElement()); System.out.println(); ! System.out.println("You now need to copy the file: "+of+ " to your webserver so it is visible at a given location"); // System.out.println("\nOnce this is done you will be able to verify your new Identity like this:"); ! // System.out.println(EXECUTABLE+" -v "+subject.getName()); /* We need to be able to send an unsigned object before I can enable this if (!sig.canSignFor(alias)) { --- 361,368 ---- XMLTools.writeFile(dest, subject.getElement()); System.out.println(); ! System.out.println("You now need to copy the file: " + of + " to your webserver so it is visible at a given location"); // System.out.println("\nOnce this is done you will be able to verify your new Identity like this:"); ! // System.out.println(executable+" -v "+subject.getName()); /* We need to be able to send an unsigned object before I can enable this if (!sig.canSignFor(alias)) { *************** *** 392,396 **** protected Builder build() throws UserCancellationException { final String sf = cmd.getOptionValue("i"); ! Builder subject=null; try { InputStream source = System.in; --- 394,398 ---- protected Builder build() throws UserCancellationException { final String sf = cmd.getOptionValue("i"); ! Builder subject = null; try { InputStream source = System.in; *************** *** 438,443 **** options.addOption(new Option("i", "inputfile", true, "specify Input File \n[ --inputfile bob.xml ]")); options.addOption(new Option("v", "verify", true, "Specify NEU ID to verify \n[ --verify neu://bob@yourdomain.com ]")); ! options.addOption(new Option("h","help",false,"Help")); ! options.addOption(new Option("g","gui",false,"Use GUI Passphrase Dialog")); getLocalOptions(options); --- 440,445 ---- options.addOption(new Option("i", "inputfile", true, "specify Input File \n[ --inputfile bob.xml ]")); options.addOption(new Option("v", "verify", true, "Specify NEU ID to verify \n[ --verify neu://bob@yourdomain.com ]")); ! options.addOption(new Option("h", "help", false, "Help")); ! options.addOption(new Option("g", "gui", false, "Use GUI Passphrase Dialog")); getLocalOptions(options); |