You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(119) |
Oct
(111) |
Nov
(238) |
Dec
(395) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(239) |
Feb
(59) |
Mar
(354) |
Apr
(489) |
May
(23) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
(4) |
May
(5) |
Jun
(2) |
Jul
|
Aug
|
Sep
(3) |
Oct
(14) |
Nov
(17) |
Dec
(9) |
| 2007 |
Jan
(4) |
Feb
(3) |
Mar
|
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
|
Aug
|
Sep
(1) |
Oct
(2) |
Nov
(1) |
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
(7) |
May
(3) |
Jun
(6) |
Jul
(4) |
Aug
(3) |
Sep
(15) |
Oct
(13) |
Nov
(35) |
Dec
(40) |
| 2009 |
Jan
(19) |
Feb
(21) |
Mar
(16) |
Apr
(18) |
May
(36) |
Jun
(20) |
Jul
(32) |
Aug
(11) |
Sep
(3) |
Oct
(2) |
Nov
(2) |
Dec
(13) |
| 2010 |
Jan
(5) |
Feb
(5) |
Mar
(7) |
Apr
(1) |
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
(1) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
(1) |
Aug
(1) |
Sep
(1) |
Oct
(4) |
Nov
|
Dec
(3) |
| 2012 |
Jan
(3) |
Feb
(3) |
Mar
(1) |
Apr
(4) |
May
(8) |
Jun
(4) |
Jul
(9) |
Aug
(2) |
Sep
(8) |
Oct
(3) |
Nov
(8) |
Dec
(4) |
| 2013 |
Jan
(2) |
Feb
(1) |
Mar
(5) |
Apr
(6) |
May
(10) |
Jun
(5) |
Jul
(6) |
Aug
(7) |
Sep
(5) |
Oct
(2) |
Nov
(4) |
Dec
(4) |
| 2014 |
Jan
(13) |
Feb
(4) |
Mar
(7) |
Apr
(9) |
May
(20) |
Jun
(13) |
Jul
(10) |
Aug
(3) |
Sep
(5) |
Oct
(2) |
Nov
(2) |
Dec
(2) |
| 2015 |
Jan
(3) |
Feb
(3) |
Mar
(5) |
Apr
(4) |
May
(3) |
Jun
(2) |
Jul
(4) |
Aug
(3) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
(3) |
| 2016 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
(4) |
Sep
(3) |
Oct
(3) |
Nov
(4) |
Dec
(2) |
| 2017 |
Jan
|
Feb
(2) |
Mar
|
Apr
(2) |
May
(1) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <pe...@us...> - 2003-12-19 18:03:38
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/tools/commandline
In directory sc8-pr-cvs1:/tmp/cvs-serv5310/src/java/org/neuclear/id/tools/commandline
Modified Files:
CommandLineSigner.java IdentityCreator.java
Log Message:
Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
- For most cases the main exception to worry about now is InvalidNamedObjectException.
- Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
runtime exception.
- Source and Store patterns each now have their own exceptions that generalizes the various physical
exceptions that can happen in that area.
Index: CommandLineSigner.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/tools/commandline/CommandLineSigner.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** CommandLineSigner.java 19 Dec 2003 00:31:30 -0000 1.5
--- CommandLineSigner.java 19 Dec 2003 18:03:34 -0000 1.6
***************
*** 1,4 ****
--- 1,12 ----
/* $Id$
* $Log$
+ * Revision 1.6 2003/12/19 18:03:34 pelle
+ * Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ * - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ * - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ * runtime exception.
+ * - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ * exceptions that can happen in that area.
+ *
* Revision 1.5 2003/12/19 00:31:30 pelle
* Lots of usability changes through out all the passphrase agents and end user tools.
***************
*** 199,202 ****
--- 207,211 ----
import org.neuclear.commons.NeuClearException;
import org.neuclear.commons.Utility;
+ import org.neuclear.commons.LowLevelException;
import org.neuclear.commons.crypto.CryptoTools;
import org.neuclear.commons.crypto.passphraseagents.ConsoleAgent;
***************
*** 207,210 ****
--- 216,220 ----
import org.neuclear.commons.crypto.signers.Signer;
import org.neuclear.commons.crypto.signers.InvalidPassphraseException;
+ import org.neuclear.commons.crypto.signers.NonExistingSignerException;
import org.neuclear.commons.time.TimeTools;
import org.neuclear.id.Identity;
***************
*** 231,235 ****
private final String EXECUTABLE ;
! public CommandLineSigner(final String[] args) throws ParseException, UserCancellationException {
CryptoTools.ensureProvider();
EXECUTABLE=Utility.getExecutable(getClass());
--- 241,245 ----
private final String EXECUTABLE ;
! public CommandLineSigner(final String[] args) throws UserCancellationException {
CryptoTools.ensureProvider();
EXECUTABLE=Utility.getExecutable(getClass());
***************
*** 267,275 ****
}
! private final CommandLine parseOptions(final String[] args) throws ParseException {
! final CommandLineParser clparser = CommandLineParserFactory.newParser();
try {
return clparser.parse(options, args);
! } catch (UnrecognizedOptionException e) {
System.out.println(e.getLocalizedMessage());
printHelp();
--- 277,285 ----
}
! private final CommandLine parseOptions(final String[] args) {
! final CommandLineParser clparser = new GnuParser();
try {
return clparser.parse(options, args);
! } catch (ParseException e) {
System.out.println(e.getLocalizedMessage());
printHelp();
***************
*** 308,312 ****
private void printHelp() {
final HelpFormatter help = new HelpFormatter();
!
help.printHelp("\n"+EXECUTABLE +getExtraHelp()+
" [--outputfile signed/test.id] \n" +
--- 318,322 ----
private void printHelp() {
final HelpFormatter help = new HelpFormatter();
! help.setDescPadding(10);
help.printHelp("\n"+EXECUTABLE +getExtraHelp()+
" [--outputfile signed/test.id] \n" +
***************
*** 323,331 ****
}
! public final void execute() {
!
! try {
final NamedObjectBuilder subject = build();
if (!sig.canSignFor(alias)) {
if (!Utility.isEmpty(of))
--- 333,340 ----
}
! public final void execute() throws UserCancellationException {
final NamedObjectBuilder subject = build();
+ try {
if (!sig.canSignFor(alias)) {
if (!Utility.isEmpty(of))
***************
*** 367,379 ****
}
*/
! } catch (Exception e) {
! System.err.println(e.getMessage());
! e.printStackTrace(System.err);
}
}
! protected NamedObjectBuilder build() throws Exception {
final String sf = cmd.getOptionValue("i");
try {
InputStream source = System.in;
--- 376,396 ----
}
*/
! } catch (InvalidNamedObjectException e) {
! throw new LowLevelException(e);
! } catch (NonExistingSignerException e) {
! throw new LowLevelException(e);
! } catch (FileNotFoundException e) {
! System.err.println("Couldnt find file: " + of);
! System.exit(1);
! } catch (XMLException e) {
! System.err.println("Error generatoing xml file: " + of + "\n" + e.getLocalizedMessage());
! System.exit(1);
}
}
! protected NamedObjectBuilder build() throws UserCancellationException {
final String sf = cmd.getOptionValue("i");
+ NamedObjectBuilder subject=null;
try {
InputStream source = System.in;
***************
*** 386,394 ****
}
final Document doc = XMLTools.loadDocument(source);
! final NamedObjectBuilder subject = new NamedObjectBuilder(doc);
if (Utility.isEmpty(alias)) {
alias = Utility.denullString(NSTools.isHttpScheme(subject.getName()), NSTools.getSignatoryURI(subject.getName()));
-
}
if (!sig.canSignFor(alias)) {
--- 403,410 ----
}
final Document doc = XMLTools.loadDocument(source);
! subject = new NamedObjectBuilder(doc);
if (Utility.isEmpty(alias)) {
alias = Utility.denullString(NSTools.isHttpScheme(subject.getName()), NSTools.getSignatoryURI(subject.getName()));
}
if (!sig.canSignFor(alias)) {
***************
*** 403,408 ****
System.out.println(subject.asXML());
System.out.print("===================\nAre you shure you wish to sign this? (y/N) ");
! String answer = new jline.ConsoleReader().readLine();
! if (!answer.toLowerCase().equals("y")) {
System.out.println("Aborted Signing Process");
System.exit(0);
--- 419,424 ----
System.out.println(subject.asXML());
System.out.print("===================\nAre you shure you wish to sign this? (y/N) ");
!
! if (!Utility.getAffirmative(false)) {
System.out.println("Aborted Signing Process");
System.exit(0);
***************
*** 410,413 ****
--- 426,432 ----
return subject;
+ } catch (InvalidNamedObjectException e) {
+ System.err.println("The name: "+e.getName()+" is not valid. \nplease check the xml attribute \"neuid:name\" in the xml element: "+ subject.getElement().getQualifiedName()+" in your input file: "+sf);
+ System.exit(1);
} catch (FileNotFoundException e) {
System.err.println("Couldnt find file: " + sf);
***************
*** 423,432 ****
// create Options object
final Options options = new Options();
!
! options.addOption("o", "outputfile", true, "specify output file \n[ --outputfile bob.id ]");
! options.addOption("i", "inputfile", true, "specify Input File \n[ --inputfile bob.xml ]");
! options.addOption("v", "verify", true, "Specify NEU ID to verify \n[ --verify neu://bob@yourdomain.com ]");
! options.addOption("h","help",false,"Help");
! options.addOption("g","gui",false,"Use GUI Passphrase Dialog");
getLocalOptions(options);
--- 442,450 ----
// create Options object
final Options options = new Options();
! options.addOption(new Option("o", "outputfile", true, "specify output file \n[ --outputfile bob.id ]"));
! 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);
Index: IdentityCreator.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/tools/commandline/IdentityCreator.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** IdentityCreator.java 19 Dec 2003 00:31:30 -0000 1.5
--- IdentityCreator.java 19 Dec 2003 18:03:34 -0000 1.6
***************
*** 1,4 ****
--- 1,12 ----
/* $Id$
* $Log$
+ * Revision 1.6 2003/12/19 18:03:34 pelle
+ * Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ * - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ * - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ * runtime exception.
+ * - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ * exceptions that can happen in that area.
+ *
* Revision 1.5 2003/12/19 00:31:30 pelle
* Lots of usability changes through out all the passphrase agents and end user tools.
***************
*** 202,205 ****
--- 210,215 ----
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
+ import org.apache.commons.cli.Option;
+ import org.apache.commons.cli.OptionGroup;
import org.neuclear.commons.NeuClearException;
import org.neuclear.commons.Utility;
***************
*** 238,242 ****
}
! public final NamedObjectBuilder build() throws Exception {
NamedObjectBuilder subject = null;
if (cmd.hasOption('i')) {//If we have an input file we load that instead of creating a new one
--- 248,252 ----
}
! protected NamedObjectBuilder build() throws UserCancellationException {
NamedObjectBuilder subject = null;
if (cmd.hasOption('i')) {//If we have an input file we load that instead of creating a new one
***************
*** 244,275 ****
identity = subject.getName();
}
! String store = NSTools.isHttpScheme(identity);
! boolean isTopLevel = !Utility.isEmpty(store);
! if (!isTopLevel) {
! // If this isn't a top level we will derive the repository from its parent.
! store = NSTools.isHttpScheme(NSTools.getSignatoryURI(identity));
! }
! alias = (isTopLevel) ? identity : NSTools.getSignatoryURI(identity);
! final String defaultstore = Utility.denullString(cmd.getOptionValue("r"), store);
! final String defaultsigner = Utility.denullString(cmd.getOptionValue("s"), "http://localhost:11870/Signer");
! final String defaultlogger = Utility.denullString(cmd.getOptionValue("l"), LogSender.LOGGER);
! final String defaultreceiver = cmd.getOptionValue("b");
! if (!sig.canSignFor(identity)){
! System.out.println("You do not currently have a key matching this name. Do you with to create one?");
! if (!Utility.getAffirmative(true)) {
! System.out.println("OK, Bye");
! System.exit(0);
}
! System.out.println("Generating Keys for "+identity+"... ");
! PublicKey pub=sig.generateKey(identity);
! System.out.println("DONE");
! System.out.println("STORING Keys");
! sig.save();
}
! final PublicKey newkid = pksource.getPublicKey(identity);
! if (newkid == null)
! throw new CryptoException("PublicKey not available for: " + identity);
! return new IdentityBuilder(identity, newkid, defaultstore, defaultsigner, defaultlogger, defaultreceiver);
}
--- 254,290 ----
identity = subject.getName();
}
! try {
! String store = NSTools.isHttpScheme(identity);
! boolean isTopLevel = !Utility.isEmpty(store);
! if (!isTopLevel) {
! // If this isn't a top level we will derive the repository from its parent.
! store = NSTools.isHttpScheme(NSTools.getSignatoryURI(identity));
}
! alias = (isTopLevel) ? identity : NSTools.getSignatoryURI(identity);
! final String defaultstore = Utility.denullString(cmd.getOptionValue("r"), store);
! final String defaultsigner = Utility.denullString(cmd.getOptionValue("s"), "http://localhost:11870/Signer");
! final String defaultlogger = Utility.denullString(cmd.getOptionValue("l"), LogSender.LOGGER);
! final String defaultreceiver = cmd.getOptionValue("b");
! if (!sig.canSignFor(identity)){
! System.out.println("You do not currently have a key matching this name. Do you with to create one?");
! if (!Utility.getAffirmative(true)) {
! System.out.println("OK, Bye");
! System.exit(0);
! }
! System.out.println("Generating Keys for "+identity+"... ");
! PublicKey pub=sig.generateKey(identity);
! System.out.println("DONE");
! System.out.println("STORING Keys");
! sig.save();
!
! }
! final PublicKey newkid = pksource.getPublicKey(identity);
+ return new IdentityBuilder(identity, newkid, defaultstore, defaultsigner, defaultlogger, defaultreceiver);
+ } catch (InvalidNamedObjectException e) {
+ System.err.println("The name: "+e.getName()+" is not valid. ");
+ System.exit(1);
}
! return null;
}
***************
*** 295,303 ****
protected final void getLocalOptions(final Options options) {
! options.addOption("n", "name", true, "specify name of new Identity \n[ --name neu://bob@yourdomain.com ]");
! options.addOption("r", "repository", true, "Identity's default Repository \n[ --repository http://repository.neuclear.org ] ");
! options.addOption("s", "signer", true, "Identity's default Interactive Signer \n[ --signer http://localhost:11870 ]");
! options.addOption("l", "logger", true, "Identity's default Logging Service \n[ --logger http://logger.neuclear.org ]");
! options.addOption("b", "receiver", true, "Identity's default Receiver \n[ --receiver mailto:bo...@yo... ]");
}
--- 310,318 ----
protected final void getLocalOptions(final Options options) {
! options.addOption(new Option("n", "name", true, "specify name of new Identity \n[ --name neu://bob@yourdomain.com ]"));
! options.addOption(new Option("r", "repository", true, "Identity's default Repository \n[ --repository http://repository.neuclear.org ] "));
! options.addOption(new Option("s", "signer", true, "Identity's default Interactive Signer \n[ --signer http://localhost:11870 ]"));
! options.addOption(new Option("l", "logger", true, "Identity's default Logging Service \n[ --logger http://logger.neuclear.org ]"));
! options.addOption(new Option("b", "receiver", true, "Identity's default Receiver \n[ --receiver mailto:bo...@yo... ]"));
}
|
|
From: <pe...@us...> - 2003-12-19 18:03:38
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/senders
In directory sc8-pr-cvs1:/tmp/cvs-serv5310/src/java/org/neuclear/senders
Modified Files:
LogSender.java
Log Message:
Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
- For most cases the main exception to worry about now is InvalidNamedObjectException.
- Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
runtime exception.
- Source and Store patterns each now have their own exceptions that generalizes the various physical
exceptions that can happen in that area.
Index: LogSender.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/senders/LogSender.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** LogSender.java 10 Dec 2003 23:58:52 -0000 1.13
--- LogSender.java 19 Dec 2003 18:03:35 -0000 1.14
***************
*** 14,17 ****
--- 14,18 ----
import java.net.URLEncoder;
import java.sql.Timestamp;
+ import java.text.ParseException;
/**
***************
*** 22,25 ****
--- 23,34 ----
* $Id$
* $Log$
+ * Revision 1.14 2003/12/19 18:03:35 pelle
+ * Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ * - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ * - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ * runtime exception.
+ * - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ * exceptions that can happen in that area.
+ *
* Revision 1.13 2003/12/10 23:58:52 pelle
* Did some cleaning up in the builders
***************
*** 158,161 ****
--- 167,172 ----
Utility.rethrowException(e); //To change body of catch statement use Options | File Templates.
} catch (IOException e) {
+ Utility.rethrowException(e); //To change body of catch statement use Options | File Templates.
+ } catch (ParseException e) {
Utility.rethrowException(e); //To change body of catch statement use Options | File Templates.
}
|
|
From: <pe...@us...> - 2003-12-19 18:03:37
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/resolver
In directory sc8-pr-cvs1:/tmp/cvs-serv5310/src/java/org/neuclear/id/resolver
Modified Files:
NSResolver.java
Log Message:
Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
- For most cases the main exception to worry about now is InvalidNamedObjectException.
- Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
runtime exception.
- Source and Store patterns each now have their own exceptions that generalizes the various physical
exceptions that can happen in that area.
Index: NSResolver.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/resolver/NSResolver.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** NSResolver.java 19 Dec 2003 00:31:30 -0000 1.16
--- NSResolver.java 19 Dec 2003 18:03:34 -0000 1.17
***************
*** 5,8 ****
--- 5,9 ----
import org.neuclear.id.cache.NSCache;
import org.neuclear.source.Source;
+ import org.neuclear.source.SourceException;
/**
***************
*** 29,33 ****
* @return
*/
! public final static Identity resolveIdentity(final String name) throws NameResolutionException, NeuClearException,InvalidNamedObjectException {
final SignedNamedObject id = resolve(name);
if (id instanceof Identity)
--- 30,34 ----
* @return
*/
! public final static Identity resolveIdentity(final String name) throws NameResolutionException, InvalidNamedObjectException {
final SignedNamedObject id = resolve(name);
if (id instanceof Identity)
***************
*** 44,48 ****
* @return
*/
! public final static SignedNamedObject resolve(final String name) throws NameResolutionException,NeuClearException, InvalidNamedObjectException {
SignedNamedObject obj = NSCACHE.fetchCached(name);
if (obj != null)
--- 45,49 ----
* @return
*/
! public final static SignedNamedObject resolve(final String name) throws NameResolutionException, InvalidNamedObjectException {
SignedNamedObject obj = NSCACHE.fetchCached(name);
if (obj != null)
***************
*** 59,63 ****
store = parent.getRepository();
}
! obj = Source.getInstance().fetch(store, name);
if (obj == null)
throw new NameResolutionException(name);
--- 60,68 ----
store = parent.getRepository();
}
! try {
! obj = Source.getInstance().fetch(store, name);
! } catch (SourceException e) {
! throw new NameResolutionException(name,e.getLocalizedMessage());
! }
if (obj == null)
throw new NameResolutionException(name);
|
|
From: <pe...@us...> - 2003-12-19 18:03:37
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/jce
In directory sc8-pr-cvs1:/tmp/cvs-serv5310/src/java/org/neuclear/id/jce
Modified Files:
NeuClearCertificateFactory.java
Log Message:
Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
- For most cases the main exception to worry about now is InvalidNamedObjectException.
- Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
runtime exception.
- Source and Store patterns each now have their own exceptions that generalizes the various physical
exceptions that can happen in that area.
Index: NeuClearCertificateFactory.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/jce/NeuClearCertificateFactory.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** NeuClearCertificateFactory.java 17 Dec 2003 12:45:57 -0000 1.8
--- NeuClearCertificateFactory.java 19 Dec 2003 18:03:34 -0000 1.9
***************
*** 35,38 ****
--- 35,46 ----
$Id$
$Log$
+ Revision 1.9 2003/12/19 18:03:34 pelle
+ Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ runtime exception.
+ - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ exceptions that can happen in that area.
+
Revision 1.8 2003/12/17 12:45:57 pelle
NeuClear JCE Certificates now work with KeyStore.
***************
*** 91,96 ****
return ((Identity)VerifyingReader.getInstance().read(inputStream)).getCertificate();
} catch (NeuClearException e) {
- throw new CertificateException("NeuClear: Problem reading Certificate:"+e.getMessage());
- } catch (XMLException e) {
throw new CertificateException("NeuClear: Problem reading Certificate:"+e.getMessage());
}
--- 99,102 ----
|
|
From: <pe...@us...> - 2003-12-19 18:03:37
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders
In directory sc8-pr-cvs1:/tmp/cvs-serv5310/src/java/org/neuclear/id/builders
Modified Files:
IdentityBuilder.java NamedObjectBuilder.java
Log Message:
Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
- For most cases the main exception to worry about now is InvalidNamedObjectException.
- Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
runtime exception.
- Source and Store patterns each now have their own exceptions that generalizes the various physical
exceptions that can happen in that area.
Index: IdentityBuilder.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders/IdentityBuilder.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** IdentityBuilder.java 18 Dec 2003 17:40:19 -0000 1.15
--- IdentityBuilder.java 19 Dec 2003 18:03:34 -0000 1.16
***************
*** 2,5 ****
--- 2,13 ----
* $Id$
* $Log$
+ * Revision 1.16 2003/12/19 18:03:34 pelle
+ * Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ * - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ * - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ * runtime exception.
+ * - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ * exceptions that can happen in that area.
+ *
* Revision 1.15 2003/12/18 17:40:19 pelle
* You can now create keys that get stored with a X509 certificate in the keystore. These can be saved as well.
***************
*** 212,215 ****
--- 220,224 ----
import org.neuclear.id.NSTools;
import org.neuclear.id.Identity;
+ import org.neuclear.id.InvalidNamedObjectException;
import org.neuclear.xml.xmlsec.XMLSecTools;
import org.neuclear.xml.xmlsec.XMLSecurityException;
***************
*** 230,234 ****
*/
! public IdentityBuilder(final String name, final PublicKey allow, final String repository, final String signer, final String logger, final String receiver) throws NeuClearException {
this(createNEUIDQName(TAGNAME), name, allow, repository, signer, logger, receiver);
}
--- 239,243 ----
*/
! public IdentityBuilder(final String name, final PublicKey allow, final String repository, final String signer, final String logger, final String receiver) throws InvalidNamedObjectException {
this(createNEUIDQName(TAGNAME), name, allow, repository, signer, logger, receiver);
}
***************
*** 244,248 ****
* @param receiver URL of default receiver for namespace
*/
! protected IdentityBuilder(final QName tag, final String name, final PublicKey allow, final String repository, final String signer, final String logger, final String receiver) throws NeuClearException {
super(name, tag);
--- 253,257 ----
* @param receiver URL of default receiver for namespace
*/
! protected IdentityBuilder(final QName tag, final String name, final PublicKey allow, final String repository, final String signer, final String logger, final String receiver) throws InvalidNamedObjectException {
super(name, tag);
Index: NamedObjectBuilder.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders/NamedObjectBuilder.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** NamedObjectBuilder.java 18 Dec 2003 17:40:19 -0000 1.19
--- NamedObjectBuilder.java 19 Dec 2003 18:03:34 -0000 1.20
***************
*** 2,5 ****
--- 2,13 ----
* $Id$
* $Log$
+ * Revision 1.20 2003/12/19 18:03:34 pelle
+ * Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ * - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ * - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ * runtime exception.
+ * - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ * exceptions that can happen in that area.
+ *
* Revision 1.19 2003/12/18 17:40:19 pelle
* You can now create keys that get stored with a X509 certificate in the keystore. These can be saved as well.
***************
*** 211,219 ****
import org.neuclear.commons.Utility;
import org.neuclear.commons.crypto.signers.Signer;
import org.neuclear.commons.time.TimeTools;
! import org.neuclear.id.Identity;
! import org.neuclear.id.NSTools;
! import org.neuclear.id.Named;
! import org.neuclear.id.SignedNamedObject;
import org.neuclear.id.resolver.NSResolver;
import org.neuclear.id.verifier.VerifyingReader;
--- 219,226 ----
import org.neuclear.commons.Utility;
import org.neuclear.commons.crypto.signers.Signer;
+ import org.neuclear.commons.crypto.signers.NonExistingSignerException;
+ import org.neuclear.commons.crypto.passphraseagents.UserCancellationException;
import org.neuclear.commons.time.TimeTools;
! import org.neuclear.id.*;
import org.neuclear.id.resolver.NSResolver;
import org.neuclear.id.verifier.VerifyingReader;
***************
*** 223,226 ****
--- 230,234 ----
import java.sql.Timestamp;
+ import java.text.ParseException;
/**
***************
*** 228,232 ****
*/
public class NamedObjectBuilder extends SignedElement implements Named, Cloneable {
! protected NamedObjectBuilder(final String name, final String tagName, final String prefix, final String nsURI) throws NeuClearException {
super(tagName, prefix, nsURI);
createDocument();
--- 236,240 ----
*/
public class NamedObjectBuilder extends SignedElement implements Named, Cloneable {
! protected NamedObjectBuilder(final String name, final String tagName, final String prefix, final String nsURI) throws InvalidNamedObjectException {
super(tagName, prefix, nsURI);
createDocument();
***************
*** 234,238 ****
}
! protected NamedObjectBuilder(final String name, final String tagName, final Namespace ns) throws NeuClearException {
super(tagName, ns);
createDocument();
--- 242,246 ----
}
! protected NamedObjectBuilder(final String name, final String tagName, final Namespace ns) throws InvalidNamedObjectException {
super(tagName, ns);
createDocument();
***************
*** 240,244 ****
}
! protected NamedObjectBuilder(final String name, final String tagName) throws NeuClearException {
super(tagName, NSTools.NS_NEUID);
createDocument();
--- 248,252 ----
}
! protected NamedObjectBuilder(final String name, final String tagName) throws InvalidNamedObjectException {
super(tagName, NSTools.NS_NEUID);
createDocument();
***************
*** 246,250 ****
}
! protected NamedObjectBuilder(final String name, final QName qname) throws NeuClearException {
super(qname);
createDocument();
--- 254,258 ----
}
! protected NamedObjectBuilder(final String name, final QName qname) throws InvalidNamedObjectException {
super(qname);
createDocument();
***************
*** 252,272 ****
}
! public NamedObjectBuilder(final Element elem) throws XMLSecurityException {
super(elem);
}
! public NamedObjectBuilder(final Document doc) throws XMLSecurityException {
super(doc.getRootElement());
}
! final public SignedNamedObject sign(final Signer signer) throws NeuClearException, XMLException {
! sign(getSignatory().getName(), signer); //Sign with parent key
! return convert();
}
! final public SignedNamedObject convert() throws NeuClearException, XMLException {
return VerifyingReader.getInstance().read(getElement());
--- 260,287 ----
}
! public NamedObjectBuilder(final Element elem) throws XMLSecurityException,InvalidNamedObjectException {
super(elem);
+ final String name=getName();
+ if (!NSTools.isValidName(name))
+ throw new InvalidNamedObjectException(name);
}
! public NamedObjectBuilder(final Document doc) throws XMLSecurityException,InvalidNamedObjectException {
super(doc.getRootElement());
}
! final public SignedNamedObject sign(final Signer signer) throws InvalidNamedObjectException, NonExistingSignerException, UserCancellationException, NameResolutionException {
! try {
! sign(getSignatory().getName(), signer); //Sign with parent key
! return convert();
! } catch (XMLSecurityException e) {
! throw new InvalidNamedObjectException(getName(),e);
! }
}
! final public SignedNamedObject convert() throws InvalidNamedObjectException, NameResolutionException{
return VerifyingReader.getInstance().read(getElement());
***************
*** 279,283 ****
*/
public final String getName() {
! return getElement().attributeValue(getNameAttrQName());
}
--- 294,302 ----
*/
public final String getName() {
! QName q=getNameAttrQName();
! if (getElement()!=null&&getElement().attribute(q)!=null)
! return getElement().attributeValue(q);
! return null;
!
}
***************
*** 287,295 ****
* @return Parent Name
*/
! public final String getLocalName() throws NeuClearException {
return NSTools.getLocalName(getName());
}
! private void setName(final String name) throws NeuClearException {
getElement().addAttribute(getNameAttrQName(), NSTools.normalizeNameURI(name));
}
--- 306,314 ----
* @return Parent Name
*/
! public final String getLocalName() throws InvalidNamedObjectException {
return NSTools.getLocalName(getName());
}
! private void setName(final String name) throws InvalidNamedObjectException {
getElement().addAttribute(getNameAttrQName(), NSTools.normalizeNameURI(name));
}
***************
*** 414,423 ****
*/
! public final Timestamp getTimeStamp() throws NeuClearException {
final String timeString = getElement().attributeValue(DocumentHelper.createQName("timestamp", NSTools.NS_NEUID));
if (isSigned() && !Utility.isEmpty(timeString)) {
try {
return TimeTools.parseTimeStamp(timeString);
! } catch (NeuClearException e) {
return null;
}
--- 433,442 ----
*/
! public final Timestamp getTimeStamp() {
final String timeString = getElement().attributeValue(DocumentHelper.createQName("timestamp", NSTools.NS_NEUID));
if (isSigned() && !Utility.isEmpty(timeString)) {
try {
return TimeTools.parseTimeStamp(timeString);
! } catch (ParseException e) {
return null;
}
***************
*** 430,434 ****
! public final Identity getSignatory() throws NeuClearException {
return NSResolver.resolveIdentity(NSTools.getSignatoryURI(getName()));
}
--- 449,453 ----
! public final Identity getSignatory() throws InvalidNamedObjectException, NameResolutionException {
return NSResolver.resolveIdentity(NSTools.getSignatoryURI(getName()));
}
***************
*** 492,496 ****
DocumentHelper.createDocument(elem);
return new NamedObjectBuilder(elem);
! } catch (XMLSecurityException e) {
throw new RuntimeException(e);
}
--- 511,515 ----
DocumentHelper.createDocument(elem);
return new NamedObjectBuilder(elem);
! } catch (Exception e) {
throw new RuntimeException(e);
}
|
|
From: <pe...@us...> - 2003-12-19 18:03:37
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/auth
In directory sc8-pr-cvs1:/tmp/cvs-serv5310/src/java/org/neuclear/auth
Modified Files:
AuthenticationTicket.java
Log Message:
Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
- For most cases the main exception to worry about now is InvalidNamedObjectException.
- Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
runtime exception.
- Source and Store patterns each now have their own exceptions that generalizes the various physical
exceptions that can happen in that area.
Index: AuthenticationTicket.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/auth/AuthenticationTicket.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** AuthenticationTicket.java 21 Nov 2003 13:57:27 -0000 1.6
--- AuthenticationTicket.java 19 Dec 2003 18:03:34 -0000 1.7
***************
*** 12,24 ****
import org.dom4j.Element;
import org.dom4j.Namespace;
import org.neuclear.commons.NeuClearException;
import org.neuclear.commons.time.TimeTools;
! import org.neuclear.id.Identity;
! import org.neuclear.id.NamedObjectReader;
! import org.neuclear.id.SignedNamedObject;
! import org.neuclear.id.SignedNamedCore;
import org.neuclear.xml.xmlsec.XMLSecurityException;
import java.sql.Timestamp;
/**
--- 12,24 ----
import org.dom4j.Element;
import org.dom4j.Namespace;
+ import org.dom4j.QName;
import org.neuclear.commons.NeuClearException;
+ import org.neuclear.commons.Utility;
import org.neuclear.commons.time.TimeTools;
! import org.neuclear.id.*;
import org.neuclear.xml.xmlsec.XMLSecurityException;
import java.sql.Timestamp;
+ import java.text.ParseException;
/**
***************
*** 40,46 ****
* @param validto
* @param siteurl
- * @throws NeuClearException
*/
! private AuthenticationTicket(final SignedNamedCore core, final String requester, final Timestamp validto, final String siteurl) throws NeuClearException {
super(core);
this.validTo = validto.getTime();
--- 40,45 ----
* @param validto
* @param siteurl
*/
! private AuthenticationTicket(final SignedNamedCore core, final String requester, final Timestamp validto, final String siteurl) {
super(core);
this.validTo = validto.getTime();
***************
*** 77,86 ****
* @return
*/
! public final SignedNamedObject read(final SignedNamedCore core, final Element elem) throws NeuClearException, XMLSecurityException {
! final String requester = elem.attributeValue(DocumentHelper.createQName("requester", NS_NSAUTH));
! final String sitehref = elem.attributeValue(DocumentHelper.createQName("sitehref", NS_NSAUTH));
! final Timestamp validto = TimeTools.parseTimeStamp(elem.attributeValue(DocumentHelper.createQName("validto", NS_NSAUTH)));
!
! return new AuthenticationTicket(core, requester, validto, sitehref);
}
--- 76,93 ----
* @return
*/
! public final SignedNamedObject read(final SignedNamedCore core, final Element elem) throws InvalidNamedObjectException {
! final QName qelem=DocumentHelper.createQName(TAG_NAME,NS_NSAUTH);
! InvalidNamedObjectException.assertElementQName(core,elem,qelem);
! final QName qreq = DocumentHelper.createQName("requester", NS_NSAUTH);
! final String requester = InvalidNamedObjectException.assertAttributeQName(core,elem,qreq);
! final QName qsite = DocumentHelper.createQName("sitehref", NS_NSAUTH);
! final String sitehref = InvalidNamedObjectException.assertAttributeQName(core,elem,qsite);
! try {
! final QName qtime = DocumentHelper.createQName("validto", NS_NSAUTH);
! final Timestamp validto = TimeTools.parseTimeStamp(InvalidNamedObjectException.assertAttributeQName(core,elem,qtime));
! return new AuthenticationTicket(core, requester, validto, sitehref);
! } catch (ParseException e) {
! throw new InvalidNamedObjectException(core.getName(),e.getLocalizedMessage());
! }
}
|
|
From: <pe...@us...> - 2003-12-19 18:03:37
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/cache
In directory sc8-pr-cvs1:/tmp/cvs-serv5310/src/java/org/neuclear/id/cache
Modified Files:
NSCache.java
Log Message:
Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
- For most cases the main exception to worry about now is InvalidNamedObjectException.
- Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
runtime exception.
- Source and Store patterns each now have their own exceptions that generalizes the various physical
exceptions that can happen in that area.
Index: NSCache.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/cache/NSCache.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** NSCache.java 10 Dec 2003 23:58:51 -0000 1.7
--- NSCache.java 19 Dec 2003 18:03:34 -0000 1.8
***************
*** 7,10 ****
--- 7,11 ----
import org.neuclear.id.NSTools;
import org.neuclear.id.SignedNamedObject;
+ import org.neuclear.id.InvalidNamedObjectException;
/**
***************
*** 37,45 ****
}
! public void cache(final SignedNamedObject ns) throws NeuClearException {
// Only store if it's parent is already here
! final String parentName = NSTools.getSignatoryURI(ns.getName());
! if ((fetchCached(parentName) != null) || (parentName.equals("neu://"))) {
! spaces.put(ns.getName(), ns);
}
}
--- 38,50 ----
}
! public void cache(final SignedNamedObject ns) {
// Only store if it's parent is already here
! try {
! final String parentName = NSTools.getSignatoryURI(ns.getName());
! if ((fetchCached(parentName) != null) || (parentName.equals("neu://")||NSTools.isHttpScheme(ns.getName())!=null)) {
! spaces.put(ns.getName(), ns);
! }
! } catch (InvalidNamedObjectException e) {
! ;// If we have an issue here we will silently ignore it.
}
}
|
|
From: <pe...@us...> - 2003-12-19 18:03:11
|
Update of /cvsroot/neuclear/neuclear-xmlsig
In directory sc8-pr-cvs1:/tmp/cvs-serv5237
Modified Files:
project.xml
Log Message:
Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
- For most cases the main exception to worry about now is InvalidNamedObjectException.
- Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
runtime exception.
- Source and Store patterns each now have their own exceptions that generalizes the various physical
exceptions that can happen in that area.
Index: project.xml
===================================================================
RCS file: /cvsroot/neuclear/neuclear-xmlsig/project.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** project.xml 12 Dec 2003 21:36:46 -0000 1.8
--- project.xml 19 Dec 2003 18:03:08 -0000 1.9
***************
*** 4,8 ****
<name>NeuDist XML Signature API</name>
<id>neuclear-xmlsig</id>
! <currentVersion>0.11</currentVersion>
<inceptionYear>2002</inceptionYear>
<package>org.neuclear</package>
--- 4,8 ----
<name>NeuDist XML Signature API</name>
<id>neuclear-xmlsig</id>
! <currentVersion>0.11.1-SNAPSHOT</currentVersion>
<inceptionYear>2002</inceptionYear>
<package>org.neuclear</package>
***************
*** 76,80 ****
<id>neuclear-commons</id>
<name>neuclear-commons</name>
! <version>0.5</version>
<properties>
<war.bundle>true</war.bundle>
--- 76,80 ----
<id>neuclear-commons</id>
<name>neuclear-commons</name>
! <version>0.5.1-SNAPSHOT</version>
<properties>
<war.bundle>true</war.bundle>
|
Update of /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec
In directory sc8-pr-cvs1:/tmp/cvs-serv5237/src/java/org/neuclear/xml/xmlsec
Modified Files:
KeyInfo.java QuickEmbeddedSignature.java SignedElement.java
XMLSecTools.java XMLSignature.java
Log Message:
Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
- For most cases the main exception to worry about now is InvalidNamedObjectException.
- Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
runtime exception.
- Source and Store patterns each now have their own exceptions that generalizes the various physical
exceptions that can happen in that area.
Index: KeyInfo.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec/KeyInfo.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** KeyInfo.java 11 Dec 2003 23:56:53 -0000 1.4
--- KeyInfo.java 19 Dec 2003 18:03:07 -0000 1.5
***************
*** 73,77 ****
*/
public final PublicKey getPublicKey()
! throws XMLSecurityException, CryptoException {
if (pub == null) {
try {
--- 73,77 ----
*/
public final PublicKey getPublicKey()
! throws XMLSecurityException {
if (pub == null) {
try {
Index: QuickEmbeddedSignature.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec/QuickEmbeddedSignature.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** QuickEmbeddedSignature.java 21 Nov 2003 04:44:31 -0000 1.3
--- QuickEmbeddedSignature.java 19 Dec 2003 18:03:07 -0000 1.4
***************
*** 8,11 ****
--- 8,19 ----
* $Id$
* $Log$
+ * Revision 1.4 2003/12/19 18:03:07 pelle
+ * Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ * - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ * - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ * runtime exception.
+ * - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ * exceptions that can happen in that area.
+ *
* Revision 1.3 2003/11/21 04:44:31 pelle
* EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
***************
*** 102,106 ****
--- 110,116 ----
import org.neuclear.commons.crypto.CryptoTools;
import org.neuclear.commons.crypto.signers.Signer;
+ import org.neuclear.commons.crypto.signers.NonExistingSignerException;
import org.neuclear.commons.crypto.CryptoException;
+ import org.neuclear.commons.crypto.passphraseagents.UserCancellationException;
import java.security.KeyPair;
***************
*** 132,136 ****
}
! public QuickEmbeddedSignature(final String name, final Signer signer, final Element root, final String uri) throws XMLSecurityException, CryptoException {
super(getSignatureElement(root,signer.getKeyType(name)));
final Element sig = getElement();
--- 142,146 ----
}
! public QuickEmbeddedSignature(final String name, final Signer signer, final Element root, final String uri) throws XMLSecurityException, UserCancellationException, NonExistingSignerException {
super(getSignatureElement(root,signer.getKeyType(name)));
final Element sig = getElement();
Index: SignedElement.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec/SignedElement.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** SignedElement.java 10 Dec 2003 23:57:05 -0000 1.5
--- SignedElement.java 19 Dec 2003 18:03:07 -0000 1.6
***************
*** 1,4 ****
--- 1,12 ----
/* $Id$
* $Log$
+ * Revision 1.6 2003/12/19 18:03:07 pelle
+ * Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ * - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ * - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ * runtime exception.
+ * - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ * exceptions that can happen in that area.
+ *
* Revision 1.5 2003/12/10 23:57:05 pelle
* Did some cleaning up in the builders
***************
*** 114,118 ****
--- 122,128 ----
import org.dom4j.QName;
import org.neuclear.commons.crypto.CryptoException;
+ import org.neuclear.commons.crypto.passphraseagents.UserCancellationException;
import org.neuclear.commons.crypto.signers.Signer;
+ import org.neuclear.commons.crypto.signers.NonExistingSignerException;
import org.neuclear.xml.AbstractElementProxy;
import org.neuclear.xml.XMLException;
***************
*** 202,206 ****
}
! public final void sign(final String name, final Signer signer) throws XMLSecurityException, CryptoException {
preSign();
sig = XMLSecTools.signElement(getURI(), getElement(), name, signer);
--- 212,216 ----
}
! public final void sign(final String name, final Signer signer) throws XMLSecurityException, NonExistingSignerException, UserCancellationException {
preSign();
sig = XMLSecTools.signElement(getURI(), getElement(), name, signer);
Index: XMLSecTools.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec/XMLSecTools.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** XMLSecTools.java 21 Nov 2003 04:44:31 -0000 1.4
--- XMLSecTools.java 19 Dec 2003 18:03:07 -0000 1.5
***************
*** 1,4 ****
--- 1,12 ----
/* $Id$
* $Log$
+ * Revision 1.5 2003/12/19 18:03:07 pelle
+ * Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ * - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ * - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ * runtime exception.
+ * - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ * exceptions that can happen in that area.
+ *
* Revision 1.4 2003/11/21 04:44:31 pelle
* EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
***************
*** 142,145 ****
--- 150,155 ----
import org.neuclear.commons.crypto.Base64;
import org.neuclear.commons.crypto.CryptoException;
+ import org.neuclear.commons.crypto.passphraseagents.UserCancellationException;
+ import org.neuclear.commons.crypto.signers.NonExistingSignerException;
import org.neuclear.xml.XMLException;
import org.neuclear.xml.c14.Canonicalizer;
***************
*** 205,209 ****
* @throws XMLSecurityException
*/
! public static XMLSignature signElement(final String baseURI, final Element root, final String name, final org.neuclear.commons.crypto.signers.Signer signer) throws XMLSecurityException, CryptoException {//, KeyStoreException {
final XMLSignature sig = new QuickEmbeddedSignature(name, signer, root, baseURI);
return sig;
--- 215,219 ----
* @throws XMLSecurityException
*/
! public static XMLSignature signElement(final String baseURI, final Element root, final String name, final org.neuclear.commons.crypto.signers.Signer signer) throws XMLSecurityException, NonExistingSignerException, UserCancellationException {//, KeyStoreException {
final XMLSignature sig = new QuickEmbeddedSignature(name, signer, root, baseURI);
return sig;
***************
*** 312,316 ****
* @throws XMLSecurityException
*/
! public static boolean verifySignature(final Element elem, final PublicKey pub) throws XMLSecurityException, CryptoException {
final XMLSignature sig = getXMLSignature(elem);
return sig.verifySignature(pub);
--- 322,326 ----
* @throws XMLSecurityException
*/
! public static boolean verifySignature(final Element elem, final PublicKey pub) throws XMLSecurityException {
final XMLSignature sig = getXMLSignature(elem);
return sig.verifySignature(pub);
***************
*** 325,329 ****
* @throws XMLSecurityException
*/
! public static boolean verifySignature(final Element elem, final PublicKey[] pubs) throws XMLSecurityException, CryptoException {
final XMLSignature sig = getXMLSignature(elem);
return sig.verifySignature(pubs);
--- 335,339 ----
* @throws XMLSecurityException
*/
! public static boolean verifySignature(final Element elem, final PublicKey[] pubs) throws XMLSecurityException {
final XMLSignature sig = getXMLSignature(elem);
return sig.verifySignature(pubs);
***************
*** 467,472 ****
* @return
*/
! public static BigInteger decodeBigIntegerFromElement(final Element element)
! throws CryptoException {
return new BigInteger(1, decodeBase64Element(element));
}
--- 477,481 ----
* @return
*/
! public static BigInteger decodeBigIntegerFromElement(final Element element) throws XMLSecurityException {
return new BigInteger(1, decodeBase64Element(element));
}
***************
*** 511,515 ****
* @return
*/
! public static byte[] decodeBase64Element(final Element element) throws CryptoException {
final Iterator iter = element.nodeIterator();
--- 520,524 ----
* @return
*/
! public static byte[] decodeBase64Element(final Element element) throws XMLSecurityException {
final Iterator iter = element.nodeIterator();
***************
*** 526,530 ****
}
! return Base64.decode(sb.toString());
}
--- 535,543 ----
}
! try {
! return Base64.decode(sb.toString());
! } catch (CryptoException e) {
! throw new XMLSecurityException(e);
! }
}
Index: XMLSignature.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec/XMLSignature.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** XMLSignature.java 11 Dec 2003 23:56:53 -0000 1.5
--- XMLSignature.java 19 Dec 2003 18:03:07 -0000 1.6
***************
*** 1,4 ****
--- 1,12 ----
/* $Id$
* $Log$
+ * Revision 1.6 2003/12/19 18:03:07 pelle
+ * Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ * - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ * - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ * runtime exception.
+ * - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ * exceptions that can happen in that area.
+ *
* Revision 1.5 2003/12/11 23:56:53 pelle
* Trying to test the ReceiverServlet with cactus. Still no luck. Need to return a ElementProxy of some sort.
***************
*** 246,250 ****
}
! public final boolean verifySignature() throws XMLSecurityException, CryptoException {
final Element keyInfoElem = getElement().element(XMLSecTools.createQName("KeyInfo"));
if (keyInfoElem == null)
--- 254,258 ----
}
! public final boolean verifySignature() throws XMLSecurityException {
final Element keyInfoElem = getElement().element(XMLSecTools.createQName("KeyInfo"));
if (keyInfoElem == null)
***************
*** 255,280 ****
}
! public final boolean verifySignature(final PublicKey pk) throws XMLSecurityException, CryptoException {
! if (!si.getReference().verifyReferences())
! return false;
! final byte[] sig = getSignature();
! final byte[] cansi = si.canonicalize();
! return CryptoTools.verify(pk, cansi, sig);
}
! public final boolean verifySignature(final PublicKey[] pks) throws XMLSecurityException, CryptoException {
! if (!si.getReference().verifyReferences()) {
// System.err.println("XMLSIG: References didnt match up");
return false;
}
- final byte[] sig = getSignature();
- final byte[] cansi = si.canonicalize();
- for (int i = 0; i < pks.length; i++)
- if (CryptoTools.verify(pks[i], cansi, sig))
- return true;
- // System.err.println("XMLSIG: Signature didnt Verify");
- return false;
}
--- 263,296 ----
}
! public final boolean verifySignature(final PublicKey pk) throws XMLSecurityException {
! try {
! if (!si.getReference().verifyReferences())
! return false;
! final byte[] sig = getSignature();
! final byte[] cansi = si.canonicalize();
! return CryptoTools.verify(pk, cansi, sig);
! } catch (CryptoException e) {
! throw new XMLSecurityException(e);
! }
}
! public final boolean verifySignature(final PublicKey[] pks) throws XMLSecurityException {
! try {
! if (!si.getReference().verifyReferences()) {
// System.err.println("XMLSIG: References didnt match up");
+ return false;
+ }
+ final byte[] sig = getSignature();
+ final byte[] cansi = si.canonicalize();
+ for (int i = 0; i < pks.length; i++)
+ if (CryptoTools.verify(pks[i], cansi, sig))
+ return true;
+ // System.err.println("XMLSIG: Signature didnt Verify");
return false;
+ } catch (CryptoException e) {
+ throw new XMLSecurityException(e);
}
}
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents
In directory sc8-pr-cvs1:/tmp/cvs-serv5157/src/java/org/neuclear/commons/crypto/passphraseagents
Modified Files:
AlwaysTheSamePassphraseAgent.java AskAtStartupAgent.java
InteractiveAgent.java PassPhraseAgent.java
StoredPassphraseAgent.java
Log Message:
Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
- For most cases the main exception to worry about now is InvalidNamedObjectException.
- Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
runtime exception.
- Source and Store patterns each now have their own exceptions that generalizes the various physical
exceptions that can happen in that area.
Index: AlwaysTheSamePassphraseAgent.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents/AlwaysTheSamePassphraseAgent.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AlwaysTheSamePassphraseAgent.java 21 Nov 2003 04:43:40 -0000 1.2
--- AlwaysTheSamePassphraseAgent.java 19 Dec 2003 18:02:53 -0000 1.3
***************
*** 1,4 ****
--- 1,6 ----
package org.neuclear.commons.crypto.passphraseagents;
+ import org.neuclear.commons.LowLevelException;
+
/*
NeuClear Distributed Transaction Clearing Platform
***************
*** 21,24 ****
--- 23,34 ----
$Id$
$Log$
+ Revision 1.3 2003/12/19 18:02:53 pelle
+ Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ runtime exception.
+ - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ exceptions that can happen in that area.
+
Revision 1.2 2003/11/21 04:43:40 pelle
EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
***************
*** 59,62 ****
--- 69,77 ----
public final char[] getPassPhrase(final String name) {
return passphrase.toCharArray();
+ }
+
+ public char[] getPassPhrase(String name, boolean incorrect) throws UserCancellationException {
+ if (incorrect) throw new LowLevelException("passphrase is incorrect for: "+name);
+ return getPassPhrase(name);
}
Index: AskAtStartupAgent.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents/AskAtStartupAgent.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** AskAtStartupAgent.java 19 Dec 2003 00:31:15 -0000 1.4
--- AskAtStartupAgent.java 19 Dec 2003 18:02:53 -0000 1.5
***************
*** 1,4 ****
--- 1,6 ----
package org.neuclear.commons.crypto.passphraseagents;
+ import org.neuclear.commons.LowLevelException;
+
/*
NeuClear Distributed Transaction Clearing Platform
***************
*** 21,24 ****
--- 23,34 ----
$Id$
$Log$
+ Revision 1.5 2003/12/19 18:02:53 pelle
+ Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ runtime exception.
+ - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ exceptions that can happen in that area.
+
Revision 1.4 2003/12/19 00:31:15 pelle
Lots of usability changes through out all the passphrase agents and end user tools.
***************
*** 54,57 ****
--- 64,68 ----
public AskAtStartupAgent(final InteractiveAgent agent, final String name) throws UserCancellationException {
this.name = name;
+ this.agent=agent;
this.passphrase = agent.getPassPhrase(name);
}
***************
*** 70,75 ****
}
private final String name;
! private final char[] passphrase;
}
--- 81,97 ----
}
+ public char[] getPassPhrase(String name, boolean incorrect) throws UserCancellationException {
+ if (incorrect) {
+ if (name.equals(this.name))
+ passphrase=agent.getPassPhrase(name);
+ else
+ throw new LowLevelException(getClass().getName()+"\nCan not provide passphrase for: "+name);
+ }
+ return getPassPhrase(name);
+ }
+
private final String name;
! private char[] passphrase;
! private final PassPhraseAgent agent;
}
Index: InteractiveAgent.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents/InteractiveAgent.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** InteractiveAgent.java 19 Dec 2003 00:31:15 -0000 1.2
--- InteractiveAgent.java 19 Dec 2003 18:02:53 -0000 1.3
***************
*** 21,24 ****
--- 21,32 ----
$Id$
$Log$
+ Revision 1.3 2003/12/19 18:02:53 pelle
+ Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ runtime exception.
+ - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ exceptions that can happen in that area.
+
Revision 1.2 2003/12/19 00:31:15 pelle
Lots of usability changes through out all the passphrase agents and end user tools.
***************
*** 42,46 ****
*/
public interface InteractiveAgent extends PassPhraseAgent {
- char[] getPassPhrase(String name,boolean incorrect) throws UserCancellationException;
}
--- 50,53 ----
Index: PassPhraseAgent.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents/PassPhraseAgent.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** PassPhraseAgent.java 19 Dec 2003 00:31:15 -0000 1.3
--- PassPhraseAgent.java 19 Dec 2003 18:02:53 -0000 1.4
***************
*** 22,25 ****
--- 22,33 ----
$Id$
$Log$
+ Revision 1.4 2003/12/19 18:02:53 pelle
+ Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ runtime exception.
+ - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ exceptions that can happen in that area.
+
Revision 1.3 2003/12/19 00:31:15 pelle
Lots of usability changes through out all the passphrase agents and end user tools.
***************
*** 67,69 ****
--- 75,79 ----
*/
char[] getPassPhrase(String name) throws UserCancellationException;
+
+ char[] getPassPhrase(String name,boolean incorrect) throws UserCancellationException;
}
Index: StoredPassphraseAgent.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents/StoredPassphraseAgent.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** StoredPassphraseAgent.java 21 Nov 2003 04:43:41 -0000 1.3
--- StoredPassphraseAgent.java 19 Dec 2003 18:02:53 -0000 1.4
***************
*** 1,4 ****
--- 1,6 ----
package org.neuclear.commons.crypto.passphraseagents;
+ import org.neuclear.commons.LowLevelException;
+
/*
NeuClear Distributed Transaction Clearing Platform
***************
*** 21,24 ****
--- 23,34 ----
$Id$
$Log$
+ Revision 1.4 2003/12/19 18:02:53 pelle
+ Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ runtime exception.
+ - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ exceptions that can happen in that area.
+
Revision 1.3 2003/11/21 04:43:41 pelle
EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
***************
*** 62,66 ****
return passphrase.toCharArray();
else
! return new char[0];
}
--- 72,86 ----
return passphrase.toCharArray();
else
! throw new LowLevelException(getClass().getName()+"\nCan not provide passphrase for: "+name);
! }
!
! public char[] getPassPhrase(String name, boolean incorrect) throws UserCancellationException {
! if (incorrect) {
! if (name.equals(this.name))
! throw new LowLevelException(getClass().getName()+"\nIncorrect passphrase set for:"+name);
! else
! throw new LowLevelException(getClass().getName()+"\nCan not provide passphrase for: "+name);
! }
! return getPassPhrase(name);
}
|
|
From: <pe...@us...> - 2003-12-19 18:02:57
|
Update of /cvsroot/neuclear/neuclear-commons/src/test/org/neuclear/commons/crypto/signers
In directory sc8-pr-cvs1:/tmp/cvs-serv5157/src/test/org/neuclear/commons/crypto/signers
Modified Files:
SimpleSignerStoreTest.java TestCaseSignerTest.java
Log Message:
Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
- For most cases the main exception to worry about now is InvalidNamedObjectException.
- Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
runtime exception.
- Source and Store patterns each now have their own exceptions that generalizes the various physical
exceptions that can happen in that area.
Index: SimpleSignerStoreTest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/test/org/neuclear/commons/crypto/signers/SimpleSignerStoreTest.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** SimpleSignerStoreTest.java 18 Dec 2003 17:40:08 -0000 1.6
--- SimpleSignerStoreTest.java 19 Dec 2003 18:02:53 -0000 1.7
***************
*** 1,4 ****
--- 1,12 ----
/* $Id$
* $Log$
+ * Revision 1.7 2003/12/19 18:02:53 pelle
+ * Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ * - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ * - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ * runtime exception.
+ * - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ * exceptions that can happen in that area.
+ *
* Revision 1.6 2003/12/18 17:40:08 pelle
* You can now create keys that get stored with a X509 certificate in the keystore. These can be saved as well.
***************
*** 115,118 ****
--- 123,127 ----
import org.neuclear.commons.crypto.CryptoTools;
import org.neuclear.commons.crypto.passphraseagents.AlwaysTheSamePassphraseAgent;
+ import org.neuclear.commons.crypto.passphraseagents.UserCancellationException;
import java.io.IOException;
***************
*** 154,189 ****
! public final void testAddKey() throws NeuClearException, GeneralSecurityException, IOException {
! boolean success = false;
! try {
! signer.addKey("root", root.getPrivate());
! success = true;
! } catch (GeneralSecurityException e) {
! e.printStackTrace();
! } catch (IOException e) {
! e.printStackTrace();
! }
! assertTrue("Managed to add a key", success);
}
public final void testSignData() throws NeuClearException, GeneralSecurityException, IOException, CryptoException {
- boolean success = false;
byte data[] = null;
! try {
! signer.addKey("bob", bob.getPrivate());
! data = signer.sign("bob", "test".getBytes());
! assertTrue(CryptoTools.verify(bob.getPublic(), "test".getBytes(), data));
! success = true;
! } catch (GeneralSecurityException e) {
! e.printStackTrace();
! } catch (IOException e) {
! e.printStackTrace();
! }
! assertTrue("Managed to add and sign some data", success);
assertNotNull("Key wasn't null", data);
- //assertEquals("Gotten Key was the same as Stored Key", bob.getPrivate(), key);
}
! public final void testGenerateKey() throws CryptoException {
final PublicKey pub = signer.generateKey("tupac");
final byte[] data = "this is a test".getBytes();
--- 163,180 ----
! public final void testAddKey() throws NeuClearException{
! signer.addKey("root", root.getPrivate());
! assertTrue("Managed to add a key", signer.canSignFor("root"));
}
public final void testSignData() throws NeuClearException, GeneralSecurityException, IOException, CryptoException {
byte data[] = null;
! signer.addKey("bob", bob.getPrivate());
! data = signer.sign("bob", "test".getBytes());
! assertTrue(CryptoTools.verify(bob.getPublic(), "test".getBytes(), data));
assertNotNull("Key wasn't null", data);
}
! public final void testGenerateKey() throws CryptoException, UserCancellationException {
final PublicKey pub = signer.generateKey("tupac");
final byte[] data = "this is a test".getBytes();
Index: TestCaseSignerTest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/test/org/neuclear/commons/crypto/signers/TestCaseSignerTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** TestCaseSignerTest.java 18 Dec 2003 17:40:08 -0000 1.5
--- TestCaseSignerTest.java 19 Dec 2003 18:02:53 -0000 1.6
***************
*** 5,8 ****
--- 5,9 ----
import org.neuclear.commons.crypto.CryptoException;
import org.neuclear.commons.crypto.CryptoTools;
+ import org.neuclear.commons.crypto.passphraseagents.UserCancellationException;
import java.security.GeneralSecurityException;
***************
*** 29,32 ****
--- 30,41 ----
$Id$
$Log$
+ Revision 1.6 2003/12/19 18:02:53 pelle
+ Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ runtime exception.
+ - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ exceptions that can happen in that area.
+
Revision 1.5 2003/12/18 17:40:08 pelle
You can now create keys that get stored with a X509 certificate in the keystore. These can be saved as well.
***************
*** 80,84 ****
}
! public final void testSignAndVerify() throws CryptoException {
testKey("neu://test");
testKey("neu://test/bux");
--- 89,93 ----
}
! public final void testSignAndVerify() throws CryptoException, UserCancellationException {
testKey("neu://test");
testKey("neu://test/bux");
***************
*** 87,91 ****
}
! public final void testGenerateKey() throws CryptoException {
final PublicKey pub = signer.generateKey(ALIASEVE);
final byte[] data = "this is a test".getBytes();
--- 96,100 ----
}
! public final void testGenerateKey() throws CryptoException, UserCancellationException {
final PublicKey pub = signer.generateKey(ALIASEVE);
final byte[] data = "this is a test".getBytes();
***************
*** 95,99 ****
assertTrue(signer.canSignFor(ALIASEVE));
}
! private void testKey(final String name) throws CryptoException {
final byte[] sig = signer.sign(name, TESTDATA.getBytes());
assertNotNull(sig);
--- 104,108 ----
assertTrue(signer.canSignFor(ALIASEVE));
}
! private void testKey(final String name) throws CryptoException, UserCancellationException {
final byte[] sig = signer.sign(name, TESTDATA.getBytes());
assertNotNull(sig);
|
|
From: <pe...@us...> - 2003-12-19 18:02:57
|
Update of /cvsroot/neuclear/neuclear-commons/src/test-cactus/org/neuclear/commons/crypto/passphraseagents
In directory sc8-pr-cvs1:/tmp/cvs-serv5157/src/test-cactus/org/neuclear/commons/crypto/passphraseagents
Modified Files:
MockPassphraseServlet.java
Log Message:
Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
- For most cases the main exception to worry about now is InvalidNamedObjectException.
- Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
runtime exception.
- Source and Store patterns each now have their own exceptions that generalizes the various physical
exceptions that can happen in that area.
Index: MockPassphraseServlet.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/test-cactus/org/neuclear/commons/crypto/passphraseagents/MockPassphraseServlet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MockPassphraseServlet.java 14 Dec 2003 20:52:55 -0000 1.1
--- MockPassphraseServlet.java 19 Dec 2003 18:02:53 -0000 1.2
***************
*** 27,30 ****
--- 27,35 ----
return agent.getPassPhrase(name); //To change body of implemented methods use Options | File Templates.
}
+
+ public char[] getPassPhrase(String name, boolean incorrect) throws UserCancellationException {
+ return getPassPhrase(name);
+ }
+
private ServletPassPhraseAgent agent;
}
|
|
From: <pe...@us...> - 2003-12-19 18:02:57
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons
In directory sc8-pr-cvs1:/tmp/cvs-serv5157/src/java/org/neuclear/commons
Modified Files:
LowLevelException.java Utility.java
Log Message:
Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
- For most cases the main exception to worry about now is InvalidNamedObjectException.
- Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
runtime exception.
- Source and Store patterns each now have their own exceptions that generalizes the various physical
exceptions that can happen in that area.
Index: LowLevelException.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/LowLevelException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** LowLevelException.java 19 Dec 2003 00:31:16 -0000 1.2
--- LowLevelException.java 19 Dec 2003 18:02:53 -0000 1.3
***************
*** 21,24 ****
--- 21,32 ----
$Id$
$Log$
+ Revision 1.3 2003/12/19 18:02:53 pelle
+ Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ runtime exception.
+ - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ exceptions that can happen in that area.
+
Revision 1.2 2003/12/19 00:31:16 pelle
Lots of usability changes through out all the passphrase agents and end user tools.
***************
*** 38,41 ****
--- 46,52 ----
public LowLevelException(Throwable e) {
super("LowLevelException in a sub system of NeuClear:\n"+e.getLocalizedMessage(), e);
+ }
+ public LowLevelException(String message) {
+ super("LowLevelException in a sub system of NeuClear:\n"+message);
}
}
Index: Utility.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/Utility.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Utility.java 19 Dec 2003 00:31:16 -0000 1.4
--- Utility.java 19 Dec 2003 18:02:53 -0000 1.5
***************
*** 2,5 ****
--- 2,13 ----
* $Id$
* $Log$
+ * Revision 1.5 2003/12/19 18:02:53 pelle
+ * Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ * - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ * - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ * runtime exception.
+ * - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ * exceptions that can happen in that area.
+ *
* Revision 1.4 2003/12/19 00:31:16 pelle
* Lots of usability changes through out all the passphrase agents and end user tools.
***************
*** 135,142 ****
import org.neuclear.commons.NeuClearException;
! import java.io.PrintStream;
! import java.io.BufferedReader;
! import java.io.InputStreamReader;
! import java.io.IOException;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
--- 143,147 ----
import org.neuclear.commons.NeuClearException;
! import java.io.*;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
***************
*** 211,217 ****
* @return
*/
! public static boolean getAffirmative(final boolean def) throws IOException {
final String prompt = def?"(yes)/no":"yes/(no)";
String line=prompt(prompt).toLowerCase();
if (isEmpty(line))
return def;
--- 216,223 ----
* @return
*/
! public static boolean getAffirmative(final boolean def) {
final String prompt = def?"(yes)/no":"yes/(no)";
String line=prompt(prompt).toLowerCase();
+ System.out.println();
if (isEmpty(line))
return def;
***************
*** 219,229 ****
}
! public static String prompt(String prompt) throws IOException {
System.out.print(prompt);
return readLine();
}
! public static String readLine() throws IOException {
BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
! return reader.readLine();
}
--- 225,239 ----
}
! public static String prompt(String prompt) {
System.out.print(prompt);
return readLine();
}
! public static String readLine() {
BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
! try {
! return reader.readLine();
! } catch (IOException e) {
! throw new LowLevelException(e);
! }
}
***************
*** 233,276 ****
String classfile=m.replaceAll("/")+".class";
String url=reference.getClassLoader().getResource(classfile).toExternalForm();
! if (url.startsWith("jar:")) {
! Pattern r2=Pattern.compile(":([^:]*\\.jar)!");
! Matcher m2=r2.matcher(url);
! if(m2.matches()){
! String path=m2.group(1);
! String cd=System.getProperty("user.dir");
! if (path.startsWith(cd))
! return "$ java -jar "+path.substring(cd.length());
! return "$ java -jar "+path;
! }
}
! return "$ java "+reference.getName();
}
! /*
! public static String normalizeNeuURL(String url) throws MalformedURLException {
! boolean clearLastChar=url.endsWith("/");
! if (url.startsWith("/")) {
! if (clearLastChar)
! return "neu:/"+url.substring(0,url.length()-2);
! return "neu:/"+url;
! }
! if (url.startsWith("neu://")) {
! if (clearLastChar)
! return url.substring(0,url.length()-2);
! return url;
! }
! throw new MalformedURLException("NEU URL: "+url+" was malformed");
!
}
! */
!
! /* public static String deURLize(String url) {
! int i=url.indexOf("://");
! if (i>0)
! return url.substring(i+2);
! if (url.length()>0&&url.substring(0,1).equals("/"))
! return url;
! return "/"+url;
! }
! */
}
--- 243,261 ----
String classfile=m.replaceAll("/")+".class";
String url=reference.getClassLoader().getResource(classfile).toExternalForm();
! Pattern r2=Pattern.compile("^jar:file:(.*)!/.*$");
! Matcher m2=r2.matcher(url);
! if(m2.matches()){
! String path=m2.group(1);
! String cd=System.getProperty("user.dir");
! if (path.startsWith(cd))
! return SYSTEM_PROMPT+"java -jar "+path.substring(cd.length()+1);
! return SYSTEM_PROMPT+"java -jar "+path;
}
! return SYSTEM_PROMPT+"java "+reference.getName();
}
! private static String getSystemConsolePrompt(){
! return (File.separatorChar=='/')?(System.getProperty("user.name")+"$ "):("C:\\"+System.getProperty("user.dir")+">");
}
! final static public String SYSTEM_PROMPT=getSystemConsolePrompt();
}
|
|
From: <pe...@us...> - 2003-12-19 18:02:57
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/time
In directory sc8-pr-cvs1:/tmp/cvs-serv5157/src/java/org/neuclear/commons/time
Modified Files:
TimeTools.java
Log Message:
Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
- For most cases the main exception to worry about now is InvalidNamedObjectException.
- Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
runtime exception.
- Source and Store patterns each now have their own exceptions that generalizes the various physical
exceptions that can happen in that area.
Index: TimeTools.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/time/TimeTools.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TimeTools.java 19 Dec 2003 00:31:16 -0000 1.4
--- TimeTools.java 19 Dec 2003 18:02:53 -0000 1.5
***************
*** 2,5 ****
--- 2,13 ----
* $Id$
* $Log$
+ * Revision 1.5 2003/12/19 18:02:53 pelle
+ * Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ * - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ * - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ * runtime exception.
+ * - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ * exceptions that can happen in that area.
+ *
* Revision 1.4 2003/12/19 00:31:16 pelle
* Lots of usability changes through out all the passphrase agents and end user tools.
***************
*** 106,115 ****
}
! public static Timestamp parseTimeStamp(final String ts) throws NeuClearException {
! try {
! return convertDateToTimestamp(getDateFormatter().parse(ts));
! } catch (ParseException e) {
! throw new NeuClearException(e);
! }
}
--- 114,119 ----
}
! public static Timestamp parseTimeStamp(final String ts) throws ParseException {
! return convertDateToTimestamp(getDateFormatter().parse(ts));
}
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/signers
In directory sc8-pr-cvs1:/tmp/cvs-serv5157/src/java/org/neuclear/commons/crypto/signers
Modified Files:
JCESigner.java PublicKeySource.java Signer.java
SimpleSigner.java
Log Message:
Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
- For most cases the main exception to worry about now is InvalidNamedObjectException.
- Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
runtime exception.
- Source and Store patterns each now have their own exceptions that generalizes the various physical
exceptions that can happen in that area.
Index: JCESigner.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/signers/JCESigner.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** JCESigner.java 19 Dec 2003 00:31:15 -0000 1.13
--- JCESigner.java 19 Dec 2003 18:02:53 -0000 1.14
***************
*** 2,5 ****
--- 2,13 ----
* $Id$
* $Log$
+ * Revision 1.14 2003/12/19 18:02:53 pelle
+ * Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ * - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ * - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ * runtime exception.
+ * - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ * exceptions that can happen in that area.
+ *
* Revision 1.13 2003/12/19 00:31:15 pelle
* Lots of usability changes through out all the passphrase agents and end user tools.
***************
*** 311,327 ****
}
! /**
! * Signs the data with the privatekey of the given name
! *
! * @param name Alias of private key to be used within KeyStore
! * @param data Data to be signed
! * @return The signature
! * @throws org.neuclear.commons.crypto.signers.InvalidPassphraseException
! * if the passphrase doesn't match
! */
! public final byte[] sign(final String name, final byte[] data) throws CryptoException {
return sign(name,data,false);
}
! public final byte[] sign(final String name, final byte[] data,boolean incorrect) throws UserCancellationException, NonExistingSignerException,CryptoException {
try {
final char[] pass = getPassPhrase(name,incorrect);
--- 319,326 ----
}
! public final byte[] sign(final String name, final byte[] data) throws NonExistingSignerException, UserCancellationException {
return sign(name,data,false);
}
! public final byte[] sign(final String name, final byte[] data,boolean incorrect) throws UserCancellationException, NonExistingSignerException {
try {
final char[] pass = getPassPhrase(name,incorrect);
***************
*** 335,338 ****
--- 334,339 ----
// Could try to reload it here but I wont for now
throw new LowLevelException(e);
+ } catch (CryptoException e) {
+ throw new LowLevelException(e);
}
}
***************
*** 344,363 ****
}
! public final boolean canSignFor(final String name) throws CryptoException {
try {
return ks.containsAlias(name);
} catch (KeyStoreException e) {
! throw new CryptoException(e);
}
}
! /**
! * Checks the key type of the given alias
! *
! * @param name
! * @return KEY_NONE,KEY_RSA,KEY_DSA
! * @throws CryptoException
! */
! public final int getKeyType(final String name) throws CryptoException {
try {
if (ks.isKeyEntry(name)) {
--- 345,357 ----
}
! public final boolean canSignFor(final String name) {
try {
return ks.containsAlias(name);
} catch (KeyStoreException e) {
! throw new LowLevelException(e);
}
}
! public final int getKeyType(final String name) {
try {
if (ks.isKeyEntry(name)) {
***************
*** 370,374 ****
}
} catch (KeyStoreException e) {
! throw new CryptoException(e);
}
return KEY_NONE; //To change body of implemented methods use Options | File Templates.
--- 364,368 ----
}
} catch (KeyStoreException e) {
! throw new LowLevelException(e);
}
return KEY_NONE; //To change body of implemented methods use Options | File Templates.
***************
*** 376,380 ****
! public final PublicKey generateKey(final String alias) throws CryptoException {
try {
final KeyPair kp = kpg.generateKeyPair();
--- 370,374 ----
! public final PublicKey generateKey(final String alias) throws UserCancellationException {
try {
final KeyPair kp = kpg.generateKeyPair();
***************
*** 382,407 ****
return kp.getPublic();
} catch (KeyStoreException e) {
! throw new CryptoException(e);
} catch (SignatureException e) {
! throw new CryptoException(e);
} catch (InvalidKeyException e) {
! throw new CryptoException(e);
}
}
! public final PublicKey getPublicKey(final String name) throws CryptoException {
try {
return ks.getCertificate(name).getPublicKey();
} catch (KeyStoreException e) {
! throw new CryptoException(e);
}
}
! public void save() throws CryptoException {
! save(filename);
}
! public synchronized final void save(String filename) throws CryptoException{
if (Utility.isEmpty(filename))
! throw new CryptoException("We dont have a filename");
try {
File ksfile=new File(filename);
--- 376,405 ----
return kp.getPublic();
} catch (KeyStoreException e) {
! throw new LowLevelException(e);
} catch (SignatureException e) {
! throw new LowLevelException(e);
} catch (InvalidKeyException e) {
! throw new LowLevelException(e);
}
}
! public final PublicKey getPublicKey(final String name) {
try {
return ks.getCertificate(name).getPublicKey();
} catch (KeyStoreException e) {
! throw new LowLevelException(e);
}
}
! public void save() {
! try {
! save(filename);
! } catch (FileNotFoundException e) {
! throw new LowLevelException(e);
! }
}
! public synchronized final void save(String filename) throws FileNotFoundException{
if (Utility.isEmpty(filename))
! throw new FileNotFoundException("no keystore filename");
try {
File ksfile=new File(filename);
***************
*** 409,413 ****
ks.store(new FileOutputStream(ksfile),agent.getPassPhrase(filename));
} catch (Exception e) {
! throw new CryptoException(e);
}
}
--- 407,411 ----
ks.store(new FileOutputStream(ksfile),agent.getPassPhrase(filename));
} catch (Exception e) {
! throw new LowLevelException(e);
}
}
Index: PublicKeySource.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/signers/PublicKeySource.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PublicKeySource.java 11 Nov 2003 21:17:47 -0000 1.1
--- PublicKeySource.java 19 Dec 2003 18:02:53 -0000 1.2
***************
*** 25,28 ****
--- 25,36 ----
$Id$
$Log$
+ Revision 1.2 2003/12/19 18:02:53 pelle
+ Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ runtime exception.
+ - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ exceptions that can happen in that area.
+
Revision 1.1 2003/11/11 21:17:47 pelle
Further vital reshuffling.
***************
*** 46,49 ****
*/
public interface PublicKeySource {
! PublicKey getPublicKey(String name) throws CryptoException;
}
--- 54,57 ----
*/
public interface PublicKeySource {
! PublicKey getPublicKey(String name) ;
}
Index: Signer.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/signers/Signer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Signer.java 18 Dec 2003 17:40:07 -0000 1.4
--- Signer.java 19 Dec 2003 18:02:53 -0000 1.5
***************
*** 2,5 ****
--- 2,13 ----
* $Id$
* $Log$
+ * Revision 1.5 2003/12/19 18:02:53 pelle
+ * Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ * - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ * - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ * runtime exception.
+ * - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ * exceptions that can happen in that area.
+ *
* Revision 1.4 2003/12/18 17:40:07 pelle
* You can now create keys that get stored with a X509 certificate in the keystore. These can be saved as well.
***************
*** 90,93 ****
--- 98,102 ----
import org.neuclear.commons.crypto.CryptoException;
+ import org.neuclear.commons.crypto.passphraseagents.UserCancellationException;
import java.security.PublicKey;
***************
*** 114,122 ****
* @param data Data to be signed
* @return The signature
- * @throws org.neuclear.commons.crypto.CryptoException
- *
*/
! public byte[] sign(String name, byte data[]) throws CryptoException;
// public void addKey(String name, char passphrase[], PrivateKey key) throws GeneralSecurityException, IOException ;
--- 123,129 ----
* @param data Data to be signed
* @return The signature
*/
! public byte[] sign(String name, byte data[])throws UserCancellationException, NonExistingSignerException ;
// public void addKey(String name, char passphrase[], PrivateKey key) throws GeneralSecurityException, IOException ;
***************
*** 127,133 ****
* @param name
* @return true if signer is contained
- * @throws CryptoException
*/
! public boolean canSignFor(String name) throws CryptoException;
--- 134,139 ----
* @param name
* @return true if signer is contained
*/
! public boolean canSignFor(String name);
***************
*** 137,143 ****
* @param name
* @return KEY_NONE,KEY_RSA,KEY_DSA
- * @throws CryptoException
*/
! public int getKeyType(String name) throws CryptoException;
/**
--- 143,148 ----
* @param name
* @return KEY_NONE,KEY_RSA,KEY_DSA
*/
! public int getKeyType(String name) ;
/**
***************
*** 147,153 ****
* @param alias
* @return Generated PublicKey
! * @throws CryptoException
*/
! public PublicKey generateKey(String alias) throws CryptoException;
final public static int KEY_NONE = 0;
--- 152,158 ----
* @param alias
* @return Generated PublicKey
! * @throws UserCancellationException
*/
! public PublicKey generateKey(String alias) throws UserCancellationException;
final public static int KEY_NONE = 0;
***************
*** 156,160 ****
final public static int KEY_OTHER = -1;
! void save() throws CryptoException;
}
--- 161,165 ----
final public static int KEY_OTHER = -1;
! void save() throws UserCancellationException;
}
Index: SimpleSigner.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/signers/SimpleSigner.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** SimpleSigner.java 19 Dec 2003 00:31:15 -0000 1.8
--- SimpleSigner.java 19 Dec 2003 18:02:53 -0000 1.9
***************
*** 2,5 ****
--- 2,13 ----
* $Id$
* $Log$
+ * Revision 1.9 2003/12/19 18:02:53 pelle
+ * Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ * - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ * - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ * runtime exception.
+ * - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ * exceptions that can happen in that area.
+ *
* Revision 1.8 2003/12/19 00:31:15 pelle
* Lots of usability changes through out all the passphrase agents and end user tools.
***************
*** 120,126 ****
--- 128,137 ----
import org.neuclear.commons.NeuClearException;
+ import org.neuclear.commons.LowLevelException;
import org.neuclear.commons.crypto.CryptoException;
import org.neuclear.commons.crypto.CryptoTools;
import org.neuclear.commons.crypto.passphraseagents.PassPhraseAgent;
+ import org.neuclear.commons.crypto.passphraseagents.UserCancellationException;
+ import org.neuclear.commons.crypto.passphraseagents.InteractiveAgent;
import javax.crypto.Cipher;
***************
*** 142,151 ****
public final class SimpleSigner implements Signer {
! public SimpleSigner(final String file, final PassPhraseAgent agent) throws NeuClearException, GeneralSecurityException {
this.agent = agent;
try {
signerFile = new File(file);
if (signerFile.exists()) {
! System.out.println("NEUDIST: Loading KeyStore");
final FileInputStream in = new FileInputStream(signerFile);
final ObjectInputStream s = new ObjectInputStream(in);
--- 153,162 ----
public final class SimpleSigner implements Signer {
! public SimpleSigner(final String file, final PassPhraseAgent agent) {
this.agent = agent;
try {
signerFile = new File(file);
if (signerFile.exists()) {
! System.out.println("NeuClear: Loading KeyStore");
final FileInputStream in = new FileInputStream(signerFile);
final ObjectInputStream s = new ObjectInputStream(in);
***************
*** 153,173 ****
} else
ks = new HashMap();
!
! kf = KeyFactory.getInstance("RSA", "BC");
! try {
! kpg = KeyPairGenerator.getInstance("RSA");
! kpg.initialize(1024, SecureRandom.getInstance("SHA1PRNG"));
! } catch (NoSuchAlgorithmException e) {
! throw new CryptoException(e);
! }
} catch (IOException e) {
! throw new NeuClearException(e);
} catch (ClassNotFoundException e) {
! throw new NeuClearException(e);
}
}
! private PrivateKey getKey(final String name, final char[] passphrase) throws CryptoException, NonExistingSignerException {
System.out.println("NEUDIST: UnSealing key " + name + " ...");
final byte[] encrypted = (byte[]) ks.get(getDigestedName(name));
--- 164,181 ----
} else
ks = new HashMap();
! kf = KeyFactory.getInstance("RSA");
! kpg = KeyPairGenerator.getInstance("RSA");
! kpg.initialize(1024, SecureRandom.getInstance("SHA1PRNG"));
} catch (IOException e) {
! throw new LowLevelException(e);
} catch (ClassNotFoundException e) {
! throw new LowLevelException(e);
! } catch (NoSuchAlgorithmException e) {
! throw new LowLevelException(e);
}
}
! private PrivateKey getKey(final String name, final char[] passphrase) throws InvalidPassphraseException, NonExistingSignerException {
System.out.println("NEUDIST: UnSealing key " + name + " ...");
final byte[] encrypted = (byte[]) ks.get(getDigestedName(name));
***************
*** 196,200 ****
throw new InvalidPassphraseException(e.getLocalizedMessage());
} catch (IOException e) {
! throw new CryptoException(e);
}
}
--- 204,208 ----
throw new InvalidPassphraseException(e.getLocalizedMessage());
} catch (IOException e) {
! throw new LowLevelException(e);
}
}
***************
*** 208,212 ****
*/
! public final void addKey(final String name, final PrivateKey key) throws GeneralSecurityException, IOException,CryptoException {
addKey(name, agent.getPassPhrase(name), key);
}
--- 216,220 ----
*/
! public final void addKey(final String name, final PrivateKey key) throws UserCancellationException {
addKey(name, agent.getPassPhrase(name), key);
}
***************
*** 220,240 ****
*/
! public final void addKey(final String name, final char[] passphrase, final PrivateKey key) throws GeneralSecurityException, IOException {
! System.out.println("NEUDIST: Sealing key: " + name + " in format " + key.getFormat());
! final ByteArrayOutputStream bOut = new ByteArrayOutputStream();
! DataOutputStream dOut = new DataOutputStream(bOut);
! final Cipher c = CryptoTools.makePBECipher(Cipher.ENCRYPT_MODE, passphrase);
! final CipherOutputStream cOut = new CipherOutputStream(dOut, c);
! dOut = new DataOutputStream(cOut);
! dOut.writeInt(11870);//This is just a quick check to see if the passphrase worked
! final byte[] keyBytes = key.getEncoded(); //I'm assuming this is PKCS8, If not tough dooda
! dOut.writeInt(keyBytes.length);
! dOut.write(keyBytes);
! dOut.close();
! final byte[] encrypted = bOut.toByteArray();
! ks.put(getDigestedName(name), encrypted);
}
! public final boolean canSignFor(final String name) throws CryptoException {
return ks.containsKey(getDigestedName(name));
}
--- 228,254 ----
*/
! public final void addKey(final String name, final char[] passphrase, final PrivateKey key) {
! System.out.println("NeuClear: Sealing key: " + name + " in format " + key.getFormat());
! try {
! final ByteArrayOutputStream bOut = new ByteArrayOutputStream();
! DataOutputStream dOut = new DataOutputStream(bOut);
! final Cipher c = CryptoTools.makePBECipher(Cipher.ENCRYPT_MODE, passphrase);
! final CipherOutputStream cOut = new CipherOutputStream(dOut, c);
! dOut = new DataOutputStream(cOut);
! dOut.writeInt(11870);//This is just a quick check to see if the passphrase worked
! final byte[] keyBytes = key.getEncoded(); //I'm assuming this is PKCS8, If not tough dooda
! dOut.writeInt(keyBytes.length);
! dOut.write(keyBytes);
! dOut.close();
! final byte[] encrypted = bOut.toByteArray();
! ks.put(getDigestedName(name), encrypted);
! } catch (GeneralSecurityException e) {
! throw new LowLevelException(e);
! } catch (IOException e) {
! throw new LowLevelException(e);
! }
}
! public final boolean canSignFor(final String name) {
return ks.containsKey(getDigestedName(name));
}
***************
*** 245,251 ****
* @param name
* @return KEY_NONE,KEY_RSA,KEY_DSA
- * @throws CryptoException
*/
! public final int getKeyType(final String name) throws CryptoException {
return (canSignFor(name)) ? KEY_RSA : KEY_NONE; // We always use RSA here
}
--- 259,264 ----
* @param name
* @return KEY_NONE,KEY_RSA,KEY_DSA
*/
! public final int getKeyType(final String name) {
return (canSignFor(name)) ? KEY_RSA : KEY_NONE; // We always use RSA here
}
***************
*** 255,259 ****
}
! public final void save() throws CryptoException {
if (signerFile.getParent() != null)
signerFile.getParentFile().mkdirs();
--- 268,272 ----
}
! public final void save() {
if (signerFile.getParent() != null)
signerFile.getParentFile().mkdirs();
***************
*** 265,269 ****
s.flush();
} catch (IOException e) {
! throw new CryptoException(e);
}
--- 278,282 ----
s.flush();
} catch (IOException e) {
! throw new LowLevelException(e);
}
***************
*** 276,297 ****
* @param data Data to be signed
* @return The signature
! * @throws InvalidPassphraseException if the passphrase doesn't match
*/
!
! public final byte[] sign(final String name, final byte[] data) throws CryptoException {
!
! return CryptoTools.sign(getKey(name, agent.getPassPhrase(name)), data);
}
! public final PublicKey generateKey(final String alias) throws CryptoException {
try {
! final KeyPair kp = kpg.generateKeyPair();
! addKey(alias, agent.getPassPhrase(alias), kp.getPrivate());
! return kp.getPublic();
! } catch (GeneralSecurityException e) {
! throw new CryptoException(e);
! } catch (IOException e) {
! throw new CryptoException(e);
}
!
}
--- 289,308 ----
* @param data Data to be signed
* @return The signature
! * @throws UserCancellationException
*/
! public final byte[] sign(final String name, final byte[] data) throws UserCancellationException {
! return sign(name,data,false);
}
! private final byte[] sign(final String name, final byte[] data,boolean incorrect) throws UserCancellationException {
try {
! return CryptoTools.sign(getKey(name, agent.getPassPhrase(name,incorrect)), data);
! } catch (CryptoException e) {
! return sign(name,data,true);
}
! }
! public final PublicKey generateKey(final String alias) throws UserCancellationException {
! final KeyPair kp = kpg.generateKeyPair();
! addKey(alias, agent.getPassPhrase(alias), kp.getPrivate());
! return kp.getPublic();
}
|
|
From: <pe...@us...> - 2003-12-19 18:02:45
|
Update of /cvsroot/neuclear/neuclear-signer
In directory sc8-pr-cvs1:/tmp/cvs-serv5137
Modified Files:
project.xml
Log Message:
Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
- For most cases the main exception to worry about now is InvalidNamedObjectException.
- Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
runtime exception.
- Source and Store patterns each now have their own exceptions that generalizes the various physical
exceptions that can happen in that area.
Index: project.xml
===================================================================
RCS file: /cvsroot/neuclear/neuclear-signer/project.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** project.xml 19 Dec 2003 00:30:55 -0000 1.4
--- project.xml 19 Dec 2003 18:02:41 -0000 1.5
***************
*** 127,131 ****
<id>commons-cli</id>
<name>commons-cli</name>
! <version>1.0-beta-2</version>
</dependency>
</dependencies>
--- 127,131 ----
<id>commons-cli</id>
<name>commons-cli</name>
! <version>1.0</version>
</dependency>
</dependencies>
|
|
From: <pe...@us...> - 2003-12-19 18:02:44
|
Update of /cvsroot/neuclear/neuclear-signer/src/java/org/neuclear/signers/standalone
In directory sc8-pr-cvs1:/tmp/cvs-serv5137/src/java/org/neuclear/signers/standalone
Modified Files:
StandaloneSigningServlet.java
Log Message:
Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
- For most cases the main exception to worry about now is InvalidNamedObjectException.
- Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
runtime exception.
- Source and Store patterns each now have their own exceptions that generalizes the various physical
exceptions that can happen in that area.
Index: StandaloneSigningServlet.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-signer/src/java/org/neuclear/signers/standalone/StandaloneSigningServlet.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** StandaloneSigningServlet.java 19 Dec 2003 00:30:55 -0000 1.3
--- StandaloneSigningServlet.java 19 Dec 2003 18:02:41 -0000 1.4
***************
*** 35,39 ****
}
! protected Signer createSigner(ServletConfig config) throws CryptoException {
try {
return new DefaultSigner(agent);
--- 35,39 ----
}
! protected Signer createSigner(ServletConfig config) throws UserCancellationException {
try {
return new DefaultSigner(agent);
|
Update of /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/contracts
In directory sc8-pr-cvs1:/tmp/cvs-serv5097/src/java/org/neuclear/asset/contracts
Modified Files:
Asset.java AssetGlobals.java AssetTransactionContract.java
CancelHeldTransferReceipt.java CancelHeldTransferRequest.java
CompleteHeldTransferRequest.java HeldTransferReceipt.java
HeldTransferRequest.java TransferContract.java
TransferReceipt.java TransferRequest.java
Log Message:
Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
- For most cases the main exception to worry about now is InvalidNamedObjectException.
- Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
runtime exception.
- Source and Store patterns each now have their own exceptions that generalizes the various physical
exceptions that can happen in that area.
Index: Asset.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/contracts/Asset.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Asset.java 10 Dec 2003 23:52:39 -0000 1.10
--- Asset.java 19 Dec 2003 18:02:35 -0000 1.11
***************
*** 32,35 ****
--- 32,43 ----
$Id$
$Log$
+ Revision 1.11 2003/12/19 18:02:35 pelle
+ Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ runtime exception.
+ - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ exceptions that can happen in that area.
+
Revision 1.10 2003/12/10 23:52:39 pelle
Did some cleaning up in the builders
***************
*** 102,106 ****
*/
public final class Asset extends Identity {
! protected Asset(final SignedNamedCore core, final String repository, final String signer, final String logger, final String receiver, final PublicKey pub, final int decimal, final double minimumTransaction) throws NeuClearException {
super(core, repository, signer, logger, receiver, pub);
this.decimal = decimal;
--- 110,114 ----
*/
public final class Asset extends Identity {
! protected Asset(final SignedNamedCore core, final String repository, final String signer, final String logger, final String receiver, final PublicKey pub, final int decimal, final double minimumTransaction) {
super(core, repository, signer, logger, receiver, pub);
this.decimal = decimal;
***************
*** 142,162 ****
* @return
*/
! public final SignedNamedObject read(final SignedNamedCore core, final Element elem) throws NeuClearException, XMLSecurityException {
! if (!elem.getNamespace().equals(AssetGlobals.createNameSpace()))
! throw new UnsupportedOperationException("");
! final String repository = elem.attributeValue(DocumentHelper.createQName("repository", NSTools.NS_NEUID));
! final String signer = elem.attributeValue(DocumentHelper.createQName("signer", NSTools.NS_NEUID));
! final String logger = elem.attributeValue(DocumentHelper.createQName("logger", NSTools.NS_NEUID));
! final String receiver = elem.attributeValue(DocumentHelper.createQName("receiver", NSTools.NS_NEUID));
!
! final Element allowElement = elem.element(DocumentHelper.createQName("allow", NSTools.NS_NEUID));
! final KeyInfo ki = new KeyInfo(allowElement.element(XMLSecTools.createQName("KeyInfo")));
! final PublicKey pub = ki.getPublicKey();
! final String dec = elem.attributeValue("decimalpoints");
! final int decimal = (!Utility.isEmpty(dec)) ? Integer.parseInt(dec) : 0;
! final String min = elem.attributeValue("minimumxact");
! final double minimum = (!Utility.isEmpty(min)) ? Double.parseDouble(min) : 0;
! return new Asset(core, repository, signer, logger, receiver, pub, decimal, minimum);
}
--- 150,173 ----
* @return
*/
! public final SignedNamedObject read(final SignedNamedCore core, final Element elem) throws InvalidNamedObjectException {
! if (!elem.getNamespace().equals(AssetGlobals.NS_ASSET))
! throw new InvalidNamedObjectException(core.getName(),"Not in XML NameSpace: "+AssetGlobals.NS_ASSET.getURI());
! final String repository = elem.attributeValue(createNEUIDQName("repository"));
! final String signer = elem.attributeValue(createNEUIDQName("signer"));
! final String logger = elem.attributeValue(createNEUIDQName("logger"));
! final String receiver = elem.attributeValue(createNEUIDQName("receiver"));
! final Element allowElement = InvalidNamedObjectException.assertContainsElementQName(core,elem,createNEUIDQName("allow"));
! try {
! final KeyInfo ki = new KeyInfo(InvalidNamedObjectException.assertContainsElementQName(allowElement, XMLSecTools.createQName("KeyInfo")));
! final PublicKey pub = ki.getPublicKey();
! final String dec = elem.attributeValue("decimalpoints");
! final int decimal = (!Utility.isEmpty(dec)) ? Integer.parseInt(dec) : 0;
! final String min = elem.attributeValue("minimumxact");
! final double minimum = (!Utility.isEmpty(min)) ? Double.parseDouble(min) : 0;
! return new Asset(core, repository, signer, logger, receiver, pub, decimal, minimum);
! } catch (XMLSecurityException e) {
! throw new InvalidNamedObjectException(core.getName(),e);
! }
}
Index: AssetGlobals.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/contracts/AssetGlobals.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** AssetGlobals.java 22 Nov 2003 00:22:28 -0000 1.6
--- AssetGlobals.java 19 Dec 2003 18:02:35 -0000 1.7
***************
*** 24,27 ****
--- 24,35 ----
$Id$
$Log$
+ Revision 1.7 2003/12/19 18:02:35 pelle
+ Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ runtime exception.
+ - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ exceptions that can happen in that area.
+
Revision 1.6 2003/11/22 00:22:28 pelle
All unit tests in commons, id and xmlsec now work.
***************
*** 94,103 ****
}
! public static Namespace createNameSpace() {
return DocumentHelper.createNamespace(ASSET_NSPREFIX, XFER_ASSETS);
}
public static QName createQName(final String name) {
! return DocumentHelper.createQName(name, createNameSpace());
}
--- 102,111 ----
}
! private static Namespace createNameSpace() {
return DocumentHelper.createNamespace(ASSET_NSPREFIX, XFER_ASSETS);
}
public static QName createQName(final String name) {
! return DocumentHelper.createQName(name, NS_ASSET);
}
***************
*** 113,117 ****
public static final String XFER_ASSETS = "http://neuclear.org/neu/assets";
public static final String ASSET_NSPREFIX = "asset";
!
public static void registerReaders() {
VerifyingReader.getInstance().registerReader(AssetGlobals.ASSET_TAGNAME, new Asset.Reader());
--- 121,125 ----
public static final String XFER_ASSETS = "http://neuclear.org/neu/assets";
public static final String ASSET_NSPREFIX = "asset";
! public static final Namespace NS_ASSET=createNameSpace();
public static void registerReaders() {
VerifyingReader.getInstance().registerReader(AssetGlobals.ASSET_TAGNAME, new Asset.Reader());
Index: AssetTransactionContract.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/contracts/AssetTransactionContract.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** AssetTransactionContract.java 10 Dec 2003 23:52:39 -0000 1.9
--- AssetTransactionContract.java 19 Dec 2003 18:02:35 -0000 1.10
***************
*** 5,16 ****
import org.neuclear.commons.Utility;
import org.neuclear.commons.time.TimeTools;
! import org.neuclear.id.Identity;
! import org.neuclear.id.NamedObjectReader;
! import org.neuclear.id.SignedNamedCore;
! import org.neuclear.id.SignedNamedObject;
import org.neuclear.id.resolver.NSResolver;
import org.neuclear.receiver.UnsupportedTransaction;
import java.util.Date;
/**
--- 5,14 ----
import org.neuclear.commons.Utility;
import org.neuclear.commons.time.TimeTools;
! import org.neuclear.id.*;
import org.neuclear.id.resolver.NSResolver;
import org.neuclear.receiver.UnsupportedTransaction;
import java.util.Date;
+ import java.text.ParseException;
/**
***************
*** 21,24 ****
--- 19,30 ----
* $Id$
* $Log$
+ * Revision 1.10 2003/12/19 18:02:35 pelle
+ * Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
+ * - For most cases the main exception to worry about now is InvalidNamedObjectException.
+ * - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
+ * runtime exception.
+ * - Source and Store patterns each now have their own exceptions that generalizes the various physical
+ * exceptions that can happen in that area.
+ *
* Revision 1.9 2003/12/10 23:52:39 pelle
* Did some cleaning up in the builders
***************
*** 73,77 ****
private final Asset asset;
! AssetTransactionContract(final SignedNamedCore core, final Asset asset) throws NeuClearException {
super(core);
this.asset = asset;
--- 79,83 ----
private final Asset asset;
! AssetTransactionContract(final SignedNamedCore core, final Asset asset) {
super(core);
this.asset = asset;
***************
*** 90,132 ****
* @return
*/
! public final SignedNamedObject read(final SignedNamedCore core, final Element elem) throws NeuClearException {
! if (!elem.getNamespaceURI().equals(TransferGlobals.XFER_NSURI))
! throw new UnsupportedTransaction(core);
!
! final Asset asset = (Asset) NSResolver.resolveIdentity(elem.attributeValue("assetName"));
! final String holdid = elem.attributeValue("holdid");
! if (elem.getName().equals(TransferGlobals.CANCEL_TAGNAME))
! return new CancelHeldTransferRequest(core, asset, holdid);
! if (elem.getName().equals(TransferGlobals.CANCEL_RCPT_TAGNAME))
! return new CancelHeldTransferReceipt(core, asset, holdid);
! final double amount = Double.parseDouble(elem.attributeValue("amount"));
! final Date valuetime = TimeTools.parseTimeStamp(elem.attributeValue("valuetime"));
! final Identity to = NSResolver.resolveIdentity(elem.attributeValue("recipient"));
! final Element commentElement = elem.element(TransferGlobals.createQName("comment"));
! final String comment = (commentElement != null) ? commentElement.getText() : "";
! if (elem.getName().equals(TransferGlobals.XFER_TAGNAME))
! return new TransferRequest(core, asset, to, amount, valuetime, comment);
! Date helduntil = null;
! if (!Utility.isEmpty(elem.attributeValue("valuetime")))
! helduntil = TimeTools.parseTimeStamp(elem.attributeValue("valuetime"));
! if (elem.getName().equals(TransferGlobals.HELD_XFER_TAGNAME))
! return new HeldTransferRequest(core, asset, to, amount, valuetime, comment, helduntil);
! final Identity from = NSResolver.resolveIdentity(elem.attributeValue("sender"));
! final String reqid = elem.attributeValue("reqid");
! if (elem.getName().equals(TransferGlobals.XFER_RCPT_TAGNAME))
! return new TransferReceipt(core, asset, from, to, reqid, amount, valuetime, comment);
! if (elem.getName().equals(TransferGlobals.HELD_XFER_RCPT_TAGNAME))
! return new HeldTransferReceipt(core, asset, from, to, reqid, amount, valuetime, comment, helduntil);
! if (elem.getName().equals(TransferGlobals.COMPLETE_TAGNAME))
! return new CompleteHeldTransferRequest(core, asset, from, to, amount, valuetime, comment, holdid);
! throw new UnsupportedTransaction(core);
}
--- 96,144 ----
* @return
*/
! public final SignedNamedObject read(final SignedNamedCore core, final Element elem) throws InvalidNamedObjectException {
! if (!elem.getNamespace().equals(AssetGlobals.NS_ASSET))
! throw new InvalidNamedObjectException(core.getName(),"Not in XML NameSpace: "+AssetGlobals.NS_ASSET.getURI());
! try {
! //TODO Validate properly
! final Asset asset = (Asset) NSResolver.resolveIdentity(elem.attributeValue("assetName"));
! final String holdid = elem.attributeValue("holdid");
! if (elem.getName().equals(TransferGlobals.CANCEL_TAGNAME))
! return new CancelHeldTransferRequest(core, asset, holdid);
! if (elem.getName().equals(TransferGlobals.CANCEL_RCPT_TAGNAME))
! return new CancelHeldTransferReceipt(core, asset, holdid);
! final double amount = Double.parseDouble(elem.attributeValue("amount"));
! final Date valuetime = TimeTools.parseTimeStamp(elem.attributeValue("valuetime"));
! final Identity to = NSResolver.resolveIdentity(elem.attributeValue("recipient"));
! final Element commentElement = elem.element(TransferGlobals.createQName("comment"));
! final String comment = (commentElement != null) ? commentElement.getText() : "";
! if (elem.getName().equals(TransferGlobals.XFER_TAGNAME))
! return new TransferRequest(core, asset, to, amount, valuetime, comment);
! Date helduntil = null;
! if (!Utility.isEmpty(elem.attributeValue("valuetime")))
! helduntil = TimeTools.parseTimeStamp(elem.attributeValue("valuetime"));
! if (elem.getName().equals(TransferGlobals.HELD_XFER_TAGNAME))
! return new HeldTransferRequest(core, asset, to, amount, valuetime, comment, helduntil);
! final Identity from = NSResolver.resolveIdentity(elem.attributeValue("sender"));
! final String reqid = elem.attributeValue("reqid");
! if (elem.getName().equals(TransferGlobals.XFER_RCPT_TAGNAME))
! return new TransferReceipt(core, asset, from, to, reqid, amount, valuetime, comment);
! if (elem.getName().equals(TransferGlobals.HELD_XFER_RCPT_TAGNAME))
! return new HeldTransferReceipt(core, asset, from, to, reqid, amount, valuetime, comment, helduntil);
! if (elem.getName().equals(TransferGlobals.COMPLETE_TAGNAME))
! return new CompleteHeldTransferRequest(core, asset, from, to, amount, valuetime, comment, holdid);
! } catch (ParseException e) {
! throw new InvalidNamedObjectException(core.getName(),e);
! } catch (NameResolutionException e) {
! throw new InvalidNamedObjectException(core.getName(),e);
! }
! throw new InvalidNamedObjectException(core.getName(),"Not Matched");
}
Index: CancelHeldTransferReceipt.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/contracts/CancelHeldTransferReceipt.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** CancelHeldTransferReceipt.java 21 Nov 2003 04:43:04 -0000 1.3
--- CancelHeldTransferReceipt.java 19 Dec 2003 18:02:35 -0000 1.4
***************
*** 16,20 ****
public final class CancelHeldTransferReceipt extends AssetTransactionContract{
! CancelHeldTransferReceipt(final SignedNamedCore core, final Asset asset, final String holdid) throws NeuClearException {
super(core, asset);
this.holdid = holdid;
--- 16,20 ----
public final class CancelHeldTransferReceipt extends AssetTransactionContract{
! CancelHeldTransferReceipt(final SignedNamedCore core, final Asset asset, final String holdid) {
super(core, asset);
this.holdid = holdid;
Index: CancelHeldTransferRequest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/contracts/CancelHeldTransferRequest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** CancelHeldTransferRequest.java 21 Nov 2003 04:43:04 -0000 1.3
--- CancelHeldTransferRequest.java 19 Dec 2003 18:02:35 -0000 1.4
***************
*** 16,20 ****
public final class CancelHeldTransferRequest extends AssetTransactionContract{
! CancelHeldTransferRequest(final SignedNamedCore core, final Asset asset, final String holdid) throws NeuClearException {
super(core, asset);
this.holdid = holdid;
--- 16,20 ----
public final class CancelHeldTransferRequest extends AssetTransactionContract{
! CancelHeldTransferRequest(final SignedNamedCore core, final Asset asset, final String holdid) {
super(core, asset);
this.holdid = holdid;
Index: CompleteHeldTransferRequest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/contracts/CompleteHeldTransferRequest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** CompleteHeldTransferRequest.java 21 Nov 2003 04:43:04 -0000 1.3
--- CompleteHeldTransferRequest.java 19 Dec 2003 18:02:35 -0000 1.4
***************
*** 14,18 ****
*/
public final class CompleteHeldTransferRequest extends TransferContract {
! CompleteHeldTransferRequest(final SignedNamedCore core, final Asset asset, final Identity from, final Identity to, final double amount, final Date valuetime, final String comment, final String holdid) throws NeuClearException {
super(core, asset, to, amount, valuetime, comment);
this.from = from;
--- 14,18 ----
*/
public final class CompleteHeldTransferRequest extends TransferContract {
! CompleteHeldTransferRequest(final SignedNamedCore core, final Asset asset, final Identity from, final Identity to, final double amount, final Date valuetime, final String comment, final String holdid) {
super(core, asset, to, amount, valuetime, comment);
this.from = from;
Index: HeldTransferReceipt.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/contracts/HeldTransferReceipt.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** HeldTransferReceipt.java 21 Nov 2003 13:57:19 -0000 1.5
--- HeldTransferReceipt.java 19 Dec 2003 18:02:35 -0000 1.6
***************
*** 15,19 ****
public final class HeldTransferReceipt extends TransferReceipt implements Held {
! HeldTransferReceipt(final SignedNamedCore core, final Asset asset, final Identity from, final Identity to, final String reqid, final double amount, final Date valuetime, final String comment, final Date helduntil) throws NeuClearException {
super(core, asset, from, to, reqid, amount, valuetime, comment);
this.helduntil = helduntil.getTime();
--- 15,19 ----
public final class HeldTransferReceipt extends TransferReceipt implements Held {
! HeldTransferReceipt(final SignedNamedCore core, final Asset asset, final Identity from, final Identity to, final String reqid, final double amount, final Date valuetime, final String comment, final Date helduntil) {
super(core, asset, from, to, reqid, amount, valuetime, comment);
this.helduntil = helduntil.getTime();
Index: HeldTransferRequest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/contracts/HeldTransferRequest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** HeldTransferRequest.java 21 Nov 2003 13:57:19 -0000 1.4
--- HeldTransferRequest.java 19 Dec 2003 18:02:35 -0000 1.5
***************
*** 14,18 ****
*/
public final class HeldTransferRequest extends TransferRequest implements Held {
! HeldTransferRequest(final SignedNamedCore core, final Asset asset, final Identity to, final double amount, final Date valuetime, final String comment, final Date helduntil) throws NeuClearException {
super(core, asset, to, amount, valuetime, comment);
this.helduntil = helduntil.getTime();
--- 14,18 ----
*/
public final class HeldTransferRequest extends TransferRequest implements Held {
! HeldTransferRequest(final SignedNamedCore core, final Asset asset, final Identity to, final double amount, final Date valuetime, final String comment, final Date helduntil) {
super(core, asset, to, amount, valuetime, comment);
this.helduntil = helduntil.getTime();
Index: TransferContract.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/contracts/TransferContract.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** TransferContract.java 21 Nov 2003 13:57:19 -0000 1.6
--- TransferContract.java 19 Dec 2003 18:02:35 -0000 1.7
***************
*** 45,49 ****
*/
public abstract class TransferContract extends AssetTransactionContract {
! TransferContract(final SignedNamedCore core, final Asset asset, final Identity to, final double amount, final Date valuetime, final String comment) throws NeuClearException {
super(core, asset);
this.amount = amount;
--- 45,49 ----
*/
public abstract class TransferContract extends AssetTransactionContract {
! TransferContract(final SignedNamedCore core, final Asset asset, final Identity to, final double amount, final Date valuetime, final String comment) {
super(core, asset);
this.amount = amount;
Index: TransferReceipt.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/contracts/TransferReceipt.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TransferReceipt.java 21 Nov 2003 04:43:04 -0000 1.4
--- TransferReceipt.java 19 Dec 2003 18:02:35 -0000 1.5
***************
*** 17,21 ****
private final String reqid;
! TransferReceipt(final SignedNamedCore core, final Asset asset, final Identity from, final Identity to, final String reqid, final double amount, final Date valuetime, final String comment) throws NeuClearException {
super(core, asset, to, amount, valuetime, comment);
this.from = from;
--- 17,21 ----
private final String reqid;
! TransferReceipt(final SignedNamedCore core, final Asset asset, final Identity from, final Identity to, final String reqid, final double amount, final Date valuetime, final String comment) {
super(core, asset, to, amount, valuetime, comment);
this.from = from;
Index: TransferRequest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/contracts/TransferRequest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TransferRequest.java 21 Nov 2003 04:43:04 -0000 1.4
--- TransferRequest.java 19 Dec 2003 18:02:35 -0000 1.5
***************
*** 15,19 ****
public class TransferRequest extends TransferContract {
! TransferRequest(final SignedNamedCore core, final Asset asset, final Identity to, final double amount, final Date valuetime, final String comment) throws NeuClearException {
super(core, asset, to, amount, valuetime, comment);
}
--- 15,19 ----
public class TransferRequest extends TransferContract {
! TransferRequest(final SignedNamedCore core, final Asset asset, final Identity to, final double amount, final Date valuetime, final String comment) {
super(core, asset, to, amount, valuetime, comment);
}
|
|
From: <pe...@us...> - 2003-12-19 18:02:40
|
Update of /cvsroot/neuclear/neuclear-pay/src/test/org/neuclear/asset/receiver In directory sc8-pr-cvs1:/tmp/cvs-serv5097/src/test/org/neuclear/asset/receiver Removed Files: CreateTestPayments.java Log Message: Revamped a lot of exception handling throughout the framework, it has been simplified in most places: - For most cases the main exception to worry about now is InvalidNamedObjectException. - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a runtime exception. - Source and Store patterns each now have their own exceptions that generalizes the various physical exceptions that can happen in that area. --- CreateTestPayments.java DELETED --- |
|
From: <pe...@us...> - 2003-12-19 18:02:30
|
Update of /cvsroot/neuclear/neuclear-id-sample/src/java/org/neuclear/id/sample
In directory sc8-pr-cvs1:/tmp/cvs-serv5078/src/java/org/neuclear/id/sample
Modified Files:
SendMessageServlet.java
Log Message:
Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
- For most cases the main exception to worry about now is InvalidNamedObjectException.
- Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
runtime exception.
- Source and Store patterns each now have their own exceptions that generalizes the various physical
exceptions that can happen in that area.
Index: SendMessageServlet.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id-sample/src/java/org/neuclear/id/sample/SendMessageServlet.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** SendMessageServlet.java 17 Dec 2003 23:52:01 -0000 1.3
--- SendMessageServlet.java 19 Dec 2003 18:02:28 -0000 1.4
***************
*** 52,58 ****
out.print("<b>error:</b>");
e.printStackTrace(out);
- } catch (XMLException e) {
- out.print("<b>error:</b>");
- e.printStackTrace(out);
}
--- 52,55 ----
|
|
From: <pe...@us...> - 2003-12-19 00:31:34
|
Update of /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id/jce
In directory sc8-pr-cvs1:/tmp/cvs-serv19108/src/test/org/neuclear/id/jce
Modified Files:
NeuClearJCETest.java
Log Message:
Lots of usability changes through out all the passphrase agents and end user tools.
Index: NeuClearJCETest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id/jce/NeuClearJCETest.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** NeuClearJCETest.java 18 Dec 2003 17:40:19 -0000 1.9
--- NeuClearJCETest.java 19 Dec 2003 00:31:31 -0000 1.10
***************
*** 42,45 ****
--- 42,48 ----
$Id$
$Log$
+ Revision 1.10 2003/12/19 00:31:31 pelle
+ Lots of usability changes through out all the passphrase agents and end user tools.
+
Revision 1.9 2003/12/18 17:40:19 pelle
You can now create keys that get stored with a X509 certificate in the keystore. These can be saved as well.
***************
*** 199,202 ****
--- 202,206 ----
assertNotNull(signer.getPublicKey(IVAN));
assertEquals(pub,signer.getPublicKey(IVAN));
+ id.sign(signer);
try {
final Identity ivan = (Identity) id.convert();
|
|
From: <pe...@us...> - 2003-12-19 00:31:34
|
Update of /cvsroot/neuclear/neuclear-id In directory sc8-pr-cvs1:/tmp/cvs-serv19108 Modified Files: project.properties Log Message: Lots of usability changes through out all the passphrase agents and end user tools. Index: project.properties =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/project.properties,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 |
|
From: <pe...@us...> - 2003-12-19 00:31:34
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id
In directory sc8-pr-cvs1:/tmp/cvs-serv19108/src/java/org/neuclear/id
Modified Files:
InvalidNamedObjectException.java NSTools.java
Added Files:
NameResolutionException.java
Log Message:
Lots of usability changes through out all the passphrase agents and end user tools.
--- NEW FILE: NameResolutionException.java ---
package org.neuclear.id;
import org.neuclear.commons.NeuClearException;
/**
* Created by IntelliJ IDEA.
* User: pelleb
* Date: Dec 18, 2003
* Time: 2:03:37 PM
* To change this template use Options | File Templates.
*/
public class NameResolutionException extends NeuClearException{
private final String name;
public NameResolutionException(final String name) {
super(name+" couldnt be resolved");
this.name=name;
}
public String getName() {
return name;
}
}
Index: InvalidNamedObjectException.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/InvalidNamedObjectException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** InvalidNamedObjectException.java 11 Dec 2003 23:57:29 -0000 1.1
--- InvalidNamedObjectException.java 19 Dec 2003 00:31:30 -0000 1.2
***************
*** 2,5 ****
--- 2,8 ----
* $Id$
* $Log$
+ * Revision 1.2 2003/12/19 00:31:30 pelle
+ * Lots of usability changes through out all the passphrase agents and end user tools.
+ *
* Revision 1.1 2003/12/11 23:57:29 pelle
* Trying to test the ReceiverServlet with cactus. Still no luck. Need to return a ElementProxy of some sort.
***************
*** 106,112 ****
public final class InvalidNamedObjectException extends NeuClearException {
! public InvalidNamedObjectException(final String msg) {
! super(msg);
}
}
--- 109,120 ----
public final class InvalidNamedObjectException extends NeuClearException {
! public InvalidNamedObjectException(final String name) {
! super(name+" is an invalid Identity");
! this.name=name;
}
+ public String getName() {
+ return name;
+ }
+ private final String name;
}
Index: NSTools.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/NSTools.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** NSTools.java 16 Dec 2003 23:44:10 -0000 1.22
--- NSTools.java 19 Dec 2003 00:31:30 -0000 1.23
***************
*** 2,5 ****
--- 2,8 ----
* $Id$
* $Log$
+ * Revision 1.23 2003/12/19 00:31:30 pelle
+ * Lots of usability changes through out all the passphrase agents and end user tools.
+ *
* Revision 1.22 2003/12/16 23:44:10 pelle
* End of work day clean up
***************
*** 188,191 ****
--- 191,195 ----
import org.neuclear.commons.crypto.CryptoTools;
import org.neuclear.id.builders.NamedObjectBuilder;
+ import org.neuclear.id.resolver.NSResolver;
import java.util.regex.Matcher;
***************
*** 261,269 ****
* @param uri a valid NEU Name
* @return Parent URI or null if name is the root
! * @throws NeuClearException if name is invalid
*/
! public static String getSignatoryURI(final String uri) throws NeuClearException {
if (!isValidName(uri))
! throw new InvalidNamedObjectException("Invalid Neu ID: " + uri);
final int bang = uri.indexOf('!');
--- 265,273 ----
* @param uri a valid NEU Name
* @return Parent URI or null if name is the root
! * @throws InvalidNamedObjectException if name is invalid
*/
! public static String getSignatoryURI(final String uri) throws InvalidNamedObjectException {
if (!isValidName(uri))
! throw new InvalidNamedObjectException(uri);
final int bang = uri.indexOf('!');
***************
*** 414,417 ****
--- 418,434 ----
return !Utility.isEmpty(elem.attributeValue(DocumentHelper.createQName("name", NS_NEUID)));
}
+
+ public static String getRepositoryURL(String alias) throws InvalidNamedObjectException {
+ String url=isHttpScheme(alias);
+ if (url==null){
+ try {
+ return NSResolver.resolveIdentity(alias).getRepository();
+ } catch (Exception e) {
+ return getRepositoryURL(getSignatoryURI(alias));
+ }
+ }
+ return url;
+ }
+
private static final String HTTP_SCHEME_EX = "^neu:(neuid:)?\\/\\/(([\\w-]+\\.)+[\\w-]+)$";
private static final Pattern HTTP_SCHEME = Pattern.compile(HTTP_SCHEME_EX);
|
|
From: <pe...@us...> - 2003-12-19 00:31:34
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/tools/commandline
In directory sc8-pr-cvs1:/tmp/cvs-serv19108/src/java/org/neuclear/id/tools/commandline
Modified Files:
BuildAllTopLevel.java CommandLineSigner.java
IdentityCreator.java
Log Message:
Lots of usability changes through out all the passphrase agents and end user tools.
Index: BuildAllTopLevel.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/tools/commandline/BuildAllTopLevel.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** BuildAllTopLevel.java 12 Dec 2003 21:13:16 -0000 1.2
--- BuildAllTopLevel.java 19 Dec 2003 00:31:30 -0000 1.3
***************
*** 33,36 ****
--- 33,39 ----
$Id$
$Log$
+ Revision 1.3 2003/12/19 00:31:30 pelle
+ Lots of usability changes through out all the passphrase agents and end user tools.
+
Revision 1.2 2003/12/12 21:13:16 pelle
I have now done manual testing of the SigningServlet et al and am happy releasing it to 0.8
***************
*** 93,103 ****
store.receive(createIdentities("neu://alice@test", testsig, testsig));
! } catch (NeuClearException e) {
! e.printStackTrace();
! } catch (GeneralSecurityException e) {
! e.printStackTrace();
! } catch (FileNotFoundException e) {
! e.printStackTrace();
! } catch (XMLException e) {
e.printStackTrace();
}
--- 96,100 ----
store.receive(createIdentities("neu://alice@test", testsig, testsig));
! } catch (Exception e) {
e.printStackTrace();
}
Index: CommandLineSigner.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/tools/commandline/CommandLineSigner.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** CommandLineSigner.java 18 Dec 2003 17:40:19 -0000 1.4
--- CommandLineSigner.java 19 Dec 2003 00:31:30 -0000 1.5
***************
*** 1,4 ****
--- 1,7 ----
/* $Id$
* $Log$
+ * Revision 1.5 2003/12/19 00:31:30 pelle
+ * Lots of usability changes through out all the passphrase agents and end user tools.
+ *
* Revision 1.4 2003/12/18 17:40:19 pelle
* You can now create keys that get stored with a X509 certificate in the keystore. These can be saved as well.
***************
*** 197,206 ****
import org.neuclear.commons.Utility;
import org.neuclear.commons.crypto.CryptoTools;
! import org.neuclear.commons.crypto.passphraseagents.CommandLineAgent;
import org.neuclear.commons.crypto.signers.DefaultSigner;
import org.neuclear.commons.crypto.signers.Signer;
import org.neuclear.commons.time.TimeTools;
import org.neuclear.id.Identity;
import org.neuclear.id.NSTools;
import org.neuclear.id.builders.NamedObjectBuilder;
import org.neuclear.id.resolver.NSResolver;
--- 200,215 ----
import org.neuclear.commons.Utility;
import org.neuclear.commons.crypto.CryptoTools;
! import org.neuclear.commons.crypto.passphraseagents.ConsoleAgent;
! import org.neuclear.commons.crypto.passphraseagents.UserCancellationException;
! import org.neuclear.commons.crypto.passphraseagents.InteractiveAgent;
! import org.neuclear.commons.crypto.passphraseagents.GuiDialogAgent;
import org.neuclear.commons.crypto.signers.DefaultSigner;
import org.neuclear.commons.crypto.signers.Signer;
+ import org.neuclear.commons.crypto.signers.InvalidPassphraseException;
import org.neuclear.commons.time.TimeTools;
import org.neuclear.id.Identity;
import org.neuclear.id.NSTools;
+ import org.neuclear.id.InvalidNamedObjectException;
+ import org.neuclear.id.NameResolutionException;
import org.neuclear.id.builders.NamedObjectBuilder;
import org.neuclear.id.resolver.NSResolver;
***************
*** 210,213 ****
--- 219,226 ----
import java.io.*;
import java.security.GeneralSecurityException;
+ import java.net.URLClassLoader;
+ import java.net.URL;
+ import java.util.regex.Pattern;
+ import java.util.regex.Matcher;
/**
***************
*** 216,226 ****
*/
public class CommandLineSigner {
! public CommandLineSigner(final String[] args) throws ParseException, FileNotFoundException, GeneralSecurityException, NeuClearException {
! CryptoTools.ensureProvider();
options = createOptions();
! final CommandLineParser clparser = CommandLineParserFactory.newParser();
!
! cmd = clparser.parse(options, args);
checkArguments();
if (cmd.hasOption('v')) {
--- 229,239 ----
*/
public class CommandLineSigner {
! private final String EXECUTABLE ;
+ public CommandLineSigner(final String[] args) throws ParseException, UserCancellationException {
+ CryptoTools.ensureProvider();
+ EXECUTABLE=Utility.getExecutable(getClass());
options = createOptions();
! cmd=parseOptions(args);
checkArguments();
if (cmd.hasOption('v')) {
***************
*** 245,249 ****
}
// agent=(PassPhraseAgent)Configuration.getComponent(PassPhraseAgent.class,"neuclear-id");
! sig = new DefaultSigner(new CommandLineAgent());
alias = cmd.getOptionValue("a");
of = cmd.getOptionValue("o");
--- 258,263 ----
}
// 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");
of = cmd.getOptionValue("o");
***************
*** 253,260 ****
--- 267,297 ----
}
+ private final CommandLine parseOptions(final String[] args) throws ParseException {
+ final CommandLineParser clparser = CommandLineParserFactory.newParser();
+ try {
+ return clparser.parse(options, args);
+ } catch (UnrecognizedOptionException e) {
+ System.out.println(e.getLocalizedMessage());
+ printHelp();
+ System.exit(1);
+ }
+ return null;
+ }
+
+ private DefaultSigner createSigner(final InteractiveAgent agent) throws UserCancellationException {
+ try {
+ return new DefaultSigner(agent);
+ } catch (InvalidPassphraseException e) {
+ return createSigner(agent);
+ }
+ }
+
public static void main(final String[] args) {
try {
+ System.out.println();
final CommandLineSigner signer = new CommandLineSigner(args);
signer.execute();
+ } catch (UserCancellationException e){
+ System.out.println("Bye");
} catch (Exception e) {
e.printStackTrace();
***************
*** 263,275 ****
public final void checkArguments() {
! if (!hasArguments()) {
! final HelpFormatter help = new HelpFormatter();
! help.printHelp("java " +
! this.getClass().getName() +
! getExtraHelp() + " [--outputfile signed/test.id] ", options);
System.exit(1);
}
}
protected String getExtraHelp() {
return " --inputfile unsigned/test.id";
--- 300,318 ----
public final void checkArguments() {
! if (!hasArguments()||cmd.hasOption('h')) {
! printHelp();
System.exit(1);
}
}
+ private void printHelp() {
+ final HelpFormatter help = new HelpFormatter();
+
+ help.printHelp("\n"+EXECUTABLE +getExtraHelp()+
+ " [--outputfile signed/test.id] \n" +
+ EXECUTABLE+" --verify neu://neuclear.org\n" +
+ EXECUTABLE+" --inputfile jo...@yo... \n" , options);
+ }
+
protected String getExtraHelp() {
return " --inputfile unsigned/test.id";
***************
*** 288,294 ****
if (!Utility.isEmpty(of))
of = subject.getLocalName() + ".xml";
! System.err.println("Key with alias: " + alias + " doesnt exist in our keystore. \nSaving unsigned Identity as: " + of);
} else if(!subject.isSigned()) {
! System.err.println("Signing by " + alias + " ...");
subject.sign(alias, sig);
}
--- 331,337 ----
if (!Utility.isEmpty(of))
of = subject.getLocalName() + ".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);
}
***************
*** 300,307 ****
outFile.getParentFile().mkdirs();
dest = new FileOutputStream(of);
! System.err.println("Outputting to: " + of);
}
XMLTools.writeFile(dest, subject.getElement());
System.out.println();
} catch (Exception e) {
System.err.println(e.getMessage());
--- 343,370 ----
outFile.getParentFile().mkdirs();
dest = new FileOutputStream(of);
! System.out.println("Outputting to: " + of);
}
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 the following location:\n" +
+ NSTools.getRepositoryURL(alias)+NSTools.name2path(subject.getName())+"root.id");
+
+ 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)) {
+ System.out.println("Do you wish to send the contract to the signer of "+alias+"?");
+ if (Utility.getAffirmative(true)){
+ try {
+ Identity id=NSResolver.resolveIdentity(alias);
+ id.receive(subject);
+ } catch (NameResolutionException e) {
+ System.err.println(e.getLocalizedMessage());
+ } catch (InvalidNamedObjectException e) {
+ System.err.println(e.getLocalizedMessage());
+ }
+ }
+ }
+ */
} catch (Exception e) {
System.err.println(e.getMessage());
***************
*** 361,374 ****
final Options options = new Options();
! // add t option
! // options.addOption("s", "keystore", true, "specify KeyStore");
! // options.addOption("t", "keystoretype", true, "specify KeyStore Type");
! // options.addOption("j", "keystorepassword", true, "specify KeyStore Password");
! // options.addOption("a", "alias", true, "specify Key Alias in KeyStore");
! // options.addOption("p", "password", true, "specify Alias Password");
! options.addOption("o", "outputfile", true, "specify Output File");
! options.addOption("i", "inputfile", true, "specify Input File");
! options.addOption("v", "verify", true, "Specify NEU ID to verify");
!
getLocalOptions(options);
--- 424,432 ----
final Options options = new Options();
! options.addOption("o", "outputfile", true, "specify output file \n[ --outputfile bob.id ]");
! options.addOption("i", "inputfile", true, "specify Input File \n[ --inputfile bob.xml ]");
! options.addOption("v", "verify", true, "Specify NEU ID to verify \n[ --verify neu://bob@yourdomain.com ]");
! options.addOption("h","help",false,"Help");
! options.addOption("g","gui",false,"Use GUI Passphrase Dialog");
getLocalOptions(options);
***************
*** 382,388 ****
protected final CommandLine cmd;
protected final Options options;
- public final static String keystore = System.getProperty("user.home") + "/.keystore";
protected final Signer sig;
- // protected final PassPhraseAgent agent;
protected String alias;
protected String of;
--- 440,444 ----
Index: IdentityCreator.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/tools/commandline/IdentityCreator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** IdentityCreator.java 18 Dec 2003 17:40:19 -0000 1.4
--- IdentityCreator.java 19 Dec 2003 00:31:30 -0000 1.5
***************
*** 1,4 ****
--- 1,7 ----
/* $Id$
* $Log$
+ * Revision 1.5 2003/12/19 00:31:30 pelle
+ * Lots of usability changes through out all the passphrase agents and end user tools.
+ *
* Revision 1.4 2003/12/18 17:40:19 pelle
* You can now create keys that get stored with a X509 certificate in the keystore. These can be saved as well.
***************
*** 198,206 ****
--- 201,212 ----
import org.apache.commons.cli.Options;
+ import org.apache.commons.cli.ParseException;
import org.neuclear.commons.NeuClearException;
import org.neuclear.commons.Utility;
import org.neuclear.commons.crypto.CryptoException;
+ import org.neuclear.commons.crypto.passphraseagents.UserCancellationException;
import org.neuclear.commons.crypto.signers.PublicKeySource;
import org.neuclear.id.NSTools;
+ import org.neuclear.id.InvalidNamedObjectException;
import org.neuclear.id.builders.IdentityBuilder;
import org.neuclear.id.builders.NamedObjectBuilder;
***************
*** 214,221 ****
*/
public final class IdentityCreator extends CommandLineSigner {
! public IdentityCreator(final String[] args) throws Exception {
super(args);
! if (!(sig instanceof PublicKeySource))
! throw new NeuClearException("The default signer has to include public keys");
pksource = (PublicKeySource) sig;
identity = cmd.getOptionValue("n");
--- 220,229 ----
*/
public final class IdentityCreator extends CommandLineSigner {
! public IdentityCreator(final String[] args) throws UserCancellationException, ParseException, InvalidNamedObjectException {
super(args);
! if (!(sig instanceof PublicKeySource)) {
! System.err.println("The default signer has to include public keys");
! System.exit(1);
! }
pksource = (PublicKeySource) sig;
identity = cmd.getOptionValue("n");
***************
*** 243,252 ****
}
alias = (isTopLevel) ? identity : NSTools.getSignatoryURI(identity);
! final String allow = Utility.denullString(cmd.getOptionValue("w"), identity);
! final String defaultstore = Utility.denullString(cmd.getOptionValue("r"), store);
final String defaultsigner = Utility.denullString(cmd.getOptionValue("s"), "http://localhost:11870/Signer");
final String defaultlogger = Utility.denullString(cmd.getOptionValue("l"), LogSender.LOGGER);
final String defaultreceiver = cmd.getOptionValue("b");
! if (!sig.canSignFor(allow)){
System.out.println("You do not currently have a key matching this name. Do you with to create one?");
if (!Utility.getAffirmative(true)) {
--- 251,259 ----
}
alias = (isTopLevel) ? identity : NSTools.getSignatoryURI(identity);
! final String defaultstore = Utility.denullString(cmd.getOptionValue("r"), store);
final String defaultsigner = Utility.denullString(cmd.getOptionValue("s"), "http://localhost:11870/Signer");
final String defaultlogger = Utility.denullString(cmd.getOptionValue("l"), LogSender.LOGGER);
final String defaultreceiver = cmd.getOptionValue("b");
! if (!sig.canSignFor(identity)){
System.out.println("You do not currently have a key matching this name. Do you with to create one?");
if (!Utility.getAffirmative(true)) {
***************
*** 254,259 ****
System.exit(0);
}
! System.out.print("Generating Keys for "+allow+"... ");
! PublicKey pub=sig.generateKey(allow);
System.out.println("DONE");
System.out.println("STORING Keys");
--- 261,266 ----
System.exit(0);
}
! System.out.println("Generating Keys for "+identity+"... ");
! PublicKey pub=sig.generateKey(identity);
System.out.println("DONE");
System.out.println("STORING Keys");
***************
*** 261,267 ****
}
! final PublicKey newkid = pksource.getPublicKey(allow);
if (newkid == null)
! throw new CryptoException("PublicKey not available for: " + allow);
return new IdentityBuilder(identity, newkid, defaultstore, defaultsigner, defaultlogger, defaultreceiver);
}
--- 268,274 ----
}
! final PublicKey newkid = pksource.getPublicKey(identity);
if (newkid == null)
! throw new CryptoException("PublicKey not available for: " + identity);
return new IdentityBuilder(identity, newkid, defaultstore, defaultsigner, defaultlogger, defaultreceiver);
}
***************
*** 271,282 ****
final IdentityCreator signer = new IdentityCreator(args);
signer.execute();
} catch (Exception e) {
e.printStackTrace();
}
! System.exit(0);
}
protected final String getExtraHelp() {
! return " --name neu://neu/one --receiver mailto:jo...@so... [--allow neuone --repository http://repository.neuclear.org -signer http://localhost:11870/Signer -logger http://logger.neuclear.org ]";
}
--- 278,291 ----
final IdentityCreator signer = new IdentityCreator(args);
signer.execute();
+ } catch (UserCancellationException e){
+ System.out.println("Bye");
} catch (Exception e) {
e.printStackTrace();
}
! // System.exit(0);
}
protected final String getExtraHelp() {
! return " --name neu://neu/one --receiver mailto:jo...@so...";
}
***************
*** 286,295 ****
protected final void getLocalOptions(final Options options) {
! options.addOption("n", "name", true, "specify name of new Identity");
! options.addOption("w", "allow", true, "specify alias in keystore of public key of new Identity");
! options.addOption("r", "repository", true, "Identity's default Repository");
! options.addOption("s", "signer", true, "Identity's default Interactive Signer");
! options.addOption("l", "logger", true, "Identity's default Logging Service");
! options.addOption("b", "receiver", true, "Identity's default Receiver");
}
--- 295,303 ----
protected final void getLocalOptions(final Options options) {
! options.addOption("n", "name", true, "specify name of new Identity \n[ --name neu://bob@yourdomain.com ]");
! options.addOption("r", "repository", true, "Identity's default Repository \n[ --repository http://repository.neuclear.org ] ");
! options.addOption("s", "signer", true, "Identity's default Interactive Signer \n[ --signer http://localhost:11870 ]");
! options.addOption("l", "logger", true, "Identity's default Logging Service \n[ --logger http://logger.neuclear.org ]");
! options.addOption("b", "receiver", true, "Identity's default Receiver \n[ --receiver mailto:bo...@yo... ]");
}
|
|
From: <pe...@us...> - 2003-12-19 00:31:34
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/signers/servlet
In directory sc8-pr-cvs1:/tmp/cvs-serv19108/src/java/org/neuclear/signers/servlet
Modified Files:
DemoSigningServlet.java SigningServlet.java
Log Message:
Lots of usability changes through out all the passphrase agents and end user tools.
Index: DemoSigningServlet.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/signers/servlet/DemoSigningServlet.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** DemoSigningServlet.java 16 Dec 2003 23:17:06 -0000 1.16
--- DemoSigningServlet.java 19 Dec 2003 00:31:31 -0000 1.17
***************
*** 2,5 ****
--- 2,8 ----
* $Id$
* $Log$
+ * Revision 1.17 2003/12/19 00:31:31 pelle
+ * Lots of usability changes through out all the passphrase agents and end user tools.
+ *
* Revision 1.16 2003/12/16 23:17:06 pelle
* Work done on the SigningServlet. The two phase web model is now only an option.
***************
*** 7,11 ****
* The screen has also been cleaned up and displays the xml to be signed.
* The GuiDialogueAgent now optionally remembers passphrases and has a checkbox to support this.
! * The PassPhraseAgent's now have a UserCancelsException, which allows the agent to tell the application if the user specifically
* cancels the signing process.
*
--- 10,14 ----
* The screen has also been cleaned up and displays the xml to be signed.
* The GuiDialogueAgent now optionally remembers passphrases and has a checkbox to support this.
! * The PassPhraseAgent's now have a UserCancellationException, which allows the agent to tell the application if the user specifically
* cancels the signing process.
*
Index: SigningServlet.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/signers/servlet/SigningServlet.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** SigningServlet.java 16 Dec 2003 23:44:10 -0000 1.25
--- SigningServlet.java 19 Dec 2003 00:31:31 -0000 1.26
***************
*** 2,5 ****
--- 2,8 ----
* $Id$
* $Log$
+ * Revision 1.26 2003/12/19 00:31:31 pelle
+ * Lots of usability changes through out all the passphrase agents and end user tools.
+ *
* Revision 1.25 2003/12/16 23:44:10 pelle
* End of work day clean up
***************
*** 10,14 ****
* The screen has also been cleaned up and displays the xml to be signed.
* The GuiDialogueAgent now optionally remembers passphrases and has a checkbox to support this.
! * The PassPhraseAgent's now have a UserCancelsException, which allows the agent to tell the application if the user specifically
* cancels the signing process.
*
--- 13,17 ----
* The screen has also been cleaned up and displays the xml to be signed.
* The GuiDialogueAgent now optionally remembers passphrases and has a checkbox to support this.
! * The PassPhraseAgent's now have a UserCancellationException, which allows the agent to tell the application if the user specifically
* cancels the signing process.
*
***************
*** 244,248 ****
import org.neuclear.commons.crypto.Base64;
import org.neuclear.commons.crypto.passphraseagents.GuiDialogAgent;
! import org.neuclear.commons.crypto.passphraseagents.UserCancelsException;
import org.neuclear.commons.crypto.signers.*;
import org.neuclear.commons.servlets.ServletTools;
--- 247,251 ----
import org.neuclear.commons.crypto.Base64;
import org.neuclear.commons.crypto.passphraseagents.GuiDialogAgent;
! import org.neuclear.commons.crypto.passphraseagents.UserCancellationException;
import org.neuclear.commons.crypto.signers.*;
import org.neuclear.commons.servlets.ServletTools;
***************
*** 350,354 ****
out.println("<li><font color=\"red\"><b>ERROR: Invalid Identity</b></font></li>");
isSigned = false;
! } catch (UserCancelsException e) {
// System.out.println("<br><font color=\"red\"><b>ERROR: User Cancellation</b></font><br>");
out.println("<li><font color=\"red\"><b>You Cancelled</b></font></li>");
--- 353,357 ----
out.println("<li><font color=\"red\"><b>ERROR: Invalid Identity</b></font></li>");
isSigned = false;
! } catch (UserCancellationException e) {
// System.out.println("<br><font color=\"red\"><b>ERROR: User Cancellation</b></font><br>");
out.println("<li><font color=\"red\"><b>You Cancelled</b></font></li>");
|