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...> - 2004-01-10 00:00:50
|
Update of /cvsroot/neuclear/neuclear-pay/src/test/org/neuclear/asset/receiver
In directory sc8-pr-cvs1:/tmp/cvs-serv22932/src/test/org/neuclear/asset/receiver
Modified Files:
PaymentReceiverTest.java
Log Message:
Implemented new Schema for Transfer*
Working on it for Exchange*, so far all Receipts are implemented.
Added SignedNamedDocument which is a generic SignedNamedObject that works with all Signed XML.
Changed SignedNamedObject.getDigest() from byte array to String.
The whole malarchy in neuclear-pay does not build yet. The refactoring is a big job, but getting there.
Index: PaymentReceiverTest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/test/org/neuclear/asset/receiver/PaymentReceiverTest.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** PaymentReceiverTest.java 5 Jan 2004 23:47:10 -0000 1.12
--- PaymentReceiverTest.java 10 Jan 2004 00:00:46 -0000 1.13
***************
*** 2,14 ****
import org.neuclear.asset.InvalidTransferException;
- import org.neuclear.asset.orders.transfers.TransferGlobals;
import org.neuclear.asset.contracts.Asset;
import org.neuclear.asset.contracts.AssetGlobals;
import org.neuclear.asset.orders.TransferGlobals;
import org.neuclear.asset.orders.TransferOrder;
- import org.neuclear.asset.orders.TransferOrder;
- import org.neuclear.asset.orders.builders.TransferRequestBuilder;
import org.neuclear.asset.orders.builders.TransferRequestBuilder;
- import org.neuclear.asset.controllers.currency.CurrencyController;
import org.neuclear.commons.NeuClearException;
import org.neuclear.commons.sql.DefaultConnectionSource;
--- 2,11 ----
import org.neuclear.asset.InvalidTransferException;
import org.neuclear.asset.contracts.Asset;
import org.neuclear.asset.contracts.AssetGlobals;
+ import org.neuclear.asset.controllers.currency.CurrencyController;
import org.neuclear.asset.orders.TransferGlobals;
import org.neuclear.asset.orders.TransferOrder;
import org.neuclear.asset.orders.builders.TransferRequestBuilder;
import org.neuclear.commons.NeuClearException;
import org.neuclear.commons.sql.DefaultConnectionSource;
***************
*** 51,54 ****
--- 48,58 ----
$Id$
$Log$
+ Revision 1.13 2004/01/10 00:00:46 pelle
+ Implemented new Schema for Transfer*
+ Working on it for Exchange*, so far all Receipts are implemented.
+ Added SignedNamedDocument which is a generic SignedNamedObject that works with all Signed XML.
+ Changed SignedNamedObject.getDigest() from byte array to String.
+ The whole malarchy in neuclear-pay does not build yet. The refactoring is a big job, but getting there.
+
Revision 1.12 2004/01/05 23:47:10 pelle
Create new Document classification "order", which is really just inherint in the new
***************
*** 200,204 ****
final TransferOrder transfer = (TransferOrder) obj;
final double fromBalance = proc.getBalance(transfer.getFrom(), transfer.getTimeStamp());
! final double toBalance = proc.getBalance(transfer.getTo(), transfer.getTimeStamp());
return new double[]{fromBalance, toBalance};
--- 204,208 ----
final TransferOrder transfer = (TransferOrder) obj;
final double fromBalance = proc.getBalance(transfer.getFrom(), transfer.getTimeStamp());
! final double toBalance = proc.getBalance(transfer.getRecipient(), transfer.getTimeStamp());
return new double[]{fromBalance, toBalance};
***************
*** 212,216 ****
final TransferOrder transfer = (TransferOrder) obj;
final double fromBalance = proc.getBalance(transfer.getFrom(), transfer.getTimeStamp());
! final double toBalance = proc.getBalance(transfer.getTo(), transfer.getTimeStamp());
final double prebalances[] = (double[]) state;
--- 216,220 ----
final TransferOrder transfer = (TransferOrder) obj;
final double fromBalance = proc.getBalance(transfer.getFrom(), transfer.getTimeStamp());
! final double toBalance = proc.getBalance(transfer.getRecipient(), transfer.getTimeStamp());
final double prebalances[] = (double[]) state;
|
Update of /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset
In directory sc8-pr-cvs1:/tmp/cvs-serv22932/src/java/org/neuclear/asset
Modified Files:
AssetController.java ExpiredHeldTransferException.java
TransferDeniedException.java
TransferLargerThanHeldException.java
TransferNotStartedException.java
Log Message:
Implemented new Schema for Transfer*
Working on it for Exchange*, so far all Receipts are implemented.
Added SignedNamedDocument which is a generic SignedNamedObject that works with all Signed XML.
Changed SignedNamedObject.getDigest() from byte array to String.
The whole malarchy in neuclear-pay does not build yet. The refactoring is a big job, but getting there.
Index: AssetController.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/AssetController.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** AssetController.java 5 Jan 2004 23:47:10 -0000 1.10
--- AssetController.java 10 Jan 2004 00:00:45 -0000 1.11
***************
*** 1,17 ****
package org.neuclear.asset;
! import org.neuclear.asset.contracts.*;
! import org.neuclear.exchange.orders.builders.CancelExchangeReceiptBuilder;
! import org.neuclear.asset.orders.exchanges.ExchangeOrder;
! import org.neuclear.asset.orders.AssetTransactionContract;
! import org.neuclear.asset.orders.TransferOrder;
import org.neuclear.asset.orders.AssetTransactionContract;
import org.neuclear.asset.orders.TransferOrder;
import org.neuclear.commons.NeuClearException;
- import org.neuclear.id.builders.NamedObjectBuilder;
import org.neuclear.exchange.orders.CancelExchangeOrder;
import org.neuclear.exchange.orders.ExchangeCompletionOrder;
! import org.neuclear.exchange.orders.*;
import org.neuclear.exchange.orders.builders.CancelExchangeReceiptBuilder;
/*
--- 1,13 ----
package org.neuclear.asset;
! import org.neuclear.asset.contracts.Asset;
import org.neuclear.asset.orders.AssetTransactionContract;
import org.neuclear.asset.orders.TransferOrder;
import org.neuclear.commons.NeuClearException;
import org.neuclear.exchange.orders.CancelExchangeOrder;
import org.neuclear.exchange.orders.ExchangeCompletionOrder;
! import org.neuclear.exchange.orders.ExchangeOrder;
import org.neuclear.exchange.orders.builders.CancelExchangeReceiptBuilder;
+ import org.neuclear.id.builders.NamedObjectBuilder;
/*
***************
*** 35,38 ****
--- 31,41 ----
$Id$
$Log$
+ Revision 1.11 2004/01/10 00:00:45 pelle
+ Implemented new Schema for Transfer*
+ Working on it for Exchange*, so far all Receipts are implemented.
+ Added SignedNamedDocument which is a generic SignedNamedObject that works with all Signed XML.
+ Changed SignedNamedObject.getDigest() from byte array to String.
+ The whole malarchy in neuclear-pay does not build yet. The refactoring is a big job, but getting there.
+
Revision 1.10 2004/01/05 23:47:10 pelle
Create new Document classification "order", which is really just inherint in the new
Index: ExpiredHeldTransferException.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/ExpiredHeldTransferException.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ExpiredHeldTransferException.java 5 Jan 2004 23:47:10 -0000 1.6
--- ExpiredHeldTransferException.java 10 Jan 2004 00:00:45 -0000 1.7
***************
*** 1,11 ****
package org.neuclear.asset;
- import org.neuclear.asset.orders.exchanges.Exchange;
- import org.neuclear.exchange.orders.ExchangeCompletionOrder;
- import org.neuclear.exchange.orders.ExchangeCompletionOrder;
import org.neuclear.exchange.orders.ExchangeCompletionOrder;
- import java.util.Date;
-
/**
* User: pelleb
--- 1,6 ----
***************
*** 26,30 ****
public String getSubMessage() {
! return "Not possible to complete held payment at this time: " + held.getValueTime();
}
}
--- 21,25 ----
public String getSubMessage() {
! return "Not possible to complete held payment at this time: " + held.getValuetime();
}
}
Index: TransferDeniedException.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/TransferDeniedException.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** TransferDeniedException.java 5 Jan 2004 23:47:10 -0000 1.6
--- TransferDeniedException.java 10 Jan 2004 00:00:45 -0000 1.7
***************
*** 1,6 ****
package org.neuclear.asset;
- import org.neuclear.asset.orders.TransferOrder;
- import org.neuclear.exchange.orders.CancelExchangeOrder;
import org.neuclear.asset.orders.AssetTransactionContract;
import org.neuclear.exchange.orders.CancelExchangeOrder;
--- 1,4 ----
***************
*** 27,30 ****
--- 25,35 ----
$Id$
$Log$
+ Revision 1.7 2004/01/10 00:00:45 pelle
+ Implemented new Schema for Transfer*
+ Working on it for Exchange*, so far all Receipts are implemented.
+ Added SignedNamedDocument which is a generic SignedNamedObject that works with all Signed XML.
+ Changed SignedNamedObject.getDigest() from byte array to String.
+ The whole malarchy in neuclear-pay does not build yet. The refactoring is a big job, but getting there.
+
Revision 1.6 2004/01/05 23:47:10 pelle
Create new Document classification "order", which is really just inherint in the new
Index: TransferLargerThanHeldException.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/TransferLargerThanHeldException.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** TransferLargerThanHeldException.java 5 Jan 2004 23:47:10 -0000 1.6
--- TransferLargerThanHeldException.java 10 Jan 2004 00:00:45 -0000 1.7
***************
*** 2,7 ****
- import org.neuclear.exchange.orders.ExchangeOrderReceipt;
- import org.neuclear.exchange.orders.ExchangeCompletionOrder;
import org.neuclear.exchange.orders.ExchangeCompletionOrder;
--- 2,5 ----
Index: TransferNotStartedException.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/TransferNotStartedException.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TransferNotStartedException.java 5 Jan 2004 23:47:10 -0000 1.4
--- TransferNotStartedException.java 10 Jan 2004 00:00:45 -0000 1.5
***************
*** 2,6 ****
import org.neuclear.asset.orders.TransferReceipt;
- import org.neuclear.asset.orders.TransferReceipt;
import java.util.Date;
--- 2,5 ----
|
Update of /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/orders
In directory sc8-pr-cvs1:/tmp/cvs-serv22932/src/java/org/neuclear/asset/orders
Modified Files:
AssetTransactionContract.java TransferGlobals.java
TransferOrder.java TransferReceipt.java
Log Message:
Implemented new Schema for Transfer*
Working on it for Exchange*, so far all Receipts are implemented.
Added SignedNamedDocument which is a generic SignedNamedObject that works with all Signed XML.
Changed SignedNamedObject.getDigest() from byte array to String.
The whole malarchy in neuclear-pay does not build yet. The refactoring is a big job, but getting there.
Index: AssetTransactionContract.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/orders/AssetTransactionContract.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** AssetTransactionContract.java 5 Jan 2004 23:47:09 -0000 1.1
--- AssetTransactionContract.java 10 Jan 2004 00:00:45 -0000 1.2
***************
*** 1,21 ****
package org.neuclear.asset.orders;
- import org.dom4j.Element;
- import org.neuclear.commons.NeuClearException;
- 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 org.neuclear.asset.orders.exchanges.*;
import org.neuclear.asset.contracts.Asset;
! import org.neuclear.asset.contracts.AssetGlobals;
! import org.neuclear.exchange.orders.CancelExchangeOrder;
! import org.neuclear.exchange.orders.CancelExchangeReceipt;
! import org.neuclear.exchange.orders.ExchangeCompletionOrder;
! import org.neuclear.exchange.orders.ExchangeOrderReceipt;
!
! import java.util.Date;
! import java.text.ParseException;
/**
--- 1,7 ----
package org.neuclear.asset.orders;
import org.neuclear.asset.contracts.Asset;
! import org.neuclear.id.SignedNamedCore;
! import org.neuclear.id.SignedNamedObject;
/**
***************
*** 26,29 ****
--- 12,22 ----
* $Id$
* $Log$
+ * Revision 1.2 2004/01/10 00:00:45 pelle
+ * Implemented new Schema for Transfer*
+ * Working on it for Exchange*, so far all Receipts are implemented.
+ * Added SignedNamedDocument which is a generic SignedNamedObject that works with all Signed XML.
+ * Changed SignedNamedObject.getDigest() from byte array to String.
+ * The whole malarchy in neuclear-pay does not build yet. The refactoring is a big job, but getting there.
+ *
* Revision 1.1 2004/01/05 23:47:09 pelle
* Create new Document classification "order", which is really just inherint in the new
***************
*** 105,165 ****
return asset;
}
-
- public static final class Reader implements NamedObjectReader {
- /**
- * Read object from Element and fill in its details
- *
- * @param elem
- * @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 CancelExchangeOrder(core, asset, holdid);
- if (elem.getName().equals(TransferGlobals.CANCEL_RCPT_TAGNAME))
- return new CancelExchangeReceipt(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 TransferOrder(core, asset, to, amount, 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 ExchangeOrder(core, asset, to, amount, 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 ExchangeOrderReceipt(core, asset, from, to, reqid, amount, valuetime, comment, helduntil);
-
- if (elem.getName().equals(TransferGlobals.COMPLETE_TAGNAME))
- return new ExchangeCompletionOrder(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");
- }
-
- }
-
}
--- 98,101 ----
Index: TransferGlobals.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/orders/TransferGlobals.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** TransferGlobals.java 6 Jan 2004 23:26:48 -0000 1.2
--- TransferGlobals.java 10 Jan 2004 00:00:45 -0000 1.3
***************
*** 2,8 ****
import org.dom4j.*;
import org.neuclear.id.verifier.VerifyingReader;
! import org.neuclear.asset.orders.AssetTransactionContract;
! import org.neuclear.asset.orders.AssetTransactionContract;
/*
--- 2,17 ----
import org.dom4j.*;
+ import org.neuclear.asset.contracts.Asset;
+ import org.neuclear.commons.Utility;
+ import org.neuclear.commons.time.TimeTools;
+ import org.neuclear.id.Identity;
+ import org.neuclear.id.InvalidNamedObjectException;
+ import org.neuclear.id.NameResolutionException;
+ import org.neuclear.id.SignedNamedObject;
+ import org.neuclear.id.resolver.NSResolver;
import org.neuclear.id.verifier.VerifyingReader;
!
! import java.sql.Timestamp;
! import java.text.ParseException;
/*
***************
*** 26,29 ****
--- 35,45 ----
$Id$
$Log$
+ Revision 1.3 2004/01/10 00:00:45 pelle
+ Implemented new Schema for Transfer*
+ Working on it for Exchange*, so far all Receipts are implemented.
+ Added SignedNamedDocument which is a generic SignedNamedObject that works with all Signed XML.
+ Changed SignedNamedObject.getDigest() from byte array to String.
+ The whole malarchy in neuclear-pay does not build yet. The refactoring is a big job, but getting there.
+
Revision 1.2 2004/01/06 23:26:48 pelle
Started restructuring the original xml schemas.
***************
*** 114,117 ****
--- 130,154 ----
return elem;
}
+ public static String getElementValue(final Element element, final String name) throws InvalidNamedObjectException {
+ return getElementValue(element,createQName(name));
+ }
+
+ public static String getElementValue(final Element element, final QName name) throws InvalidNamedObjectException {
+ final Element value=element.element(name);
+ if (value==null)
+ throw new InvalidNamedObjectException("Missing required element: "+name);
+ final String text=value.getTextTrim();
+ if (Utility.isEmpty(text))
+ throw new InvalidNamedObjectException("Required element: "+name+" is empty");
+ return text;
+ }
+
+ public static String getCommentElement(final Element element) {
+ final Element value=element.element(createQName(COMMENT_TAG));
+ if (value==null)
+ return "";
+ final String text=value.getTextTrim();
+ return Utility.denullString(text);
+ }
public static Element createElement(final String name) {
***************
*** 124,127 ****
--- 161,226 ----
}
+ public static final Timestamp parseValueTimeElement(final Element elem) throws InvalidNamedObjectException {
+ return parseTimeStampElement(elem,createQName(VALUE_TIME_TAG));
+ }
+
+ public static final Timestamp parseTimeStampElement(final Element elem,final String name) throws InvalidNamedObjectException {
+ return parseTimeStampElement(elem,createQName(name));
+ }
+ public static final Timestamp parseTimeStampElement(final Element elem,final QName qn) throws InvalidNamedObjectException {
+ try {
+ final Element telem=elem.element(qn);
+ if (telem==null)
+ throw new InvalidNamedObjectException("missing time stamp element");
+ final String value=telem.getTextTrim();
+ if (Utility.isEmpty(value))
+ throw new InvalidNamedObjectException("missing time stamp");
+
+ return TimeTools.parseTimeStamp(value);
+ } catch (ParseException e) {
+ throw new InvalidNamedObjectException("missing or invalid time stamp");
+ }
+
+ }
+
+ public static final Asset parseAssetTag(Element elem) throws InvalidNamedObjectException {
+ final String name = getElementValue(elem,ASSET_TAG);
+ try {
+ return (Asset) NSResolver.resolveIdentity(name);
+ } catch (ClassCastException e) {
+ throw new InvalidNamedObjectException(name,e);
+ } catch (NameResolutionException e) {
+ throw new InvalidNamedObjectException(name,e);
+ }
+
+ }
+ public static final Identity parseRecipientTag(Element elem) throws InvalidNamedObjectException {
+ final String name = getElementValue(elem,RECIPIENT_TAG);
+ try {
+ return NSResolver.resolveIdentity(name);
+ } catch (NameResolutionException e) {
+ throw new InvalidNamedObjectException(name,e);
+ }
+
+ }
+
+ public static final double parseAmountTag(Element elem) throws InvalidNamedObjectException {
+ final String amount=getElementValue(elem,AMOUNT_TAG);
+ try {
+ return Double.parseDouble(amount);
+ } catch (NumberFormatException e) {
+ throw new InvalidNamedObjectException("Badly formatted number",e);
+ }
+ }
+ public static final SignedNamedObject parseEmbedded(Element elem,QName name) throws InvalidNamedObjectException {
+ Element embedded=elem.element(name);
+ if (embedded==null)
+ throw new InvalidNamedObjectException("Element: "+elem.getName()+" doesnt contain a "+name.getQualifiedName());
+ try {
+ return VerifyingReader.getInstance().read(embedded);
+ } catch (NameResolutionException e) {
+ throw new InvalidNamedObjectException("Element: "+elem.getName()+" had a problem identifying signer",e);
+ }
+ }
static {
registerReaders();
***************
*** 132,134 ****
--- 231,238 ----
public static final String XFER_NSPREFIX = "xfer";
public static final String XFER_NSURI = "http://neuclear.org/neu/xfer.xsd";
+ public static final String VALUE_TIME_TAG="ValueTime";
+ public static final String COMMENT_TAG="Comment";
+ public static final String ASSET_TAG="Asset";
+ public static final String AMOUNT_TAG="Amount";
+ private static final String RECIPIENT_TAG = "Recipient";
}
Index: TransferOrder.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/orders/TransferOrder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TransferOrder.java 5 Jan 2004 23:47:09 -0000 1.1
--- TransferOrder.java 10 Jan 2004 00:00:45 -0000 1.2
***************
*** 1,19 ****
package org.neuclear.asset.orders;
! import org.neuclear.commons.NeuClearException;
! import org.neuclear.commons.Utility;
! import org.neuclear.commons.time.TimeTools;
! import org.neuclear.id.*;
! import org.neuclear.id.resolver.NSResolver;
! import org.neuclear.asset.orders.TransferContract;
! import org.neuclear.asset.orders.exchanges.*;
! import org.neuclear.asset.orders.AssetTransactionContract;
import org.neuclear.asset.contracts.Asset;
import org.neuclear.asset.contracts.AssetGlobals;
! import org.dom4j.Element;
!
! import java.sql.Timestamp;
! import java.util.Date;
! import java.text.ParseException;
/**
--- 1,8 ----
package org.neuclear.asset.orders;
! import org.dom4j.Element;
import org.neuclear.asset.contracts.Asset;
import org.neuclear.asset.contracts.AssetGlobals;
! import org.neuclear.id.*;
/**
***************
*** 24,40 ****
public class TransferOrder extends AssetTransactionContract {
! private TransferOrder(final SignedNamedCore core, final Asset asset, final Identity to, final double amount, final String comment) {
super(core, asset);
this.amount = amount;
! this.comment = (comment != null) ? comment : "";
! this.to=to;
! }
!
! public final Identity getFrom() {
! return getSignatory();
}
! public final Identity getTo() {
! return to;
}
public final double getAmount() {
--- 13,25 ----
public class TransferOrder extends AssetTransactionContract {
! private TransferOrder(final SignedNamedCore core, final Asset asset, final Identity recipient, final double amount, final String comment) {
super(core, asset);
this.amount = amount;
! this.comment = comment;
! this.recipient=recipient;
}
! public final Identity getRecipient() {
! return recipient;
}
public final double getAmount() {
***************
*** 46,50 ****
}
! private final Identity to;
private final double amount;
--- 31,35 ----
}
! private final Identity recipient;
private final double amount;
***************
*** 64,81 ****
throw new InvalidNamedObjectException(core.getName(),"Incorrect XML Tagname for reader: "+TransferGlobals.XFER_TAGNAME);
! try {
! //TODO Validate properly
! final Asset asset = (Asset) NSResolver.resolveIdentity(elem.attributeValue("assetName"));
!
!
! final double amount = Double.parseDouble(elem.attributeValue("amount"));
! final Identity to = NSResolver.resolveIdentity(elem.attributeValue("recipient"));
! final Element commentElement = elem.element(TransferGlobals.createQName("comment"));
!
! final String comment = (commentElement != null) ? commentElement.getText() : "";
! return new TransferOrder(core, asset, to, amount, comment);
! } catch (NameResolutionException e) {
! throw new InvalidNamedObjectException(core.getName(),e);
! }
}
}
--- 49,58 ----
throw new InvalidNamedObjectException(core.getName(),"Incorrect XML Tagname for reader: "+TransferGlobals.XFER_TAGNAME);
! return new TransferOrder(core,
! TransferGlobals.parseAssetTag(elem),
! TransferGlobals.parseRecipientTag(elem),
! TransferGlobals.parseAmountTag(elem),
! TransferGlobals.getCommentElement(elem)
! );
}
}
Index: TransferReceipt.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/orders/TransferReceipt.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** TransferReceipt.java 6 Jan 2004 23:26:48 -0000 1.2
--- TransferReceipt.java 10 Jan 2004 00:00:45 -0000 1.3
***************
*** 1,17 ****
package org.neuclear.asset.orders;
- import org.neuclear.commons.NeuClearException;
- import org.neuclear.commons.time.TimeTools;
- import org.neuclear.id.*;
- import org.neuclear.id.resolver.NSResolver;
- import org.neuclear.asset.orders.TransferContract;
- import org.neuclear.asset.orders.AssetTransactionContract;
- import org.neuclear.asset.contracts.Asset;
- import org.neuclear.asset.contracts.AssetGlobals;
import org.dom4j.Element;
import java.sql.Timestamp;
import java.util.Date;
- import java.text.ParseException;
/**
--- 1,13 ----
package org.neuclear.asset.orders;
import org.dom4j.Element;
+ import org.neuclear.asset.contracts.AssetGlobals;
+ import org.neuclear.id.InvalidNamedObjectException;
+ import org.neuclear.id.NamedObjectReader;
+ import org.neuclear.id.SignedNamedCore;
+ import org.neuclear.id.SignedNamedObject;
import java.sql.Timestamp;
import java.util.Date;
/**
***************
*** 48,74 ****
if (!elem.getNamespace().equals(AssetGlobals.NS_ASSET))
throw new InvalidNamedObjectException(core.getName(),"Not in XML NameSpace: "+AssetGlobals.NS_ASSET.getURI());
! if (elem.getName().equals(TransferGlobals.XFER_TAGNAME))
throw new InvalidNamedObjectException(core.getName(),"Incorrect XML Tagname for reader: "+TransferGlobals.XFER_TAGNAME);
! try {
! //TODO Validate properly
! final Asset asset = (Asset) NSResolver.resolveIdentity(elem.attributeValue("assetName"));
!
!
! final double amount = Double.parseDouble(elem.attributeValue("amount"));
! final Identity to = NSResolver.resolveIdentity(elem.attributeValue("recipient"));
! final Element commentElement = elem.element(TransferGlobals.createQName("comment"));
! final Date valuetime = TimeTools.parseTimeStamp(elem.attributeValue("valuetime"));
! final Identity from = NSResolver.resolveIdentity(elem.attributeValue("sender"));
! final String reqid = elem.attributeValue("reqid");
!
! final String comment = (commentElement != null) ? commentElement.getText() : "";
! return new TransferReceipt(core, asset, from, to, reqid, amount, valuetime, comment);
- } catch (NameResolutionException e) {
- throw new InvalidNamedObjectException(core.getName(),e);
- } catch (ParseException e) {
- throw new InvalidNamedObjectException(core.getName(),e);
- }
}
}
--- 44,54 ----
if (!elem.getNamespace().equals(AssetGlobals.NS_ASSET))
throw new InvalidNamedObjectException(core.getName(),"Not in XML NameSpace: "+AssetGlobals.NS_ASSET.getURI());
! if (!elem.getName().equals(TransferGlobals.XFER_RCPT_TAGNAME))
throw new InvalidNamedObjectException(core.getName(),"Incorrect XML Tagname for reader: "+TransferGlobals.XFER_TAGNAME);
! return new TransferReceipt(core,
! (TransferOrder) TransferGlobals.parseEmbedded(elem,TransferGlobals.createQName(TransferGlobals.XFER_TAGNAME)),
! TransferGlobals.parseValueTimeElement(elem));
}
}
|
|
From: <pe...@us...> - 2004-01-10 00:00:48
|
Update of /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/receiver In directory sc8-pr-cvs1:/tmp/cvs-serv22932/src/java/org/neuclear/asset/receiver Modified Files: AssetControllerReceiver.java Log Message: Implemented new Schema for Transfer* Working on it for Exchange*, so far all Receipts are implemented. Added SignedNamedDocument which is a generic SignedNamedObject that works with all Signed XML. Changed SignedNamedObject.getDigest() from byte array to String. The whole malarchy in neuclear-pay does not build yet. The refactoring is a big job, but getting there. Index: AssetControllerReceiver.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/receiver/AssetControllerReceiver.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** AssetControllerReceiver.java 5 Jan 2004 23:47:09 -0000 1.9 --- AssetControllerReceiver.java 10 Jan 2004 00:00:45 -0000 1.10 *************** *** 3,11 **** import org.neuclear.asset.AssetController; import org.neuclear.asset.TransferException; ! import org.neuclear.asset.orders.transfers.TransferGlobals; import org.neuclear.asset.orders.AssetTransactionContract; import org.neuclear.asset.orders.TransferContract; ! import org.neuclear.asset.orders.*; ! import org.neuclear.asset.contracts.*; import org.neuclear.commons.NeuClearException; import org.neuclear.commons.crypto.signers.Signer; --- 3,12 ---- import org.neuclear.asset.AssetController; import org.neuclear.asset.TransferException; ! import org.neuclear.asset.contracts.Asset; ! import org.neuclear.asset.contracts.AssetGlobals; import org.neuclear.asset.orders.AssetTransactionContract; import org.neuclear.asset.orders.TransferContract; ! import org.neuclear.asset.orders.TransferGlobals; ! import org.neuclear.asset.orders.transfers.TransferGlobals; import org.neuclear.commons.NeuClearException; import org.neuclear.commons.crypto.signers.Signer; |
|
From: <pe...@us...> - 2004-01-10 00:00:48
|
Update of /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/remote In directory sc8-pr-cvs1:/tmp/cvs-serv22932/src/java/org/neuclear/asset/remote Modified Files: AssetControlClient.java Log Message: Implemented new Schema for Transfer* Working on it for Exchange*, so far all Receipts are implemented. Added SignedNamedDocument which is a generic SignedNamedObject that works with all Signed XML. Changed SignedNamedObject.getDigest() from byte array to String. The whole malarchy in neuclear-pay does not build yet. The refactoring is a big job, but getting there. Index: AssetControlClient.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/remote/AssetControlClient.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** AssetControlClient.java 5 Jan 2004 23:47:10 -0000 1.10 --- AssetControlClient.java 10 Jan 2004 00:00:45 -0000 1.11 *************** *** 1,9 **** package org.neuclear.asset.remote; - import org.neuclear.exchange.orders.CancelExchangeReceipt; - import org.neuclear.exchange.orders.ExchangeOrderReceipt; - import org.neuclear.asset.orders.TransferReceipt; - import org.neuclear.asset.contracts.builders.*; - import org.neuclear.exchange.orders.CancelExchangeReceipt; import org.neuclear.asset.orders.TransferReceipt; import org.neuclear.asset.orders.builders.TransferBuilder; --- 1,4 ---- *************** *** 11,20 **** import org.neuclear.commons.NeuClearException; import org.neuclear.commons.crypto.signers.Signer; - import org.neuclear.id.SignedNamedObject; - import org.neuclear.xml.XMLException; import org.neuclear.exchange.orders.CancelExchangeReceipt; import org.neuclear.exchange.orders.builders.CancelExchangeRequestBuilder; import org.neuclear.exchange.orders.builders.CompleteExchangeRequestBuilder; import org.neuclear.exchange.orders.builders.ExchangeRequestBuilder; /* --- 6,16 ---- import org.neuclear.commons.NeuClearException; import org.neuclear.commons.crypto.signers.Signer; import org.neuclear.exchange.orders.CancelExchangeReceipt; + import org.neuclear.exchange.orders.ExchangeOrderReceipt; import org.neuclear.exchange.orders.builders.CancelExchangeRequestBuilder; import org.neuclear.exchange.orders.builders.CompleteExchangeRequestBuilder; import org.neuclear.exchange.orders.builders.ExchangeRequestBuilder; + import org.neuclear.id.SignedNamedObject; + import org.neuclear.xml.XMLException; /* *************** *** 38,41 **** --- 34,44 ---- $Id$ $Log$ + Revision 1.11 2004/01/10 00:00:45 pelle + Implemented new Schema for Transfer* + Working on it for Exchange*, so far all Receipts are implemented. + Added SignedNamedDocument which is a generic SignedNamedObject that works with all Signed XML. + Changed SignedNamedObject.getDigest() from byte array to String. + The whole malarchy in neuclear-pay does not build yet. The refactoring is a big job, but getting there. + Revision 1.10 2004/01/05 23:47:10 pelle Create new Document classification "order", which is really just inherint in the new |
|
From: <pe...@us...> - 2004-01-10 00:00:48
|
Update of /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/receiver/servlet In directory sc8-pr-cvs1:/tmp/cvs-serv22932/src/java/org/neuclear/asset/receiver/servlet Modified Files: AssetControllerServlet.java TransferRequestServlet.java Log Message: Implemented new Schema for Transfer* Working on it for Exchange*, so far all Receipts are implemented. Added SignedNamedDocument which is a generic SignedNamedObject that works with all Signed XML. Changed SignedNamedObject.getDigest() from byte array to String. The whole malarchy in neuclear-pay does not build yet. The refactoring is a big job, but getting there. Index: AssetControllerServlet.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/receiver/servlet/AssetControllerServlet.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** AssetControllerServlet.java 5 Jan 2004 23:47:09 -0000 1.9 --- AssetControllerServlet.java 10 Jan 2004 00:00:45 -0000 1.10 *************** *** 3,14 **** import org.neuclear.asset.contracts.Asset; import org.neuclear.asset.contracts.AssetGlobals; - import org.neuclear.asset.orders.transfers.TransferGlobals; import org.neuclear.asset.controllers.currency.CurrencyController; - import org.neuclear.asset.receiver.AssetControllerReceiver; import org.neuclear.asset.orders.transfers.TransferGlobals; ! import org.neuclear.commons.crypto.signers.TestCaseSigner; import org.neuclear.commons.sql.JNDIConnectionSource; import org.neuclear.commons.sql.statements.SimpleStatementFactory; - import org.neuclear.commons.servlets.ServletTools; import org.neuclear.id.resolver.NSResolver; import org.neuclear.ledger.implementations.SQLLedger; --- 3,12 ---- import org.neuclear.asset.contracts.Asset; import org.neuclear.asset.contracts.AssetGlobals; import org.neuclear.asset.controllers.currency.CurrencyController; import org.neuclear.asset.orders.transfers.TransferGlobals; ! import org.neuclear.asset.receiver.AssetControllerReceiver; ! import org.neuclear.commons.servlets.ServletTools; import org.neuclear.commons.sql.JNDIConnectionSource; import org.neuclear.commons.sql.statements.SimpleStatementFactory; import org.neuclear.id.resolver.NSResolver; import org.neuclear.ledger.implementations.SQLLedger; *************** *** 38,41 **** --- 36,46 ---- $Id$ $Log$ + Revision 1.10 2004/01/10 00:00:45 pelle + Implemented new Schema for Transfer* + Working on it for Exchange*, so far all Receipts are implemented. + Added SignedNamedDocument which is a generic SignedNamedObject that works with all Signed XML. + Changed SignedNamedObject.getDigest() from byte array to String. + The whole malarchy in neuclear-pay does not build yet. The refactoring is a big job, but getting there. + Revision 1.9 2004/01/05 23:47:09 pelle Create new Document classification "order", which is really just inherint in the new Index: TransferRequestServlet.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/receiver/servlet/TransferRequestServlet.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TransferRequestServlet.java 5 Jan 2004 23:47:09 -0000 1.2 --- TransferRequestServlet.java 10 Jan 2004 00:00:45 -0000 1.3 *************** *** 1,15 **** package org.neuclear.asset.receiver.servlet; ! import org.neuclear.signers.servlet.SignatureRequestServlet; ! import org.neuclear.id.builders.NamedObjectBuilder; ! import org.neuclear.id.resolver.NSResolver; ! import org.neuclear.id.Identity; ! import org.neuclear.id.InvalidNamedObjectException; import org.neuclear.commons.NeuClearException; import org.neuclear.commons.Utility; import org.neuclear.commons.time.TimeTools; ! import org.neuclear.asset.orders.builders.TransferRequestBuilder; ! import org.neuclear.asset.contracts.Asset; ! import org.neuclear.asset.InvalidTransferException; import javax.servlet.http.HttpServletRequest; --- 1,15 ---- package org.neuclear.asset.receiver.servlet; ! import org.neuclear.asset.InvalidTransferException; ! import org.neuclear.asset.contracts.Asset; ! import org.neuclear.asset.orders.builders.TransferRequestBuilder; import org.neuclear.commons.NeuClearException; import org.neuclear.commons.Utility; import org.neuclear.commons.time.TimeTools; ! import org.neuclear.id.Identity; ! import org.neuclear.id.InvalidNamedObjectException; ! import org.neuclear.id.builders.NamedObjectBuilder; ! import org.neuclear.id.resolver.NSResolver; ! import org.neuclear.signers.servlet.SignatureRequestServlet; import javax.servlet.http.HttpServletRequest; *************** *** 35,38 **** --- 35,45 ---- $Id$ $Log$ + Revision 1.3 2004/01/10 00:00:45 pelle + Implemented new Schema for Transfer* + Working on it for Exchange*, so far all Receipts are implemented. + Added SignedNamedDocument which is a generic SignedNamedObject that works with all Signed XML. + Changed SignedNamedObject.getDigest() from byte array to String. + The whole malarchy in neuclear-pay does not build yet. The refactoring is a big job, but getting there. + Revision 1.2 2004/01/05 23:47:09 pelle Create new Document classification "order", which is really just inherint in the new |
|
From: <pe...@us...> - 2004-01-09 16:34:44
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/store
In directory sc8-pr-cvs1:/tmp/cvs-serv28313/src/java/org/neuclear/store
Modified Files:
EncryptedFileStore.java
Log Message:
changed use of base36 encoding to base32 to ensure compatibility with other schemes.
Index: EncryptedFileStore.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/store/EncryptedFileStore.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** EncryptedFileStore.java 19 Dec 2003 18:03:35 -0000 1.18
--- EncryptedFileStore.java 9 Jan 2004 16:34:40 -0000 1.19
***************
*** 2,5 ****
--- 2,8 ----
* $Id$
* $Log$
+ * Revision 1.19 2004/01/09 16:34:40 pelle
+ * changed use of base36 encoding to base32 to ensure compatibility with other schemes.
+ *
* Revision 1.18 2003/12/19 18:03:35 pelle
* Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
***************
*** 254,258 ****
protected final String getFileName(final String name) throws InvalidNamedObjectException {
final String deURLizedName = NSTools.normalizeNameURI(name);
! final byte[] hash = CryptoTools.formatAsBase36(CryptoTools.digest256(deURLizedName.getBytes())).getBytes();
//if (true) return new String(hash);
final int partlength = hash.length / 8;
--- 257,261 ----
protected final String getFileName(final String name) throws InvalidNamedObjectException {
final String deURLizedName = NSTools.normalizeNameURI(name);
! final byte[] hash = CryptoTools.encodeBase32(CryptoTools.digest256(deURLizedName.getBytes())).getBytes();
//if (true) return new String(hash);
final int partlength = hash.length / 8;
|
|
From: <pe...@us...> - 2004-01-09 16:34:44
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id
In directory sc8-pr-cvs1:/tmp/cvs-serv28313/src/java/org/neuclear/id
Modified Files:
NSTools.java SignedNamedCore.java
Log Message:
changed use of base36 encoding to base32 to ensure compatibility with other schemes.
Index: NSTools.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/NSTools.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** NSTools.java 7 Jan 2004 23:12:20 -0000 1.25
--- NSTools.java 9 Jan 2004 16:34:40 -0000 1.26
***************
*** 2,5 ****
--- 2,8 ----
* $Id$
* $Log$
+ * Revision 1.26 2004/01/09 16:34:40 pelle
+ * changed use of base36 encoding to base32 to ensure compatibility with other schemes.
+ *
* Revision 1.25 2004/01/07 23:12:20 pelle
* XMLSig now has various added features:
***************
*** 357,361 ****
dig.doFinal(output, 0);
! buffy.append(CryptoTools.formatAsBase36(output));
return buffy.toString();
}
--- 360,364 ----
dig.doFinal(output, 0);
! buffy.append(CryptoTools.encodeBase32(output));
return buffy.toString();
}
Index: SignedNamedCore.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/SignedNamedCore.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** SignedNamedCore.java 8 Jan 2004 23:39:06 -0000 1.9
--- SignedNamedCore.java 9 Jan 2004 16:34:40 -0000 1.10
***************
*** 2,5 ****
--- 2,8 ----
* $Id$
* $Log$
+ * Revision 1.10 2004/01/09 16:34:40 pelle
+ * changed use of base36 encoding to base32 to ensure compatibility with other schemes.
+ *
* Revision 1.9 2004/01/08 23:39:06 pelle
* XMLSignature can now give you the Signing key and the id of the signer.
***************
*** 278,282 ****
*/
private SignedNamedCore(final PublicKey pub){
! this.digest=CryptoTools.formatAsBase36(CryptoTools.digest(pub.getEncoded()));
this.name="neu:sha1:"+digest;
this.timestamp=System.currentTimeMillis();
--- 281,285 ----
*/
private SignedNamedCore(final PublicKey pub){
! this.digest=CryptoTools.encodeBase32(CryptoTools.digest(pub.getEncoded()));
this.name="neu:sha1:"+digest;
this.timestamp=System.currentTimeMillis();
***************
*** 292,296 ****
private SignedNamedCore(final PublicKey pub, final String encoded){
this.signer = new Identity(new SignedNamedCore(pub),pub);
! this.digest=CryptoTools.formatAsBase36(CryptoTools.digest(encoded.getBytes()));
this.name=signer.getName()+"!"+digest;
this.timestamp=System.currentTimeMillis();
--- 295,299 ----
private SignedNamedCore(final PublicKey pub, final String encoded){
this.signer = new Identity(new SignedNamedCore(pub),pub);
! this.digest=CryptoTools.encodeBase32(CryptoTools.digest(encoded.getBytes()));
this.name=signer.getName()+"!"+digest;
this.timestamp=System.currentTimeMillis();
***************
*** 309,313 ****
this.timestamp = timestamp.getTime();
this.encoded = encoded;
! this.digest=CryptoTools.formatAsBase36(CryptoTools.digest(encoded.getBytes()));
}
--- 312,316 ----
this.timestamp = timestamp.getTime();
this.encoded = encoded;
! this.digest=CryptoTools.encodeBase32(CryptoTools.digest(encoded.getBytes()));
}
***************
*** 316,320 ****
this.signer=null;//new Identity(this,Identity.getRootPK());
final byte[] encoded = Identity.getRootPK().getEncoded();
! this.digest=CryptoTools.formatAsBase36(CryptoTools.digest(encoded));
this.timestamp=System.currentTimeMillis();
this.encoded=new String(encoded);
--- 319,323 ----
this.signer=null;//new Identity(this,Identity.getRootPK());
final byte[] encoded = Identity.getRootPK().getEncoded();
! this.digest=CryptoTools.encodeBase32(CryptoTools.digest(encoded));
this.timestamp=System.currentTimeMillis();
this.encoded=new String(encoded);
|
|
From: <pe...@us...> - 2004-01-09 16:34:35
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto
In directory sc8-pr-cvs1:/tmp/cvs-serv28282/src/java/org/neuclear/commons/crypto
Modified Files:
CryptoTools.java
Log Message:
changed use of base36 encoding to base32 to ensure compatibility with other schemes.
Index: CryptoTools.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/CryptoTools.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** CryptoTools.java 19 Dec 2003 00:31:16 -0000 1.9
--- CryptoTools.java 9 Jan 2004 16:34:32 -0000 1.10
***************
*** 2,5 ****
--- 2,8 ----
* $Id$
* $Log$
+ * Revision 1.10 2004/01/09 16:34:32 pelle
+ * changed use of base36 encoding to base32 to ensure compatibility with other schemes.
+ *
* Revision 1.9 2003/12/19 00:31:16 pelle
* Lots of usability changes through out all the passphrase agents and end user tools.
***************
*** 528,535 ****
return true;
}
!
! public static String formatAsBase36(final byte[] val) {
final BigInteger big = new BigInteger(val);
! return big.toString(36);
}
--- 531,543 ----
return true;
}
! /**
! * Unpadded Base32 Encoding as defined in:
! * <a href="http://www.waterken.com/dev/Enc/base32/">http://www.waterken.com/dev/Enc/base32/</a>
! * @param val
! * @return
! */
! public static String encodeBase32(final byte[] val) {
final BigInteger big = new BigInteger(val);
! return big.toString(32);
}
***************
*** 541,545 ****
public static String createRandomID(int length) {
final BigInteger big = new BigInteger(length, getRandomInstance());
! return big.toString(36);
}
--- 549,553 ----
public static String createRandomID(int length) {
final BigInteger big = new BigInteger(length, getRandomInstance());
! return big.toString(32);
}
|
|
From: <pe...@us...> - 2004-01-09 16:34:35
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/jce
In directory sc8-pr-cvs1:/tmp/cvs-serv28282/src/java/org/neuclear/commons/crypto/jce
Modified Files:
RawCertificate.java
Log Message:
changed use of base36 encoding to base32 to ensure compatibility with other schemes.
Index: RawCertificate.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/jce/RawCertificate.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** RawCertificate.java 18 Dec 2003 17:40:07 -0000 1.1
--- RawCertificate.java 9 Jan 2004 16:34:32 -0000 1.2
***************
*** 28,31 ****
--- 28,34 ----
$Id$
$Log$
+ Revision 1.2 2004/01/09 16:34:32 pelle
+ changed use of base36 encoding to base32 to ensure compatibility with other schemes.
+
Revision 1.1 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.
***************
*** 110,114 ****
public final String toString() {
try {
! return CryptoTools.formatAsBase36(CryptoTools.digest(getEncoded()));
} catch (Exception e) {
return "error";
--- 113,117 ----
public final String toString() {
try {
! return CryptoTools.encodeBase32(CryptoTools.digest(getEncoded()));
} catch (Exception e) {
return "error";
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id
In directory sc8-pr-cvs1:/tmp/cvs-serv8668/src/java/org/neuclear/id
Modified Files:
Identity.java SignedNamedCore.java SignedNamedObject.java
Added Files:
NeuclearKeyResolver.java
Removed Files:
SignedObject.java
Log Message:
XMLSignature can now give you the Signing key and the id of the signer.
SignedElement can now self verify using embedded public keys as well as KeyName's
Added NeuclearKeyResolver for resolving public key's from Identity certificates.
SignedNamedObjects can now generate their own name using the following format:
neu:sha1://[sha1 of PublicKey]![sha1 of full signed object]
The resulting object has a special internally generted Identity containing the PublicKey
Identity can now contain nothing but a public key
--- NEW FILE: NeuclearKeyResolver.java ---
package org.neuclear.id;
import org.neuclear.commons.crypto.keyresolvers.KeyResolver;
import org.neuclear.id.resolver.NSResolver;
import java.security.PublicKey;
/*
NeuClear Distributed Transaction Clearing Platform
(C) 2003 Pelle Braendgaard
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
$Id: NeuclearKeyResolver.java,v 1.1 2004/01/08 23:39:06 pelle Exp $
$Log: NeuclearKeyResolver.java,v $
Revision 1.1 2004/01/08 23:39:06 pelle
XMLSignature can now give you the Signing key and the id of the signer.
SignedElement can now self verify using embedded public keys as well as KeyName's
Added NeuclearKeyResolver for resolving public key's from Identity certificates.
SignedNamedObjects can now generate their own name using the following format:
neu:sha1://[sha1 of PublicKey]![sha1 of full signed object]
The resulting object has a special internally generted Identity containing the PublicKey
Identity can now contain nothing but a public key
*/
/**
* User: pelleb
* Date: Jan 8, 2004
* Time: 9:34:56 PM
*/
public class NeuclearKeyResolver implements KeyResolver{
public PublicKey resolve(String name) {
try {
return NSResolver.resolveIdentity(name).getPublicKey();
} catch (NameResolutionException e) {
return null;
} catch (InvalidNamedObjectException e) {
return null;
}
}
}
Index: Identity.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/Identity.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** Identity.java 7 Jan 2004 23:12:20 -0000 1.27
--- Identity.java 8 Jan 2004 23:39:06 -0000 1.28
***************
*** 2,5 ****
--- 2,14 ----
* $Id$
* $Log$
+ * Revision 1.28 2004/01/08 23:39:06 pelle
+ * XMLSignature can now give you the Signing key and the id of the signer.
+ * SignedElement can now self verify using embedded public keys as well as KeyName's
+ * Added NeuclearKeyResolver for resolving public key's from Identity certificates.
+ * SignedNamedObjects can now generate their own name using the following format:
+ * neu:sha1://[sha1 of PublicKey]![sha1 of full signed object]
+ * The resulting object has a special internally generted Identity containing the PublicKey
+ * Identity can now contain nothing but a public key
+ *
* Revision 1.27 2004/01/07 23:12:20 pelle
* XMLSig now has various added features:
***************
*** 342,357 ****
- /**
- * @param repository URL of Default Store for Identity. (Note. A Identity object is stored in the default repository of it's parent namespace)
- * @param signer URL of default interactive signing service for namespace. If null it doesnt allow interactive signing
- * @param receiver URL of default receiver for namespace
- */
! protected Identity(final SignedNamedCore core, final String repository, final String signer, final String logger, final String receiver, final PublicKey pub) {
super(core);
- this.repository = repository;
- this.logger = logger;
- this.signer = signer;
- this.receiver = receiver;
this.pub = pub;
}
--- 351,357 ----
! protected Identity(final SignedNamedCore core, final PublicKey pub) {
super(core);
this.pub = pub;
}
***************
*** 359,387 ****
public final String getRepository() {
! return repository;
}
public final String getSigner() {
! return signer;
}
public final String getLogger() {
! return logger;
}
public final String getReceiver() {
! return receiver;
}
public final SignedNamedObject receive(final SignedNamedObject obj) throws NeuClearException {
if (!Utility.isEmpty(receiver))
return Sender.quickSend(receiver, obj);
else
throw new NeuClearException("Cant receive object, " + getName() + " doesnt have a registered Receiver");
}
final void log(final SignedNamedObject obj) throws NeuClearException {
if (!Utility.isEmpty(logger))
Sender.quickSend(logger, obj);
}
--- 359,391 ----
public final String getRepository() {
! return null;
}
public final String getSigner() {
! return null;
}
public final String getLogger() {
! return null;
}
public final String getReceiver() {
! return null;
}
public final SignedNamedObject receive(final SignedNamedObject obj) throws NeuClearException {
+ /*
if (!Utility.isEmpty(receiver))
return Sender.quickSend(receiver, obj);
else
+ */
throw new NeuClearException("Cant receive object, " + getName() + " doesnt have a registered Receiver");
}
final void log(final SignedNamedObject obj) throws NeuClearException {
+ /*
if (!Utility.isEmpty(logger))
Sender.quickSend(logger, obj);
+ */
}
***************
*** 394,401 ****
}
- private final String repository;
- private final String signer;
- private final String logger;
- private final String receiver;
private final PublicKey pub;
--- 398,401 ----
***************
*** 405,410 ****
try {
final PublicKey rootpk = CryptoTools.createPK(NSROOTPKMOD, NSROOTPKEXP);
! return new Identity(SignedNamedCore.createRootCore(), NSResolver.NSROOTSTORE,
! null, null, null, rootpk);
} catch (NeuClearException e) {
e.printStackTrace();
--- 405,409 ----
try {
final PublicKey rootpk = CryptoTools.createPK(NSROOTPKMOD, NSROOTPKEXP);
! return new Identity(SignedNamedCore.createRootCore(), rootpk);
} catch (NeuClearException e) {
e.printStackTrace();
***************
*** 417,436 ****
public final java.security.cert.Certificate[] getCertificateChain() {
return new Certificate[]{getCertificate()};
- // final ArrayList certs = new ArrayList(3);
- // Identity id = this;
- // while (id != null) {
- // certs.add(id.getCertificate());
- // id = id.getSignatory();
- // }
- // certs.add(NEUROOT.getCertificate());
- // certs.trimToSize();
- // final Certificate[] cert = new Certificate[certs.size()];
- // final Iterator iter = certs.iterator();
- // int i = 0;
- // while (iter.hasNext()) {
- // final Certificate certificate = (java.security.cert.Certificate) iter.next();
- // cert[i++] = certificate;
- // }
- // return cert;
}
--- 416,419 ----
***************
*** 438,445 ****
* Returns the fixed Root PublicKey
*/
! final static PublicKey getRootPK() throws CryptoException {
! if (nsrootpk == null)
! nsrootpk = CryptoTools.createPK(NSROOTPKMOD, NSROOTPKEXP);
! return nsrootpk;
}
--- 421,432 ----
* Returns the fixed Root PublicKey
*/
! final static synchronized PublicKey getRootPK() {
! try {
! if (nsrootpk == null)
! nsrootpk = CryptoTools.createPK(NSROOTPKMOD, NSROOTPKEXP);
! return nsrootpk;
! } catch (CryptoException e) {
! throw new RuntimeException(e);
! }
}
***************
*** 506,513 ****
*/
public final SignedNamedObject read(final SignedNamedCore core, final Element elem) throws InvalidNamedObjectException {
- 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"));
--- 493,496 ----
***************
*** 515,519 ****
final KeyInfo ki = new KeyInfo(InvalidNamedObjectException.assertContainsElementQName(allowElement, XMLSecTools.createQName("KeyInfo")));
final PublicKey pub = ki.getPublicKey();
! return new Identity(core, repository, signer, logger, receiver, pub);
} catch (XMLSecurityException e) {
throw new InvalidNamedObjectException(core.getName(),e);
--- 498,502 ----
final KeyInfo ki = new KeyInfo(InvalidNamedObjectException.assertContainsElementQName(allowElement, XMLSecTools.createQName("KeyInfo")));
final PublicKey pub = ki.getPublicKey();
! return new Identity(core, pub);
} catch (XMLSecurityException e) {
throw new InvalidNamedObjectException(core.getName(),e);
Index: SignedNamedCore.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/SignedNamedCore.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** SignedNamedCore.java 20 Dec 2003 00:21:19 -0000 1.8
--- SignedNamedCore.java 8 Jan 2004 23:39:06 -0000 1.9
***************
*** 2,5 ****
--- 2,14 ----
* $Id$
* $Log$
+ * Revision 1.9 2004/01/08 23:39:06 pelle
+ * XMLSignature can now give you the Signing key and the id of the signer.
+ * SignedElement can now self verify using embedded public keys as well as KeyName's
+ * Added NeuclearKeyResolver for resolving public key's from Identity certificates.
+ * SignedNamedObjects can now generate their own name using the following format:
+ * neu:sha1://[sha1 of PublicKey]![sha1 of full signed object]
+ * The resulting object has a special internally generted Identity containing the PublicKey
+ * Identity can now contain nothing but a public key
+ *
* Revision 1.8 2003/12/20 00:21:19 pelle
* overwrote the standard Object.toString(), hashCode() and equals() methods for SignedNamedObject/Core
***************
*** 236,239 ****
--- 245,250 ----
import org.neuclear.commons.NeuClearException;
import org.neuclear.commons.crypto.CryptoTools;
+ import org.neuclear.commons.crypto.Base64;
+ import org.neuclear.commons.crypto.CryptoException;
import org.neuclear.commons.time.TimeTools;
import org.neuclear.id.resolver.NSResolver;
***************
*** 242,245 ****
--- 253,257 ----
import org.neuclear.xml.xmlsec.XMLSecTools;
import org.neuclear.xml.xmlsec.XMLSecurityException;
+ import org.neuclear.xml.xmlsec.XMLSignature;
import java.security.PublicKey;
***************
*** 248,265 ****
/**
! * The SignedNamedObject is a <i>secure</i> object normally encapsulating a Digitally signed contract of some
! * sort.<p>
! * Instances of SignedNamedObject and its sub classes are never instantiated directly by client code.
! * Instead it is created by its Reader inner class. This Reader implements NamedObjectReader and is called by
! * VerifyingReader.<p>
! * In most cases a user will load NamedObject through one of two methods:
! * <ul><li>NSResolver for permanent contracts stored on the internet, such as Identity Certificates</li>
! * <li>The other way they are often received are as return values when sending your own objects to WebServices.</l>
! * </ul>
! * To actually create and sign your own object use the NamedObjectBuilder or its subclasses. Each subclass of
! * SignedNamedObject should have a corresponding subclass of NamedObjectBuilder.<p>
! * These NamedObjectBuilder objects should be signed using your Signer, before being sent on to a web service.
! *
* @see NamedObjectReader
* @see org.neuclear.id.builders.NamedObjectBuilder
* @see org.neuclear.id.verifier.VerifyingReader
--- 260,269 ----
/**
! * <p>The SignedNamedCore is a non extendible core object used when building SignedNamedObjects.
! * All implementations of SignedNamedObject, must contain this core which implements all the basic features.
! * </p><p>
! * The SignedNamedCore has
* @see NamedObjectReader
+ * @see SignedNamedObject
* @see org.neuclear.id.builders.NamedObjectBuilder
* @see org.neuclear.id.verifier.VerifyingReader
***************
*** 269,273 ****
--- 273,307 ----
*/
public final class SignedNamedCore {
+ /**
+ * SignedNamedCore for use in creating Identities for anonymous keys
+ * @param pub
+ */
+ private SignedNamedCore(final PublicKey pub){
+ this.digest=CryptoTools.formatAsBase36(CryptoTools.digest(pub.getEncoded()));
+ this.name="neu:sha1:"+digest;
+ this.timestamp=System.currentTimeMillis();
+ this.encoded=new String(pub.getEncoded());
+ this.signer = null;//new Identity(this,pub);
+ }
+ /**
+ * SignedNamedCore for creating SignedNamedObjects from Nymous sources
+ * @param pub
+ * @param encoded
+ */
+ private SignedNamedCore(final PublicKey pub, final String encoded){
+ this.signer = new Identity(new SignedNamedCore(pub),pub);
+ this.digest=CryptoTools.formatAsBase36(CryptoTools.digest(encoded.getBytes()));
+ this.name=signer.getName()+"!"+digest;
+ this.timestamp=System.currentTimeMillis();
+ this.encoded=encoded;
+ }
+ /**
+ * SignedNamedCore for normal signed named objects
+ * @param name
+ * @param signer
+ * @param timestamp
+ * @param encoded
+ */
private SignedNamedCore(final String name, final Identity signer, final Timestamp timestamp, final String encoded) {
this.name = name;
***************
*** 275,278 ****
--- 309,322 ----
this.timestamp = timestamp.getTime();
this.encoded = encoded;
+ this.digest=CryptoTools.formatAsBase36(CryptoTools.digest(encoded.getBytes()));
+ }
+
+ private SignedNamedCore() {
+ this.name="neu://";
+ this.signer=null;//new Identity(this,Identity.getRootPK());
+ final byte[] encoded = Identity.getRootPK().getEncoded();
+ this.digest=CryptoTools.formatAsBase36(CryptoTools.digest(encoded));
+ this.timestamp=System.currentTimeMillis();
+ this.encoded=new String(encoded);
}
***************
*** 285,290 ****
*/
public final static SignedNamedCore read(final Element elem) throws InvalidNamedObjectException, NameResolutionException {
! final String name = NSTools.normalizeNameURI(InvalidNamedObjectException.assertAttributeQName(elem,getNameAttrQName()));
try {
final String signatoryName = NSTools.getSignatoryURI(name);
final Identity signatory = NSResolver.resolveIdentity(signatoryName);
--- 329,338 ----
*/
public final static SignedNamedCore read(final Element elem) throws InvalidNamedObjectException, NameResolutionException {
! final String name = getSignatoryName(elem);
try {
+ if (name==null){ // We have an unnamed object
+ return readUnnamed(elem);
+ }
+
final String signatoryName = NSTools.getSignatoryURI(name);
final Identity signatory = NSResolver.resolveIdentity(signatoryName);
***************
*** 299,303 ****
if (XMLSecTools.verifySignature(elem, publicKey)) {
final Timestamp timestamp = TimeTools.parseTimeStamp(InvalidNamedObjectException.assertAttributeQName(elem,createQName("timestamp")));
! return new SignedNamedCore(name, signatory, timestamp, new String(XMLSecTools.canonicalize(elem)));
} else
throw new InvalidNamedObjectException(name);
--- 347,351 ----
if (XMLSecTools.verifySignature(elem, publicKey)) {
final Timestamp timestamp = TimeTools.parseTimeStamp(InvalidNamedObjectException.assertAttributeQName(elem,createQName("timestamp")));
! return new SignedNamedCore(name, signatory, timestamp, encodeElement(elem));
} else
throw new InvalidNamedObjectException(name);
***************
*** 309,312 ****
--- 357,380 ----
}
+ private static String encodeElement(final Element elem) {
+ return new String(XMLSecTools.canonicalize(elem));
+ }
+
+ private static SignedNamedCore readUnnamed(final Element elem) throws XMLSecurityException, InvalidNamedObjectException {
+ final XMLSignature sig=XMLSecTools.getXMLSignature(elem);
+ final PublicKey pub = sig.getSignersKey();
+ if (sig.verifySignature(pub))
+ return new SignedNamedCore(pub,encodeElement(elem));
+ else
+ throw new InvalidNamedObjectException("Unnamed object failed Signature verification");
+ }
+
+ private static String getSignatoryName(final Element elem) throws InvalidNamedObjectException {
+ final String name = elem.attributeValue(getNameAttrQName());
+ if (name==null)
+ return null;
+ return NSTools.normalizeNameURI(name);
+ }
+
/**
* Solely used by RootIdentity
***************
*** 315,319 ****
*/
final static SignedNamedCore createRootCore() {
! return new SignedNamedCore("neu://", null, new Timestamp(0), null);
}
--- 383,387 ----
*/
final static SignedNamedCore createRootCore() {
! return new SignedNamedCore();
}
***************
*** 381,386 ****
}
! public final byte[] getDigest() {
! return CryptoTools.digest(encoded.getBytes());
}
--- 449,454 ----
}
! public final String getDigest() {
! return digest;
}
***************
*** 405,408 ****
--- 473,477 ----
private final long timestamp;
private final String encoded;
+ private final String digest;
Index: SignedNamedObject.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/SignedNamedObject.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** SignedNamedObject.java 20 Dec 2003 00:21:19 -0000 1.15
--- SignedNamedObject.java 8 Jan 2004 23:39:06 -0000 1.16
***************
*** 2,5 ****
--- 2,14 ----
* $Id$
* $Log$
+ * Revision 1.16 2004/01/08 23:39:06 pelle
+ * XMLSignature can now give you the Signing key and the id of the signer.
+ * SignedElement can now self verify using embedded public keys as well as KeyName's
+ * Added NeuclearKeyResolver for resolving public key's from Identity certificates.
+ * SignedNamedObjects can now generate their own name using the following format:
+ * neu:sha1://[sha1 of PublicKey]![sha1 of full signed object]
+ * The resulting object has a special internally generted Identity containing the PublicKey
+ * Identity can now contain nothing but a public key
+ *
* Revision 1.15 2003/12/20 00:21:19 pelle
* overwrote the standard Object.toString(), hashCode() and equals() methods for SignedNamedObject/Core
***************
*** 250,254 ****
* @see org.neuclear.commons.crypto.signers.Signer
*/
! public class SignedNamedObject implements SignedObject {
protected SignedNamedObject(final SignedNamedCore core) {
--- 259,263 ----
* @see org.neuclear.commons.crypto.signers.Signer
*/
! public class SignedNamedObject {
protected SignedNamedObject(final SignedNamedCore core) {
--- SignedObject.java DELETED ---
|
|
From: <pe...@us...> - 2004-01-08 23:38:10
|
Update of /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec
In directory sc8-pr-cvs1:/tmp/cvs-serv8453/src/java/org/neuclear/xml/xmlsec
Modified Files:
KeyInfo.java SignedElement.java XMLSignature.java
Log Message:
XMLSignature can now give you the Signing key and the id of the signer.
SignedElement can now self verify using embedded public keys as well as KeyName's
Added NeuclearKeyResolver for resolving public key's from Identity certificates.
SignedNamedObjects can now generate their own name using the following format:
neu:sha1://[sha1 of PublicKey]![sha1 of full signed object]
The resulting object has a special internally generted Identity containing the PublicKey
Identity can now contain nothing but a public key
Index: KeyInfo.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec/KeyInfo.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** KeyInfo.java 7 Jan 2004 23:11:51 -0000 1.6
--- KeyInfo.java 8 Jan 2004 23:38:06 -0000 1.7
***************
*** 5,8 ****
--- 5,10 ----
import org.dom4j.Element;
import org.neuclear.commons.crypto.CryptoException;
+ import org.neuclear.commons.crypto.Base64;
+ import org.neuclear.commons.crypto.CryptoTools;
import org.neuclear.commons.crypto.keyresolvers.KeyResolverFactory;
***************
*** 89,92 ****
--- 91,116 ----
/**
* Method getPublicKey
+ *
+ * @return
+ * @throws XMLSecurityException
+ */
+ public final String getKeyName()
+ throws XMLSecurityException {
+ if (pub == null) {
+ Iterator iter=getElement().elementIterator();
+ while (iter.hasNext()&&pub==null) {
+ Element element = (Element) iter.next();
+ if(element.getName().equals("KeyName"))
+ return element.getTextTrim();
+ else if(element.getName().equals("X509Data"))
+ return "x509v3:"+Base64.encode(extractX509(element).getSerialNumber());
+ if (element.getName().equals("KeyValue"))
+ return "sha1:"+Base64.encode(CryptoTools.digest(parseKeyValue(element).getEncoded()));
+ }
+ }
+ return null;
+ }
+ /**
+ * Method getPublicKey
*
* @return
***************
*** 114,117 ****
--- 138,144 ----
}
private PublicKey parseX509(final Element element){
+ return extractX509(element).getPublicKey();
+ }
+ private X509Certificate extractX509(final Element element){
Element x509Data=element.element("X509Data");
if (x509Data!=null){
***************
*** 119,124 ****
byte encoded[]=XMLSecTools.decodeBase64Element(x509Data);
CertificateFactory fact=CertificateFactory.getInstance("X509v3");
! Certificate cert=fact.generateCertificate(new ByteArrayInputStream(encoded));
! return cert.getPublicKey();
} catch (XMLSecurityException e) {
return null;
--- 146,151 ----
byte encoded[]=XMLSecTools.decodeBase64Element(x509Data);
CertificateFactory fact=CertificateFactory.getInstance("X509v3");
! X509Certificate cert=(X509Certificate) fact.generateCertificate(new ByteArrayInputStream(encoded));
! return cert;
} catch (XMLSecurityException e) {
return null;
Index: SignedElement.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec/SignedElement.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** SignedElement.java 19 Dec 2003 18:03:07 -0000 1.6
--- SignedElement.java 8 Jan 2004 23:38:06 -0000 1.7
***************
*** 1,4 ****
--- 1,13 ----
/* $Id$
* $Log$
+ * Revision 1.7 2004/01/08 23:38:06 pelle
+ * XMLSignature can now give you the Signing key and the id of the signer.
+ * SignedElement can now self verify using embedded public keys as well as KeyName's
+ * Added NeuclearKeyResolver for resolving public key's from Identity certificates.
+ * SignedNamedObjects can now generate their own name using the following format:
+ * neu:sha1://[sha1 of PublicKey]![sha1 of full signed object]
+ * The resulting object has a special internally generted Identity containing the PublicKey
+ * Identity can now contain nothing but a public key
+ *
* 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:
***************
*** 197,204 ****
* This verifies the signature of the object.
*/
! public final boolean verifySignature(final PublicKey pub) throws XMLSecurityException, CryptoException {
if (sig == null)
throw new XMLSecurityException("The object can not be verified as it doesnt contain a signature");
return sig.verifySignature(pub);
}
--- 206,221 ----
* This verifies the signature of the object.
*/
! public final boolean verifySignature(final PublicKey pub) throws XMLSecurityException {
if (sig == null)
throw new XMLSecurityException("The object can not be verified as it doesnt contain a signature");
return sig.verifySignature(pub);
+ }
+ /**
+ * This verifies the signature of the object.
+ */
+ public final boolean verifySignature() throws XMLSecurityException {
+ if (sig == null)
+ throw new XMLSecurityException("The object can not be verified as it doesnt contain a signature");
+ return sig.verifySignature();
}
Index: XMLSignature.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec/XMLSignature.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** XMLSignature.java 7 Jan 2004 23:11:51 -0000 1.7
--- XMLSignature.java 8 Jan 2004 23:38:06 -0000 1.8
***************
*** 1,4 ****
--- 1,13 ----
/* $Id$
* $Log$
+ * Revision 1.8 2004/01/08 23:38:06 pelle
+ * XMLSignature can now give you the Signing key and the id of the signer.
+ * SignedElement can now self verify using embedded public keys as well as KeyName's
+ * Added NeuclearKeyResolver for resolving public key's from Identity certificates.
+ * SignedNamedObjects can now generate their own name using the following format:
+ * neu:sha1://[sha1 of PublicKey]![sha1 of full signed object]
+ * The resulting object has a special internally generted Identity containing the PublicKey
+ * Identity can now contain nothing but a public key
+ *
* Revision 1.7 2004/01/07 23:11:51 pelle
* XMLSig now has various added features:
***************
*** 250,261 ****
public final boolean verifySignature() throws XMLSecurityException {
! final Element keyInfoElem = getElement().element(XMLSecTools.createQName("KeyInfo"));
! if (keyInfoElem == null)
throw new XMLSecurityException("Signature does not contain an embedded PublicKey");
- final KeyInfo ki = new KeyInfo(keyInfoElem);
- final PublicKey pk = ki.getPublicKey();
return verifySignature(pk);
}
public final boolean verifySignature(final PublicKey pk) throws XMLSecurityException {
--- 259,290 ----
public final boolean verifySignature() throws XMLSecurityException {
! final PublicKey pk = getSignersKey();
! if (pk==null)
throw new XMLSecurityException("Signature does not contain an embedded PublicKey");
return verifySignature(pk);
}
+ public final PublicKey getSignersKey() throws XMLSecurityException {
+ KeyInfo key=getKeyInfo();
+ if (key == null)
+ return null;
+ return key.getPublicKey();
+ }
+ public final String getSignersId() throws XMLSecurityException {
+ KeyInfo key=getKeyInfo();
+ if (key == null)
+ return null;
+ return key.getKeyName();
+ }
+ private final synchronized KeyInfo getKeyInfo() throws XMLSecurityException{
+ if (ki==null){
+ final Element keyInfoElem = getElement().element(XMLSecTools.createQName("KeyInfo"));
+ if (keyInfoElem == null)
+ ki=new KeyInfo(keyInfoElem);
+ }
+ return ki;
+ }
+
+
public final boolean verifySignature(final PublicKey pk) throws XMLSecurityException {
***************
*** 306,309 ****
--- 335,339 ----
private SignatureInfo si;
+ private KeyInfo ki;
private static final String TAG_NAME = "Signature";
// private PublicKey pub;
|
|
From: <pe...@us...> - 2004-01-08 17:15:36
|
Update of /cvsroot/neuclear/neuclear-id/src/schemas
In directory sc8-pr-cvs1:/tmp/cvs-serv14442/src/schemas
Modified Files:
neuid.xsd
Log Message:
Further improving the model. Removing the need for transactions to be members of NamedObject
Index: neuid.xsd
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/schemas/neuid.xsd,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** neuid.xsd 7 Jan 2004 23:12:20 -0000 1.3
--- neuid.xsd 8 Jan 2004 17:15:33 -0000 1.4
***************
*** 3,6 ****
--- 3,9 ----
<!--$Id$
$Log$
+ Revision 1.4 2004/01/08 17:15:33 pelle
+ Further improving the model. Removing the need for transactions to be members of NamedObject
+
Revision 1.3 2004/01/07 23:12:20 pelle
XMLSig now has various added features:
***************
*** 24,28 ****
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
xmlns="http://neuclear.org/neu/neuid.xsd"
! elementFormDefault="qualified" version="0.9" id="id">
<xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"/>
--- 27,33 ----
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
xmlns="http://neuclear.org/neu/neuid.xsd"
! elementFormDefault="qualified"
! attributeFormDefault="qualified"
! version="0.9" id="id">
<xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"/>
***************
*** 46,118 ****
</xs:simpleType>
! <xs:attributeGroup name="NamedObject.attributes" >
! <xs:attribute name="name" type="neuri"/>
! <xs:attribute name="timestamp" type="xs:dateTime" />
! </xs:attributeGroup>
! <xs:complexType name="NamedObjectType">
<xs:sequence>
! <!-- I think we dont need this -->
! <!-- <xs:any namespace="##any"/>-->
! <xs:element name="Targets" type="TargetList"/>
<xs:element ref="ds:Signature" maxOccurs="1" minOccurs="1"/>
</xs:sequence>
! <xs:attributeGroup ref="NamedObject.attributes"/>
! </xs:complexType>
!
! <xs:complexType name="TargetType">
! <xs:attribute name="href" type="xs:anyURI"/>
! <xs:attribute name="type" type="xs:string"/>
! </xs:complexType>
!
! <xs:element name="Target" type= "TargetType"/>
! <xs:complexType name="KeyHolder">
! <xs:sequence>
! <xs:element ref="ds:KeyInfo" maxOccurs="unbounded"/>
! </xs:sequence>
! <xs:attribute name="ns" type="xs:string"/>
! </xs:complexType>
! <xs:attributeGroup name="Identity.attributes">
! <!--
! The Repository for this NameSpace
! -->
! <xs:attribute name="repository" type="xs:anyURI"/>
! <!--
! The Receiver for this NameSpace
! -->
! <xs:attribute name="receiver" type="xs:anyURI"/>
! <!--
! The store for this NameSpace
! -->
! <xs:attribute name="store" type="xs:anyURI"/>
! <!-- The interactive signer for this NameSpace.
! If Empty the NameSpace doesn't allow interactive signing.
! -->
! <xs:attribute name="signer" type="xs:anyURI"/>
! <!--
! The Logging Service for this NameSpace
! -->
! <xs:attribute name="logger" type="xs:anyURI"/>
! </xs:attributeGroup>
! <xs:complexType name="IdentityType">
! <xs:complexContent>
! <xs:extension base="NamedObjectType">
! <xs:sequence>
! <xs:element name="Allow" type="KeyHolder" maxOccurs="unbounded"/>
! </xs:sequence>
! <xs:attributeGroup ref="Identity.attributes"/>
! </xs:extension>
! </xs:complexContent>
! </xs:complexType>
<xs:element name="Identity" type="IdentityType"/>
! <xs:complexType name="TargetList">
<xs:sequence>
! <xs:element ref="Target" maxOccurs="unbounded"/>
</xs:sequence>
! </xs:complexType>
</xs:schema>
--- 51,97 ----
</xs:simpleType>
! <xs:element name="TimeStamp" type="xs:dateTime"/>
! <xs:group name="SignedObjectGroup">
<xs:sequence>
! <xs:element ref="TimeStamp" minOccurs="0" maxOccurs="1"/>
<xs:element ref="ds:Signature" maxOccurs="1" minOccurs="1"/>
</xs:sequence>
! </xs:group>
! <xs:element name="Allow">
! <xs:complexType>
! <xs:sequence>
! <xs:element ref="ds:KeyInfo" maxOccurs="1" minOccurs="1"/>
! </xs:sequence>
! </xs:complexType>
! </xs:element>
! <xs:element name="Repository" type="xs:anyURI" nillable="false"/>
<xs:element name="Identity" type="IdentityType"/>
! <xs:element name="Target">
! <xs:complexType>
! <xs:attribute name="href" type="xs:anyURI"/>
! <xs:attribute name="type" type="xs:string"/>
! </xs:complexType>
! </xs:element>
!
! <xs:element name="TargetList">
! <xs:complexType>
! <xs:sequence>
! <xs:element ref="Target" maxOccurs="unbounded"/>
! </xs:sequence>
! </xs:complexType>
! </xs:element>
!
! <xs:complexType name="IdentityType">
<xs:sequence>
! <xs:element ref="Repository" minOccurs="0" maxOccurs="1"/>
! <xs:element ref="Allow" minOccurs="1" maxOccurs="1"/>
! <xs:group ref="SignedObjectGroup"/>
</xs:sequence>
! </xs:complexType>
</xs:schema>
|
|
From: <pe...@us...> - 2004-01-08 17:15:31
|
Update of /cvsroot/neuclear/neuclear-pay/src/schemas
In directory sc8-pr-cvs1:/tmp/cvs-serv14382/src/schemas
Modified Files:
xfer.xsd
Log Message:
Further improving the model. Removing the need for transactions to be members of NamedObject
Index: xfer.xsd
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/schemas/xfer.xsd,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** xfer.xsd 7 Jan 2004 23:11:06 -0000 1.4
--- xfer.xsd 8 Jan 2004 17:15:28 -0000 1.5
***************
*** 3,6 ****
--- 3,9 ----
$Id$
$Log$
+ Revision 1.5 2004/01/08 17:15:28 pelle
+ Further improving the model. Removing the need for transactions to be members of NamedObject
+
Revision 1.4 2004/01/07 23:11:06 pelle
XMLSig now has various added features:
***************
*** 48,51 ****
--- 51,55 ----
</xs:simpleType>
</xs:element>
+
<xs:element name="TransferOrder" nillable="false">
<xs:complexType>
***************
*** 62,65 ****
--- 66,70 ----
</xs:complexType>
</xs:element>
+
<xs:element name="TransferReceipt" nillable="false">
<xs:complexType >
|
|
From: <pe...@us...> - 2004-01-07 23:12:25
|
Update of /cvsroot/neuclear/neuclear-id/src/schemas In directory sc8-pr-cvs1:/tmp/cvs-serv16630/src/schemas Modified Files: neuid.xsd Log Message: XMLSig now has various added features: - KeyInfo supports X509v3 (untested) - KeyInfo supports KeyName - When creating a XMLSignature and signing it with a Signer, it adds the alias to the KeyName Added KeyResolver interface and KeyResolverFactory Class. At the moment no implementations. Index: neuid.xsd =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/schemas/neuid.xsd,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** neuid.xsd 7 Jan 2004 16:16:02 -0000 1.2 --- neuid.xsd 7 Jan 2004 23:12:20 -0000 1.3 *************** *** 3,6 **** --- 3,13 ---- <!--$Id$ $Log$ + Revision 1.3 2004/01/07 23:12:20 pelle + XMLSig now has various added features: + - KeyInfo supports X509v3 (untested) + - KeyInfo supports KeyName + - When creating a XMLSignature and signing it with a Signer, it adds the alias to the KeyName + Added KeyResolver interface and KeyResolverFactory Class. At the moment no implementations. + Revision 1.2 2004/01/07 16:16:02 pelle I have updated all the current schemas, cleaned out the defunct ones and "completed" *************** *** 12,21 **** --> ! <xs:schema targetNamespace="http://neuclear.org/neu/neuid.xsd" xmlns:nsdl="http://neuclear.org/neu/neuid.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" ! xmlns="http://neuclear.org/neu/neuid.xsd" elementFormDefault="qualified" version="0.9" id="neuid"> ! <xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"/> <xs:simpleType name="sha1"> --- 19,30 ---- --> ! <xs:schema targetNamespace="http://neuclear.org/neu/neuid.xsd" ! xmlns:id="http://neuclear.org/neu/neuid.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" ! xmlns="http://neuclear.org/neu/neuid.xsd" ! elementFormDefault="qualified" version="0.9" id="id"> + <xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"/> <xs:simpleType name="sha1"> *************** *** 25,38 **** </xs:restriction> </xs:simpleType> <xs:simpleType name="neuri"> <xs:restriction base="xs:string"> ! <xs:pattern value="^neu:([\w]{1,6}:)?//(([\w][\w.-]*)@)?[\w]([\w.-]*[\w])?(/[\w][\w-]*)*(![\w][\w.-]*)?$"/> <xs:whiteSpace value="collapse"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="NamedObjectReference"> <xs:union memberTypes="neuri sha1"/> </xs:simpleType> <xs:complexType name="NamedObjectType"> <xs:sequence> --- 34,54 ---- </xs:restriction> </xs:simpleType> + <xs:simpleType name="neuri"> <xs:restriction base="xs:string"> ! <xs:pattern value="neu:([\w]{1,6}:)?//(([\w][\w.-]*)@)?[\w]([\w.-]*[\w])?(/[\w][\w-]*)*(![\w][\w.-]*)?"/> <xs:whiteSpace value="collapse"/> </xs:restriction> </xs:simpleType> + <xs:simpleType name="NamedObjectReference"> <xs:union memberTypes="neuri sha1"/> </xs:simpleType> + <xs:attributeGroup name="NamedObject.attributes" > + <xs:attribute name="name" type="neuri"/> + <xs:attribute name="timestamp" type="xs:dateTime" /> + </xs:attributeGroup> + <xs:complexType name="NamedObjectType"> <xs:sequence> *************** *** 42,47 **** <xs:element ref="ds:Signature" maxOccurs="1" minOccurs="1"/> </xs:sequence> ! <xs:attribute name="name" type="neuri"/> ! <xs:attribute name="timestamp" type="xs:dateTime" /> </xs:complexType> --- 58,62 ---- <xs:element ref="ds:Signature" maxOccurs="1" minOccurs="1"/> </xs:sequence> ! <xs:attributeGroup ref="NamedObject.attributes"/> </xs:complexType> *************** *** 50,53 **** --- 65,69 ---- <xs:attribute name="type" type="xs:string"/> </xs:complexType> + <xs:element name="Target" type= "TargetType"/> <xs:complexType name="KeyHolder"> *************** *** 58,61 **** --- 74,100 ---- </xs:complexType> + <xs:attributeGroup name="Identity.attributes"> + <!-- + The Repository for this NameSpace + --> + <xs:attribute name="repository" type="xs:anyURI"/> + <!-- + The Receiver for this NameSpace + --> + <xs:attribute name="receiver" type="xs:anyURI"/> + <!-- + The store for this NameSpace + --> + <xs:attribute name="store" type="xs:anyURI"/> + <!-- The interactive signer for this NameSpace. + If Empty the NameSpace doesn't allow interactive signing. + --> + <xs:attribute name="signer" type="xs:anyURI"/> + <!-- + The Logging Service for this NameSpace + --> + <xs:attribute name="logger" type="xs:anyURI"/> + </xs:attributeGroup> + <xs:complexType name="IdentityType"> <xs:complexContent> *************** *** 64,91 **** <xs:element name="Allow" type="KeyHolder" maxOccurs="unbounded"/> </xs:sequence> ! <!-- ! Default WebServices for this namespace. These can be specified using either HTTP to a SOAP web port or ! given a neu://etc/etc... URI they can read the definition from a public definition. ! --> ! <!-- ! The Repository for this NameSpace ! --> ! <xs:attribute name="repository" type="xs:anyURI"/> ! <!-- ! The Receiver for this NameSpace ! --> ! <xs:attribute name="receiver" type="xs:anyURI"/> ! <!-- ! The store for this NameSpace ! --> ! <xs:attribute name="store" type="xs:anyURI"/> ! <!-- The interactive signer for this NameSpace. ! If Empty the NameSpace doesn't allow interactive signing. ! --> ! <xs:attribute name="signer" type="xs:anyURI"/> ! <!-- ! The Logging Service for this NameSpace ! --> ! <xs:attribute name="logger" type="xs:anyURI"/> </xs:extension> </xs:complexContent> --- 103,107 ---- <xs:element name="Allow" type="KeyHolder" maxOccurs="unbounded"/> </xs:sequence> ! <xs:attributeGroup ref="Identity.attributes"/> </xs:extension> </xs:complexContent> |
|
From: <pe...@us...> - 2004-01-07 23:12:23
|
Update of /cvsroot/neuclear/neuclear-id/src/samples In directory sc8-pr-cvs1:/tmp/cvs-serv16630/src/samples Added Files: identity.xml Log Message: XMLSig now has various added features: - KeyInfo supports X509v3 (untested) - KeyInfo supports KeyName - When creating a XMLSignature and signing it with a Signer, it adds the alias to the KeyName Added KeyResolver interface and KeyResolverFactory Class. At the moment no implementations. --- NEW FILE: identity.xml --- <neuid:Identity xmlns:neuid="http://neuclear.org/neu/neuid.xsd" neuid:logger="mailto:pe...@ne..." neuid:name="neu://neuclear.org" neuid:receiver="mailto:pe...@ne..." neuid:repository="http://neuclear.org/_NEUID" neuid:signer="http://localhost:11870/Signer" neuid:timestamp="2003-12-08T13:12:12,330EST"><neuid:Allow><ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><ds:KeyValue><ds:RSAKeyValue><ds:Modulus> wcTYVm28j9LQCLLrA/Bia9Uo71WIuMroXFqBKwcv3VZXQ3z4fQX+NPJ6coSumCQ/GN5qKc4fUVbj5W291Pa5Fu8wNt/9F3uN22Roxv5ld0uykiig4JbRirhyuH1Da20WtUMEOx3ubAnhmGEe7k11JK1gTxE5MINuZYCD4nxRbJk= </ds:Modulus><ds:Exponent> AQAB </ds:Exponent></ds:RSAKeyValue></ds:KeyValue></ds:KeyInfo></neuid:Allow> <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <ds:SignedInfo> <ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></ds:CanonicalizationMethod> <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></ds:SignatureMethod><ds:Reference URI=""><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></ds:Transform></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></ds:DigestMethod><ds:DigestValue> BvVo1UYoqSHsVFZIc4wbcGC9Lzk= </ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue> rV8eY40n3pmW3zHIFUx3NkEci9R18gKSaM/PilGb61OtO7M1lbXxirmJMxgMhVVKOfunBaUFELte/P+V1tXsOc3nVILGPEcbroxR9vxr+icljD7Y6g8XQJbCW5Vs6iMHmHfab3BOAUjNEk6zNePOzLNfANXVJCDQ/6C4G4LyU3k= </ds:SignatureValue></ds:Signature></neuid:Identity> |
|
From: <pe...@us...> - 2004-01-07 23:12:23
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id
In directory sc8-pr-cvs1:/tmp/cvs-serv16630/src/java/org/neuclear/id
Modified Files:
Identity.java NSTools.java
Log Message:
XMLSig now has various added features:
- KeyInfo supports X509v3 (untested)
- KeyInfo supports KeyName
- When creating a XMLSignature and signing it with a Signer, it adds the alias to the KeyName
Added KeyResolver interface and KeyResolverFactory Class. At the moment no implementations.
Index: Identity.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/Identity.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** Identity.java 19 Dec 2003 18:03:34 -0000 1.26
--- Identity.java 7 Jan 2004 23:12:20 -0000 1.27
***************
*** 2,5 ****
--- 2,12 ----
* $Id$
* $Log$
+ * Revision 1.27 2004/01/07 23:12:20 pelle
+ * XMLSig now has various added features:
+ * - KeyInfo supports X509v3 (untested)
+ * - KeyInfo supports KeyName
+ * - When creating a XMLSignature and signing it with a Signer, it adds the alias to the KeyName
+ * Added KeyResolver interface and KeyResolverFactory Class. At the moment no implementations.
+ *
* Revision 1.26 2003/12/19 18:03:34 pelle
* Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
***************
*** 504,508 ****
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")));
--- 511,515 ----
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")));
Index: NSTools.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/NSTools.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** NSTools.java 19 Dec 2003 18:03:34 -0000 1.24
--- NSTools.java 7 Jan 2004 23:12:20 -0000 1.25
***************
*** 2,5 ****
--- 2,12 ----
* $Id$
* $Log$
+ * Revision 1.25 2004/01/07 23:12:20 pelle
+ * XMLSig now has various added features:
+ * - KeyInfo supports X509v3 (untested)
+ * - KeyInfo supports KeyName
+ * - When creating a XMLSignature and signing it with a Signer, it adds the alias to the KeyName
+ * Added KeyResolver interface and KeyResolverFactory Class. At the moment no implementations.
+ *
* Revision 1.24 2003/12/19 18:03:34 pelle
* Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
***************
*** 443,449 ****
private static final String NEUID_URI = "http://neuclear.org/neu/neuid";
! public static final Namespace NS_NEUID = DocumentHelper.createNamespace("neuid", NEUID_URI);
!
! public static final String NEUID_PREFIX = "neuid:";
private static final String SCHEME_PREFIX = "([\\w]{1,6}:)?";
--- 450,455 ----
private static final String NEUID_URI = "http://neuclear.org/neu/neuid";
! public static final String NEUID_PREFIX = "id";
! public static final Namespace NS_NEUID = DocumentHelper.createNamespace(NEUID_PREFIX, NEUID_URI);
private static final String SCHEME_PREFIX = "([\\w]{1,6}:)?";
|
|
From: <pe...@us...> - 2004-01-07 23:12:23
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders
In directory sc8-pr-cvs1:/tmp/cvs-serv16630/src/java/org/neuclear/id/builders
Modified Files:
IdentityBuilder.java
Log Message:
XMLSig now has various added features:
- KeyInfo supports X509v3 (untested)
- KeyInfo supports KeyName
- When creating a XMLSignature and signing it with a Signer, it adds the alias to the KeyName
Added KeyResolver interface and KeyResolverFactory Class. At the moment no implementations.
Index: IdentityBuilder.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders/IdentityBuilder.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** IdentityBuilder.java 19 Dec 2003 18:03:34 -0000 1.16
--- IdentityBuilder.java 7 Jan 2004 23:12:20 -0000 1.17
***************
*** 2,5 ****
--- 2,12 ----
* $Id$
* $Log$
+ * Revision 1.17 2004/01/07 23:12:20 pelle
+ * XMLSig now has various added features:
+ * - KeyInfo supports X509v3 (untested)
+ * - KeyInfo supports KeyName
+ * - When creating a XMLSignature and signing it with a Signer, it adds the alias to the KeyName
+ * Added KeyResolver interface and KeyResolverFactory Class. At the moment no implementations.
+ *
* 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:
***************
*** 280,284 ****
private void setPublicKey(final PublicKey allow) {
if (allow != null) {
! final QName allowName = DocumentHelper.createQName("allow", NSTools.NS_NEUID);
Element pub=getElement().element(allowName);
if (pub==null)
--- 287,291 ----
private void setPublicKey(final PublicKey allow) {
if (allow != null) {
! final QName allowName = DocumentHelper.createQName("Allow", NSTools.NS_NEUID);
Element pub=getElement().element(allowName);
if (pub==null)
|
|
From: <pe...@us...> - 2004-01-07 23:11:54
|
Update of /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec
In directory sc8-pr-cvs1:/tmp/cvs-serv16526/src/java/org/neuclear/xml/xmlsec
Modified Files:
KeyInfo.java QuickEmbeddedSignature.java XMLSignature.java
Log Message:
XMLSig now has various added features:
- KeyInfo supports X509v3 (untested)
- KeyInfo supports KeyName
- When creating a XMLSignature and signing it with a Signer, it adds the alias to the KeyName
Added KeyResolver interface and KeyResolverFactory Class. At the moment no implementations.
Index: KeyInfo.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec/KeyInfo.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** KeyInfo.java 19 Dec 2003 18:03:07 -0000 1.5
--- KeyInfo.java 7 Jan 2004 23:11:51 -0000 1.6
***************
*** 5,12 ****
--- 5,18 ----
import org.dom4j.Element;
import org.neuclear.commons.crypto.CryptoException;
+ import org.neuclear.commons.crypto.keyresolvers.KeyResolverFactory;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PublicKey;
+ import java.security.cert.Certificate;
+ import java.security.cert.X509Certificate;
+ import java.security.cert.CertificateEncodingException;
+ import java.security.cert.CertificateFactory;
+ import java.security.cert.CertificateException;
import java.security.interfaces.DSAParams;
import java.security.interfaces.DSAPublicKey;
***************
*** 15,18 ****
--- 21,26 ----
import java.security.spec.InvalidKeySpecException;
import java.security.spec.RSAPublicKeySpec;
+ import java.util.Iterator;
+ import java.io.ByteArrayInputStream;
public final class KeyInfo extends AbstractXMLSigElement {
***************
*** 59,62 ****
--- 67,83 ----
}
}
+ public KeyInfo(final String name) {
+ super(TAG_NAME);
+ final Element kv = XMLSecTools.createElementInSignatureSpace("KeyName");
+ kv.addText(name);
+ addElement(kv);
+ }
+
+ public KeyInfo(final X509Certificate cert) throws CertificateEncodingException {
+ super(TAG_NAME);
+ final Element kv = XMLSecTools.createElementInSignatureSpace("X509Data");
+ kv.add(XMLSecTools.base64ToElement("X509Certificate",cert.getEncoded()));
+ addElement(kv);
+ }
public KeyInfo(final Element elem) throws XMLSecurityException {
***************
*** 75,127 ****
throws XMLSecurityException {
if (pub == null) {
try {
! final KeyFactory keyFactory;
!
! final Element kvElement = getElement().element(XMLSecTools.createQName("KeyValue"));
! if (kvElement == null)
! throw new XMLSecurityException("KeyInfo doesn't contains a KeyValue element.");
!
! Element algElement = kvElement.element(XMLSecTools.createQName("RSAKeyValue"));
! if (algElement == null) {
! algElement = kvElement.element(XMLSecTools.createQName("DSAKeyValue"));
! if (algElement == null)
! throw new XMLSecurityException("KeyInfo doesn't contains a [DSA|RSA]KeyValue element. " +
! "Sorry, we currently only support RSA and DSA keys");
! }
! if (algElement.getName().equalsIgnoreCase("RSAKeyValue")) {
! keyFactory = KeyFactory.getInstance("RSA");
! final Element mod = algElement.element(XMLSecTools.createQName("Modulus"));
! final Element exp = algElement.element(XMLSecTools.createQName("Exponent"));
! if ((mod == null) || (exp == null))
! throw new XMLSecurityException("KeyInfo Didn't contain a valid RSA Key");
! final RSAPublicKeySpec rsaKeyspec =
! new RSAPublicKeySpec(XMLSecTools.decodeBigIntegerFromElement(mod), XMLSecTools.decodeBigIntegerFromElement(exp));
! final PublicKey pk = keyFactory.generatePublic(rsaKeyspec);
! pub = pk;
! } else if (algElement.getName().equalsIgnoreCase("DSAKeyValue")) {
! keyFactory = KeyFactory.getInstance("DSA");
! final Element p = algElement.element(XMLSecTools.createQName("P"));
! final Element q = algElement.element(XMLSecTools.createQName("Q"));
! final Element g = algElement.element(XMLSecTools.createQName("G"));
! final Element y = algElement.element(XMLSecTools.createQName("Y"));
! if (p == null || q == null || g == null || y == null)
! throw new XMLSecurityException("KeyInfo didn't contain a valid DSA Key");
! final DSAPublicKeySpec dsaPublicKeySpec = new DSAPublicKeySpec(XMLSecTools.decodeBigIntegerFromElement(y),
! XMLSecTools.decodeBigIntegerFromElement(p),
! XMLSecTools.decodeBigIntegerFromElement(q),
! XMLSecTools.decodeBigIntegerFromElement(g));
! final PublicKey pk = keyFactory.generatePublic(dsaPublicKeySpec);
! pub = pk;
! }
! } catch (NoSuchAlgorithmException ex) {
! XMLSecTools.rethrowException(ex);
! } catch (InvalidKeySpecException ex) {
! XMLSecTools.rethrowException(ex);
}
}
! return pub;
}
--- 96,175 ----
throws XMLSecurityException {
if (pub == null) {
+ Iterator iter=getElement().elementIterator();
+ while (iter.hasNext()&&pub==null) {
+ Element element = (Element) iter.next();
+ if (element.getName().equals("KeyValue"))
+ pub=parseKeyValue(element);
+ else if(element.getName().equals("KeyName"))
+ pub=parseKeyName(element);
+ else if(element.getName().equals("X509Data"))
+ pub=parseX509(element);
+ }
+ }
+ return pub;
+ }
+ private PublicKey parseKeyName(final Element element){
+ final String name=element.getTextTrim();
+ return KeyResolverFactory.getInstance().resolve(name);
+ }
+ private PublicKey parseX509(final Element element){
+ Element x509Data=element.element("X509Data");
+ if (x509Data!=null){
try {
! byte encoded[]=XMLSecTools.decodeBase64Element(x509Data);
! CertificateFactory fact=CertificateFactory.getInstance("X509v3");
! Certificate cert=fact.generateCertificate(new ByteArrayInputStream(encoded));
! return cert.getPublicKey();
! } catch (XMLSecurityException e) {
! return null;
! } catch (CertificateException e) {
! return null;
! }
! }
! return null;
! }
! private PublicKey parseKeyValue(final Element kvElement) throws XMLSecurityException {
! try {
! final KeyFactory keyFactory;
! Element algElement = kvElement.element(XMLSecTools.createQName("RSAKeyValue"));
! if (algElement == null) {
! algElement = kvElement.element(XMLSecTools.createQName("DSAKeyValue"));
! if (algElement == null)
! throw new XMLSecurityException("KeyInfo doesn't contains a [DSA|RSA]KeyValue element. " +
! "Sorry, we currently only support RSA and DSA keys");
! }
! if (algElement.getName().equalsIgnoreCase("RSAKeyValue")) {
! keyFactory = KeyFactory.getInstance("RSA");
! final Element mod = algElement.element(XMLSecTools.createQName("Modulus"));
! final Element exp = algElement.element(XMLSecTools.createQName("Exponent"));
! if ((mod == null) || (exp == null))
! throw new XMLSecurityException("KeyInfo Didn't contain a valid RSA Key");
! final RSAPublicKeySpec rsaKeyspec =
! new RSAPublicKeySpec(XMLSecTools.decodeBigIntegerFromElement(mod), XMLSecTools.decodeBigIntegerFromElement(exp));
! final PublicKey pk = keyFactory.generatePublic(rsaKeyspec);
! return pk;
! } else if (algElement.getName().equalsIgnoreCase("DSAKeyValue")) {
! keyFactory = KeyFactory.getInstance("DSA");
! final Element p = algElement.element(XMLSecTools.createQName("P"));
! final Element q = algElement.element(XMLSecTools.createQName("Q"));
! final Element g = algElement.element(XMLSecTools.createQName("G"));
! final Element y = algElement.element(XMLSecTools.createQName("Y"));
! if (p == null || q == null || g == null || y == null)
! throw new XMLSecurityException("KeyInfo didn't contain a valid DSA Key");
! final DSAPublicKeySpec dsaPublicKeySpec = new DSAPublicKeySpec(XMLSecTools.decodeBigIntegerFromElement(y),
! XMLSecTools.decodeBigIntegerFromElement(p),
! XMLSecTools.decodeBigIntegerFromElement(q),
! XMLSecTools.decodeBigIntegerFromElement(g));
! return keyFactory.generatePublic(dsaPublicKeySpec);
}
+ } catch (NoSuchAlgorithmException ex) {
+ XMLSecTools.rethrowException(ex);
+ } catch (InvalidKeySpecException ex) {
+ XMLSecTools.rethrowException(ex);
}
! return null;
}
Index: QuickEmbeddedSignature.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec/QuickEmbeddedSignature.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** QuickEmbeddedSignature.java 19 Dec 2003 18:03:07 -0000 1.4
--- QuickEmbeddedSignature.java 7 Jan 2004 23:11:51 -0000 1.5
***************
*** 8,11 ****
--- 8,18 ----
* $Id$
* $Log$
+ * Revision 1.5 2004/01/07 23:11:51 pelle
+ * XMLSig now has various added features:
+ * - KeyInfo supports X509v3 (untested)
+ * - KeyInfo supports KeyName
+ * - When creating a XMLSignature and signing it with a Signer, it adds the alias to the KeyName
+ * Added KeyResolver interface and KeyResolverFactory Class. At the moment no implementations.
+ *
* 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:
***************
*** 145,148 ****
--- 152,156 ----
super(getSignatureElement(root,signer.getKeyType(name)));
final Element sig = getElement();
+ addElement(new KeyInfo(name)); // Add the signers name
getSi().getReference().setDigest();
***************
*** 195,218 ****
private static Element SIGNATURETEMPLATE;
! private static final String SIGNATURETEMPLATE_TEXT = "<ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">" +
! "<ds:SignedInfo>" +
! "<ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"/>" +
! "<ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"/>" +
! "<ds:Reference URI=\"\">" +
! "<ds:Transforms><ds:Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\"/>" +
! "</ds:Transforms><ds:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/>" +
! "</ds:Reference>" +
! "</ds:SignedInfo></ds:Signature>";
private static Element DSASIGNATURETEMPLATE;
! private static final String DSASIGNATURETEMPLATE_TEXT = "<ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">" +
! "<ds:SignedInfo>" +
! "<ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"/>" +
! "<ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#dsa-sha1\"/>" +
! "<ds:Reference URI=\"\">" +
! "<ds:Transforms><ds:Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\"/>" +
! "</ds:Transforms><ds:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/>" +
! "</ds:Reference>" +
! "</ds:SignedInfo></ds:Signature>";
--- 203,226 ----
private static Element SIGNATURETEMPLATE;
! private static final String SIGNATURETEMPLATE_TEXT = "\n<ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">" +
! "\n<ds:SignedInfo>" +
! "\n<ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"/>" +
! "\n<ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"/>" +
! "\n<ds:Reference URI=\"\">" +
! "\n<ds:Transforms><ds:Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\"/>" +
! "\n</ds:Transforms><ds:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/>" +
! "\n</ds:Reference>" +
! "\n</ds:SignedInfo>\n</ds:Signature>";
private static Element DSASIGNATURETEMPLATE;
! private static final String DSASIGNATURETEMPLATE_TEXT = "\n<ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">" +
! "\n<ds:SignedInfo>" +
! "\n<ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"/>" +
! "\n<ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#dsa-sha1\"/>" +
! "\n<ds:Reference URI=\"\">" +
! "\n<ds:Transforms><ds:Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\"/>" +
! "\n</ds:Transforms><ds:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/>" +
! "\n</ds:Reference>" +
! "\n</ds:SignedInfo>\n</ds:Signature>";
Index: XMLSignature.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec/XMLSignature.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** XMLSignature.java 19 Dec 2003 18:03:07 -0000 1.6
--- XMLSignature.java 7 Jan 2004 23:11:51 -0000 1.7
***************
*** 1,4 ****
--- 1,11 ----
/* $Id$
* $Log$
+ * Revision 1.7 2004/01/07 23:11:51 pelle
+ * XMLSig now has various added features:
+ * - KeyInfo supports X509v3 (untested)
+ * - KeyInfo supports KeyName
+ * - When creating a XMLSignature and signing it with a Signer, it adds the alias to the KeyName
+ * Added KeyResolver interface and KeyResolverFactory Class. At the moment no implementations.
+ *
* 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:
***************
*** 167,182 ****
*/
public class XMLSignature extends AbstractXMLSigElement {
- /**
- * Creates an Enveloped (Embedded) Signature object based on the given element root
- *
- * @param key
- * @param root
- * @param uri
- * @throws XMLSecurityException
- */
- public XMLSignature(final PrivateKey key, final Element root, final String uri) throws XMLSecurityException, CryptoException {
- this(key, null, root, uri);
- }
-
/**
* Creates an Enveloped (Embedded) Signature object based on the given element root
--- 174,177 ----
|
|
From: <pe...@us...> - 2004-01-07 23:11:30
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/keyresolvers
In directory sc8-pr-cvs1:/tmp/cvs-serv16427/src/java/org/neuclear/commons/crypto/keyresolvers
Added Files:
KeyResolver.java KeyResolverFactory.java
Log Message:
XMLSig now has various added features:
- KeyInfo supports X509v3 (untested)
- KeyInfo supports KeyName
- When creating a XMLSignature and signing it with a Signer, it adds the alias to the KeyName
Added KeyResolver interface and KeyResolverFactory Class. At the moment no implementations.
--- NEW FILE: KeyResolver.java ---
package org.neuclear.commons.crypto.keyresolvers;
import java.security.PublicKey;
/*
NeuClear Distributed Transaction Clearing Platform
(C) 2003 Pelle Braendgaard
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
$Id: KeyResolver.java,v 1.1 2004/01/07 23:11:27 pelle Exp $
$Log: KeyResolver.java,v $
Revision 1.1 2004/01/07 23:11:27 pelle
XMLSig now has various added features:
- KeyInfo supports X509v3 (untested)
- KeyInfo supports KeyName
- When creating a XMLSignature and signing it with a Signer, it adds the alias to the KeyName
Added KeyResolver interface and KeyResolverFactory Class. At the moment no implementations.
*/
/**
* User: pelleb
* Date: Jan 7, 2004
* Time: 10:01:23 PM
*/
public interface KeyResolver {
PublicKey resolve(String name);
}
--- NEW FILE: KeyResolverFactory.java ---
package org.neuclear.commons.crypto.keyresolvers;
import org.neuclear.commons.Utility;
/*
NeuClear Distributed Transaction Clearing Platform
(C) 2003 Pelle Braendgaard
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
$Id: KeyResolverFactory.java,v 1.1 2004/01/07 23:11:27 pelle Exp $
$Log: KeyResolverFactory.java,v $
Revision 1.1 2004/01/07 23:11:27 pelle
XMLSig now has various added features:
- KeyInfo supports X509v3 (untested)
- KeyInfo supports KeyName
- When creating a XMLSignature and signing it with a Signer, it adds the alias to the KeyName
Added KeyResolver interface and KeyResolverFactory Class. At the moment no implementations.
*/
/**
* User: pelleb
* Date: Jan 7, 2004
* Time: 9:56:57 PM
*/
public class KeyResolverFactory {
public synchronized final static KeyResolver getInstance(){
if (instance==null){
String impl=System.getProperty("org.neuclear.commons.crypto.keyresolvers.default");
if (Utility.isEmpty(impl))
impl=DEFAULT;
try {
instance = (KeyResolver) Class.forName(impl).newInstance();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
return instance;
}
public final static String DEFAULT="org.neuclear.commons.crypto.keyresolvers.Sha1Resolver";
private static KeyResolver instance;
}
|
|
From: <pe...@us...> - 2004-01-07 23:11:09
|
Update of /cvsroot/neuclear/neuclear-pay/src/schemas
In directory sc8-pr-cvs1:/tmp/cvs-serv16302/src/schemas
Modified Files:
xfer.xsd
Log Message:
XMLSig now has various added features:
- KeyInfo supports X509v3 (untested)
- KeyInfo supports KeyName
- When creating a XMLSignature and signing it with a Signer, it adds the alias to the KeyName
Added KeyResolver interface and KeyResolverFactory Class. At the moment no implementations.
Index: xfer.xsd
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/schemas/xfer.xsd,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** xfer.xsd 7 Jan 2004 17:15:57 -0000 1.3
--- xfer.xsd 7 Jan 2004 23:11:06 -0000 1.4
***************
*** 3,6 ****
--- 3,13 ----
$Id$
$Log$
+ Revision 1.4 2004/01/07 23:11:06 pelle
+ XMLSig now has various added features:
+ - KeyInfo supports X509v3 (untested)
+ - KeyInfo supports KeyName
+ - When creating a XMLSignature and signing it with a Signer, it adds the alias to the KeyName
+ Added KeyResolver interface and KeyResolverFactory Class. At the moment no implementations.
+
Revision 1.3 2004/01/07 17:15:57 pelle
Added support for non fungible transfers. Ie. Transfers of specific serial numbered items.
***************
*** 55,59 ****
</xs:complexType>
</xs:element>
-
<xs:element name="TransferReceipt" nillable="false">
<xs:complexType >
--- 62,65 ----
|
|
From: <pe...@us...> - 2004-01-07 21:56:18
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/keyresolvers In directory sc8-pr-cvs1:/tmp/cvs-serv29098/src/java/org/neuclear/commons/crypto/keyresolvers Log Message: Directory /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/keyresolvers added to the repository |
|
From: <pe...@us...> - 2004-01-07 17:16:00
|
Update of /cvsroot/neuclear/neuclear-pay/src/schemas
In directory sc8-pr-cvs1:/tmp/cvs-serv29889/src/schemas
Modified Files:
exch.xsd xfer.xsd
Log Message:
Added support for non fungible transfers. Ie. Transfers of specific serial numbered items.
This is implement through the abstract element Value, which contains the two implementing tags:
Amount and SerialNumbers.
I have also implemented standard types for most fields such as comments and ValueTime.
Index: exch.xsd
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/schemas/exch.xsd,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** exch.xsd 7 Jan 2004 16:15:50 -0000 1.2
--- exch.xsd 7 Jan 2004 17:15:57 -0000 1.3
***************
*** 3,6 ****
--- 3,12 ----
$Id$
$Log$
+ Revision 1.3 2004/01/07 17:15:57 pelle
+ Added support for non fungible transfers. Ie. Transfers of specific serial numbered items.
+ This is implement through the abstract element Value, which contains the two implementing tags:
+ Amount and SerialNumbers.
+ I have also implemented standard types for most fields such as comments and ValueTime.
+
Revision 1.2 2004/01/07 16:15:50 pelle
I have updated all the current schemas, cleaned out the defunct ones and "completed"
***************
*** 38,43 ****
<xs:element ref="SettlementAsset" minOccurs="1" maxOccurs="1" />
<xs:element ref="BidAsset" minOccurs="1" maxOccurs="1" />
! <xs:element name="Amount" type="xs:double" minOccurs="1" maxOccurs="1" nillable="false" />
! <xs:element name="Comment" type="xs:string" minOccurs="0" maxOccurs="1" nillable="true" />
<xs:element name="expires" type="xs:dateTime" minOccurs="1" maxOccurs="1" nillable="false"/>
</xs:sequence>
--- 44,49 ----
<xs:element ref="SettlementAsset" minOccurs="1" maxOccurs="1" />
<xs:element ref="BidAsset" minOccurs="1" maxOccurs="1" />
! <xs:element ref="xfer:Value" minOccurs="1" maxOccurs="1"/>
! <xs:element ref="xfer:Comment" minOccurs="0" maxOccurs="1" />
<xs:element name="expires" type="xs:dateTime" minOccurs="1" maxOccurs="1" nillable="false"/>
</xs:sequence>
***************
*** 64,71 ****
<xs:extension base="ExchangeOrderActionType">
<xs:sequence>
! <xs:element name="Amount" type="xs:double" minOccurs="1" maxOccurs="1" nillable="false" />
<xs:element name="ExchangeTime" type="xs:dateTime" minOccurs="1" maxOccurs="1" nillable="false"/>
<xs:element ref="ExchangeOrderReceipt" minOccurs="1" maxOccurs="1"/>
! <xs:element name="Comment" type="xs:string" minOccurs="0" maxOccurs="1" nillable="true" />
</xs:sequence>
</xs:extension>
--- 70,77 ----
<xs:extension base="ExchangeOrderActionType">
<xs:sequence>
! <xs:element ref="xfer:Value" minOccurs="1" maxOccurs="1"/>
<xs:element name="ExchangeTime" type="xs:dateTime" minOccurs="1" maxOccurs="1" nillable="false"/>
<xs:element ref="ExchangeOrderReceipt" minOccurs="1" maxOccurs="1"/>
! <xs:element ref="xfer:Comment" minOccurs="0" maxOccurs="1" />
</xs:sequence>
</xs:extension>
***************
*** 79,85 ****
<xs:extension base="neuid:NamedObjectType">
<xs:sequence>
<xs:element ref="ExchangeOrder" minOccurs="1" maxOccurs="1"/>
! </xs:sequence>
! <xs:attribute name="valuetime" type="xs:dateTime" use="required"/>
</xs:extension>
</xs:complexContent>
--- 85,92 ----
<xs:extension base="neuid:NamedObjectType">
<xs:sequence>
+ <xs:element ref="xfer:Value" minOccurs="0" maxOccurs="1"/>
+ <xs:element ref="xfer:ValueTime" minOccurs="1" maxOccurs="1" />
<xs:element ref="ExchangeOrder" minOccurs="1" maxOccurs="1"/>
! </xs:sequence>
</xs:extension>
</xs:complexContent>
***************
*** 92,98 ****
<xs:extension base="neuid:NamedObjectType">
<xs:sequence>
<xs:element ref="CancelExchangeOrder" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
- <xs:attribute name="valuetime" type="xs:dateTime" use="required"/>
</xs:extension>
</xs:complexContent>
--- 99,105 ----
<xs:extension base="neuid:NamedObjectType">
<xs:sequence>
+ <xs:element ref="xfer:ValueTime" minOccurs="1" maxOccurs="1" />
<xs:element ref="CancelExchangeOrder" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
***************
*** 100,111 ****
</xs:element>
! <xs:element name="ExchangeCompletedReceiptType" nillable="false">
<xs:complexType>
<xs:complexContent>
<xs:extension base="neuid:NamedObjectType">
<xs:sequence>
<xs:element ref="ExchangeCompletionOrder" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
- <xs:attribute name="valuetime" type="xs:dateTime" use="required"/>
</xs:extension>
</xs:complexContent>
--- 107,118 ----
</xs:element>
! <xs:element name="ExchangeCompletedReceipt" nillable="false">
<xs:complexType>
<xs:complexContent>
<xs:extension base="neuid:NamedObjectType">
<xs:sequence>
+ <xs:element ref="xfer:ValueTime" minOccurs="1" maxOccurs="1" />
<xs:element ref="ExchangeCompletionOrder" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
Index: xfer.xsd
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/schemas/xfer.xsd,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** xfer.xsd 7 Jan 2004 16:15:50 -0000 1.2
--- xfer.xsd 7 Jan 2004 17:15:57 -0000 1.3
***************
*** 3,6 ****
--- 3,12 ----
$Id$
$Log$
+ Revision 1.3 2004/01/07 17:15:57 pelle
+ Added support for non fungible transfers. Ie. Transfers of specific serial numbered items.
+ This is implement through the abstract element Value, which contains the two implementing tags:
+ Amount and SerialNumbers.
+ I have also implemented standard types for most fields such as comments and ValueTime.
+
Revision 1.2 2004/01/07 16:15:50 pelle
I have updated all the current schemas, cleaned out the defunct ones and "completed"
***************
*** 19,24 ****
--- 25,44 ----
<xs:import namespace="http://neuclear.org/neu/neuid.xsd" schemaLocation="../../../neuclear-id/src/schemas/neuid.xsd" />
+ <xs:element name="Asset" type="neuid:NamedObjectReference" nillable="false"/>
<xs:element name="Recipient" type="neuid:NamedObjectReference" nillable="false"/>
+ <xs:element name="ValueTime" type="xs:dateTime" nillable="true"/>
+ <xs:element name="Comment" type="xs:string" nillable="true"/>
+ <!-- Generic Value Identifier -->
+ <xs:element name="Value" abstract="true" nillable="false"/>
+ <!-- Specific numeric amount -->
+ <xs:element name="Amount" substitutionGroup="Value" type="xs:double"/>
+ <!-- All the serials numbers included in this Value. The numeric amount is always equals to the amount of items in
+ the list -->
+ <xs:element name="SerialNumbers" substitutionGroup="Value">
+ <xs:simpleType>
+ <xs:list itemType="neuid:NamedObjectReference"/>
+ </xs:simpleType>
+ </xs:element>
<xs:element name="TransferOrder" nillable="false">
<xs:complexType>
***************
*** 26,33 ****
<xs:extension base="neuid:NamedObjectType">
<xs:sequence>
! <xs:element name="Recipient" type="neuid:NamedObjectReference" minOccurs="1" maxOccurs="1" nillable="false"/>
<xs:element ref="Asset" minOccurs="1" maxOccurs="1"/>
! <xs:element name="Amount" type="xs:double" minOccurs="1" maxOccurs="1" nillable="false" />
! <xs:element name="Comment" type="xs:string" minOccurs="0" maxOccurs="1" nillable="true" />
</xs:sequence>
</xs:extension>
--- 46,53 ----
<xs:extension base="neuid:NamedObjectType">
<xs:sequence>
! <xs:element ref="Recipient" minOccurs="1" maxOccurs="1"/>
<xs:element ref="Asset" minOccurs="1" maxOccurs="1"/>
! <xs:element ref="Value" minOccurs="1" maxOccurs="1"/>
! <xs:element ref="Comment" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:extension>
***************
*** 41,45 ****
<xs:extension base="neuid:NamedObjectType">
<xs:sequence>
! <xs:element name="ValueTime" type="xs:dateTime" minOccurs="1" maxOccurs="1"/>
<xs:element ref="TransferOrder" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
--- 61,66 ----
<xs:extension base="neuid:NamedObjectType">
<xs:sequence>
! <xs:element ref="ValueTime" minOccurs="1" maxOccurs="1"/>
! <xs:element ref="Value" minOccurs="0" maxOccurs="1"/>
<xs:element ref="TransferOrder" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
|
|
From: <pe...@us...> - 2004-01-07 16:16:06
|
Update of /cvsroot/neuclear/neuclear-id
In directory sc8-pr-cvs1:/tmp/cvs-serv10697
Modified Files:
project.xml
Log Message:
I have updated all the current schemas, cleaned out the defunct ones and "completed"
the xfer and exch schemas.
Index: project.xml
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/project.xml,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** project.xml 22 Dec 2003 22:15:27 -0000 1.27
--- project.xml 7 Jan 2004 16:16:02 -0000 1.28
***************
*** 4,8 ****
<name>NeuClear Identity Framework</name>
<id>neuclear-id</id>
! <currentVersion>0.8.1</currentVersion>
<inceptionYear>2002</inceptionYear>
<package>org.neuclear</package>
--- 4,8 ----
<name>NeuClear Identity Framework</name>
<id>neuclear-id</id>
! <currentVersion>0.9-SNAPSHOT</currentVersion>
<inceptionYear>2002</inceptionYear>
<package>org.neuclear</package>
|
Update of /cvsroot/neuclear/neuclear-id/src/schemas
In directory sc8-pr-cvs1:/tmp/cvs-serv10697/src/schemas
Modified Files:
neuid.xsd nsauth.xsd
Added Files:
sigreq.xsd
Removed Files:
nsasset.xsd nscondition.xsd nssign.xsd nswsdl.xsd
Log Message:
I have updated all the current schemas, cleaned out the defunct ones and "completed"
the xfer and exch schemas.
--- NEW FILE: sigreq.xsd ---
<?xml version="1.0" encoding="utf-8"?>
<!--
Signature Requests for Interactive Signing Services
=========================================
Service A sends an XML Snippet to the Signing service B via the users browser.
Signing service B asks user if he wants to sign it.
If user agree's signing service B signs the enclosed element.
Signing Service B sends element to it's target elements
-->
<xs:schema targetNamespace="http://neuclear.org/neu/nssign"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:neuid="http://neuclear.org/neu/neuid.xsd"
xmlns:sigreq="http://neuclear.org/neu/sigreq.xsd"
xmlns="http://neuclear.org/neu/sigreq.xsd"
elementFormDefault="qualified" version="0.3" id="sigreq">
<xs:import namespace="http://neuclear.org/neu/neuid.xsd" schemaLocation="neuid.xsd"/>
<xs:element name="SignatureRequest" nillable="false">
<xs:complexType>
<xs:complexContent>
<xs:extension base="neuid:NamedObjectType">
<xs:sequence>
<!-- Include one element to sign -->
<xs:any maxOccurs="1" minOccurs="1"/>
<!-- Optional verbal Description -->
<xs:element name="description" type="xs:string" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="href" type="xs:string"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:schema>
Index: neuid.xsd
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/schemas/neuid.xsd,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** neuid.xsd 6 Jan 2004 23:27:20 -0000 1.1
--- neuid.xsd 7 Jan 2004 16:16:02 -0000 1.2
***************
*** 3,6 ****
--- 3,10 ----
<!--$Id$
$Log$
+ Revision 1.2 2004/01/07 16:16:02 pelle
+ I have updated all the current schemas, cleaned out the defunct ones and "completed"
+ the xfer and exch schemas.
+
Revision 1.1 2004/01/06 23:27:20 pelle
Started restructuring the original xml schemas.
***************
*** 11,15 ****
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
! xmlns="http://neuclear.org/neu/neuid.xsd" elementFormDefault="qualified" version="0.6" id="neuid">
<xs:complexType name="NamedObjectType">
<xs:sequence>
--- 15,38 ----
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
! xmlns="http://neuclear.org/neu/neuid.xsd" elementFormDefault="qualified" version="0.9" id="neuid">
! <xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"/>
!
!
! <xs:simpleType name="sha1">
! <xs:restriction base="xs:string">
! <xs:pattern value='^(sha1:)?.{20}$'/>
! <xs:whiteSpace value="collapse"/>
! </xs:restriction>
! </xs:simpleType>
! <xs:simpleType name="neuri">
! <xs:restriction base="xs:string">
! <xs:pattern value="^neu:([\w]{1,6}:)?//(([\w][\w.-]*)@)?[\w]([\w.-]*[\w])?(/[\w][\w-]*)*(![\w][\w.-]*)?$"/>
! <xs:whiteSpace value="collapse"/>
! </xs:restriction>
! </xs:simpleType>
! <xs:simpleType name="NamedObjectReference">
! <xs:union memberTypes="neuri sha1"/>
! </xs:simpleType>
!
<xs:complexType name="NamedObjectType">
<xs:sequence>
***************
*** 19,24 ****
<xs:element ref="ds:Signature" maxOccurs="1" minOccurs="1"/>
</xs:sequence>
! <xs:attribute name="name" type="xs:string"/>
! <xs:attribute name="timestamp" type="xs:time" />
</xs:complexType>
--- 42,47 ----
<xs:element ref="ds:Signature" maxOccurs="1" minOccurs="1"/>
</xs:sequence>
! <xs:attribute name="name" type="neuri"/>
! <xs:attribute name="timestamp" type="xs:dateTime" />
</xs:complexType>
Index: nsauth.xsd
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/schemas/nsauth.xsd,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** nsauth.xsd 11 Nov 2003 21:18:45 -0000 1.2
--- nsauth.xsd 7 Jan 2004 16:16:02 -0000 1.3
***************
*** 12,31 ****
<xs:schema targetNamespace="http://neuclear.org/neu/nsauth"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
! xmlns:nsdl="http://neuclear.org/neu/nsdl"
! xmlns:nsauth="http://neuclear.org/neu/nsauth"
! xmlns="http://neuclear.org/neu/nsauth"
! elementFormDefault="qualified" version="0.2" id="nsauth">
! <xs:import namespace="http://www.w3.org/2001/XMLSchema" schemaLocation="XMLSchema.xsd"/>
! <xs:import namespace="http://neuclear.org/neu/nsdl" schemaLocation="nsdl.xsd"/>
!
! <xs:complexType name="AuthenticationTicketType">
! <xs:complexContent>
! <xs:extension base="nsdl:NamedObjectType">
! <xs:attribute name="validTo" type="xs:dateTime" use="optional"/>
! <xs:attribute name="href" type="xs:anyURI" use="optional"/>
! </xs:extension>
! </xs:complexContent>
! </xs:complexType>
! <xs:element name="AuthenticationTicket" type="AuthenticationTicketType" nillable="true"/>
</xs:schema>
--- 12,30 ----
<xs:schema targetNamespace="http://neuclear.org/neu/nsauth"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
! xmlns:neuid="http://neuclear.org/neu/neuid.xsd"
! xmlns:nsauth="http://neuclear.org/neu/nsauth.xsd"
! xmlns="http://neuclear.org/neu/nsauth.xsd"
! elementFormDefault="qualified" version="0.3" id="nsauth">
! <xs:import namespace="http://neuclear.org/neu/neuid.xsd" schemaLocation="neuid.xsd"/>
! <xs:element name="AuthenticationTicket" nillable="true">
! <xs:complexType>
! <xs:complexContent>
! <xs:extension base="neuid:NamedObjectType">
! <xs:attribute name="validTo" type="xs:dateTime" use="optional"/>
! <xs:attribute name="href" type="xs:anyURI" use="optional"/>
! </xs:extension>
! </xs:complexContent>
! </xs:complexType>
! </xs:element>
</xs:schema>
--- nsasset.xsd DELETED ---
--- nscondition.xsd DELETED ---
--- nssign.xsd DELETED ---
--- nswsdl.xsd DELETED ---
|