You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(119) |
Oct
(111) |
Nov
(238) |
Dec
(395) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(239) |
Feb
(59) |
Mar
(354) |
Apr
(489) |
May
(23) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
(4) |
May
(5) |
Jun
(2) |
Jul
|
Aug
|
Sep
(3) |
Oct
(14) |
Nov
(17) |
Dec
(9) |
| 2007 |
Jan
(4) |
Feb
(3) |
Mar
|
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
|
Aug
|
Sep
(1) |
Oct
(2) |
Nov
(1) |
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
(7) |
May
(3) |
Jun
(6) |
Jul
(4) |
Aug
(3) |
Sep
(15) |
Oct
(13) |
Nov
(35) |
Dec
(40) |
| 2009 |
Jan
(19) |
Feb
(21) |
Mar
(16) |
Apr
(18) |
May
(36) |
Jun
(20) |
Jul
(32) |
Aug
(11) |
Sep
(3) |
Oct
(2) |
Nov
(2) |
Dec
(13) |
| 2010 |
Jan
(5) |
Feb
(5) |
Mar
(7) |
Apr
(1) |
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
(1) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
(1) |
Aug
(1) |
Sep
(1) |
Oct
(4) |
Nov
|
Dec
(3) |
| 2012 |
Jan
(3) |
Feb
(3) |
Mar
(1) |
Apr
(4) |
May
(8) |
Jun
(4) |
Jul
(9) |
Aug
(2) |
Sep
(8) |
Oct
(3) |
Nov
(8) |
Dec
(4) |
| 2013 |
Jan
(2) |
Feb
(1) |
Mar
(5) |
Apr
(6) |
May
(10) |
Jun
(5) |
Jul
(6) |
Aug
(7) |
Sep
(5) |
Oct
(2) |
Nov
(4) |
Dec
(4) |
| 2014 |
Jan
(13) |
Feb
(4) |
Mar
(7) |
Apr
(9) |
May
(20) |
Jun
(13) |
Jul
(10) |
Aug
(3) |
Sep
(5) |
Oct
(2) |
Nov
(2) |
Dec
(2) |
| 2015 |
Jan
(3) |
Feb
(3) |
Mar
(5) |
Apr
(4) |
May
(3) |
Jun
(2) |
Jul
(4) |
Aug
(3) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
(3) |
| 2016 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
(4) |
Sep
(3) |
Oct
(3) |
Nov
(4) |
Dec
(2) |
| 2017 |
Jan
|
Feb
(2) |
Mar
|
Apr
(2) |
May
(1) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <pe...@us...> - 2003-12-08 19:32:35
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id In directory sc8-pr-cvs1:/tmp/cvs-serv11933/src/java/org/neuclear/id Modified Files: NSTools.java SignedNamedCore.java Log Message: Added support for the http scheme into ID. See http://neuclear.org/archives/000195.html Index: NSTools.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/NSTools.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** NSTools.java 6 Dec 2003 00:17:03 -0000 1.16 --- NSTools.java 8 Dec 2003 19:32:32 -0000 1.17 *************** *** 2,5 **** --- 2,8 ---- * $Id$ * $Log$ + * Revision 1.17 2003/12/08 19:32:32 pelle + * Added support for the http scheme into ID. See http://neuclear.org/archives/000195.html + * * Revision 1.16 2003/12/06 00:17:03 pelle * Updated various areas in NSTools. *************** *** 323,326 **** --- 326,346 ---- throw new InvalidNamedObject("Invalid NEU ID: " + name); } + /** + * Checks to see if the following name should be resolved using the HTTP Resolving Scheme + * @param name + * @return + */ + public static String isHttpScheme(final String name){ + if (!Utility.isEmpty(name)) { + final Matcher matcher = HTTP_SCHEME.matcher(name); + if (matcher.matches()) + return "http://"+matcher.group(2)+"/_NEUID"; //TODO switch to https + } + return null; + + } + + private static final String HTTP_SCHEME_EX="^neu:(neuid:)?\\/\\/(([\\w-]+\\.)+[\\w-]+)$"; + private static final Pattern HTTP_SCHEME=Pattern.compile(HTTP_SCHEME_EX); public static final String NEUID_URI = "http://neuclear.org/neu/neuid"; *************** *** 343,346 **** private static final Pattern STRIP_URI_ARROBA = Pattern.compile(STRIP_URI_ARROBA_EX); - } --- 363,365 ---- Index: SignedNamedCore.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/SignedNamedCore.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SignedNamedCore.java 21 Nov 2003 13:57:27 -0000 1.3 --- SignedNamedCore.java 8 Dec 2003 19:32:32 -0000 1.4 *************** *** 2,5 **** --- 2,8 ---- * $Id$ * $Log$ + * Revision 1.4 2003/12/08 19:32:32 pelle + * Added support for the http scheme into ID. See http://neuclear.org/archives/000195.html + * * Revision 1.3 2003/11/21 13:57:27 pelle * Changed some mutable fields in immutable classes, making them truely immutable. Thus safer. *************** *** 212,215 **** --- 215,219 ---- import org.neuclear.xml.XMLTools; import org.neuclear.xml.xmlsec.XMLSecTools; + import org.neuclear.xml.xmlsec.KeyInfo; import org.neuclear.id.resolver.NSResolver; import org.neuclear.id.verifier.VerifyingReader; *************** *** 217,220 **** --- 221,225 ---- import java.sql.Timestamp; import java.io.InputStream; + import java.security.PublicKey; /** *************** *** 249,253 **** /** ! * Used to read and authenticate a SignedNamedObject. * @param elem * @return --- 254,258 ---- /** ! * Used to read and authenticate a SignedNamedCore. * @param elem * @return *************** *** 258,264 **** final String name = NSTools.normalizeNameURI(elem.attributeValue(getNameAttrQName())); final String signatoryName = NSTools.getParentNSURI(name); - final Identity signatory = NSResolver.resolveIdentity(signatoryName); ! if (XMLSecTools.verifySignature(elem, signatory.getPublicKey())) { final Timestamp timestamp = TimeTools.parseTimeStamp(elem.attributeValue("timestamp")); return new SignedNamedCore( name, signatory, timestamp,new String(XMLSecTools.canonicalize(elem))); --- 263,276 ---- final String name = NSTools.normalizeNameURI(elem.attributeValue(getNameAttrQName())); final String signatoryName = NSTools.getParentNSURI(name); final Identity signatory = NSResolver.resolveIdentity(signatoryName); ! PublicKey publicKey = signatory.getPublicKey(); ! if (NSTools.isHttpScheme(name)!=null){ ! // We have a self signed http authenticated certificate and need to extract ! // the PublicKey from the xml ! final Element allowElement = elem.element(DocumentHelper.createQName("allow", NSTools.NS_NEUID)); ! final KeyInfo ki = new KeyInfo(allowElement.element(XMLSecTools.createQName("KeyInfo"))); ! publicKey= ki.getPublicKey(); ! } ! if (XMLSecTools.verifySignature(elem, publicKey)) { final Timestamp timestamp = TimeTools.parseTimeStamp(elem.attributeValue("timestamp")); return new SignedNamedCore( name, signatory, timestamp,new String(XMLSecTools.canonicalize(elem))); |
|
From: <pe...@us...> - 2003-12-08 19:32:35
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/resolver In directory sc8-pr-cvs1:/tmp/cvs-serv11933/src/java/org/neuclear/id/resolver Modified Files: NSResolver.java Log Message: Added support for the http scheme into ID. See http://neuclear.org/archives/000195.html Index: NSResolver.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/resolver/NSResolver.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** NSResolver.java 4 Dec 2003 21:50:36 -0000 1.12 --- NSResolver.java 8 Dec 2003 19:32:31 -0000 1.13 *************** *** 2,5 **** --- 2,6 ---- import org.neuclear.commons.NeuClearException; + import org.neuclear.commons.Utility; import org.neuclear.id.Identity; import org.neuclear.id.InvalidNamedObject; *************** *** 9,12 **** --- 10,16 ---- import org.neuclear.source.Source; + import java.util.regex.Matcher; + import java.util.regex.Pattern; + /** * Secure Identity resolver. To get an Identity object simply do: *************** *** 53,64 **** final String parentname = NSTools.getParentNSURI(name); - String store = NSROOTSTORE; if (parentname == null || name.equals("neu://")) return Identity.NEUROOT; ! final Identity parent = resolveIdentity(parentname); ! store = parent.getRepository(); ! // fetches Identity from parent Identity's Default Store obj = (Identity) Source.getInstance().fetch(store, name); if (obj == null) --- 57,69 ---- final String parentname = NSTools.getParentNSURI(name); if (parentname == null || name.equals("neu://")) return Identity.NEUROOT; ! String store=NSTools.isHttpScheme(name); ! if (store==null) { ! final Identity parent = resolveIdentity(parentname); ! store = parent.getRepository(); ! } obj = (Identity) Source.getInstance().fetch(store, name); if (obj == null) *************** *** 67,70 **** --- 72,76 ---- return obj; //This may not be null } + } |
|
From: <pe...@us...> - 2003-12-08 19:32:34
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders In directory sc8-pr-cvs1:/tmp/cvs-serv11933/src/java/org/neuclear/id/builders Modified Files: IdentityBuilder.java NamedObjectBuilder.java Log Message: Added support for the http scheme into ID. See http://neuclear.org/archives/000195.html Index: IdentityBuilder.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders/IdentityBuilder.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** IdentityBuilder.java 21 Nov 2003 04:45:10 -0000 1.8 --- IdentityBuilder.java 8 Dec 2003 19:32:31 -0000 1.9 *************** *** 2,5 **** --- 2,8 ---- * $Id$ * $Log$ + * Revision 1.9 2003/12/08 19:32:31 pelle + * Added support for the http scheme into ID. See http://neuclear.org/archives/000195.html + * * Revision 1.8 2003/11/21 04:45:10 pelle * EncryptedFileStore now works. It uses the PBECipher with DES3 afair. *************** *** 238,251 **** } ! public static void main(final String[] args) { ! System.out.println("Test Building NeuClear Identities"); ! try { ! final NamedObjectBuilder id = new IdentityBuilder("neu://", Identity.NEUROOT.getPublicKey()); ! System.out.println(new String(id.canonicalize())); ! } catch (XMLException e) { ! e.printStackTrace(); ! } catch (NeuClearException e) { ! e.printStackTrace(); //TODO Handle exception ! } ! } } --- 241,244 ---- } ! } Index: NamedObjectBuilder.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders/NamedObjectBuilder.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** NamedObjectBuilder.java 22 Nov 2003 00:23:46 -0000 1.14 --- NamedObjectBuilder.java 8 Dec 2003 19:32:31 -0000 1.15 *************** *** 2,5 **** --- 2,8 ---- * $Id$ * $Log$ + * Revision 1.15 2003/12/08 19:32:31 pelle + * Added support for the http scheme into ID. See http://neuclear.org/archives/000195.html + * * Revision 1.14 2003/11/22 00:23:46 pelle * All unit tests in commons, id and xmlsec now work. *************** *** 251,255 **** final public SignedNamedObject sign(final Signer signer) throws NeuClearException, XMLException { ! sign(getParent().getName(), signer); return VerifyingReader.getInstance().read(getElement()); } --- 254,258 ---- final public SignedNamedObject sign(final Signer signer) throws NeuClearException, XMLException { ! sign(getParent().getName(), signer); //Sign with parent key return VerifyingReader.getInstance().read(getElement()); } |
|
From: <pe...@us...> - 2003-12-08 18:57:37
|
Update of /cvsroot/neuclear/neuclear-commons In directory sc8-pr-cvs1:/tmp/cvs-serv4781 Modified Files: project.xml Log Message: Added support for the http scheme into ID. See http://neuclear.org/archives/000195.html Index: project.xml =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/project.xml,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** project.xml 28 Nov 2003 00:12:13 -0000 1.13 --- project.xml 8 Dec 2003 18:57:34 -0000 1.14 *************** *** 104,107 **** --- 104,124 ---- </properties> </dependency> + <dependency> + <id>carol</id> + <version>1.5.2</version> + </dependency> + <dependency> + <id>jotm</id> + <version>1.4.3</version> + </dependency> + <dependency> + <id>xapool</id> + <version>1.3.1</version> + </dependency> + <dependency> + <id>jta-spec</id> + <version>1.0.1</version> + </dependency> + </dependencies> |
|
From: <pe...@us...> - 2003-12-08 18:57:31
|
Update of /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/implementations In directory sc8-pr-cvs1:/tmp/cvs-serv4739/src/java/org/neuclear/ledger/implementations Removed Files: EntityLedger.java Log Message: Added support for the http scheme into ID. See http://neuclear.org/archives/000195.html --- EntityLedger.java DELETED --- |
|
From: <pe...@us...> - 2003-12-08 18:57:31
|
Update of /cvsroot/neuclear/neuclear-ledger In directory sc8-pr-cvs1:/tmp/cvs-serv4739 Modified Files: project.xml Log Message: Added support for the http scheme into ID. See http://neuclear.org/archives/000195.html Index: project.xml =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/project.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** project.xml 20 Nov 2003 23:41:12 -0000 1.8 --- project.xml 8 Dec 2003 18:57:28 -0000 1.9 *************** *** 78,103 **** <version>0.4</version> </dependency> - <!-- <dependency> - <id>neuclearframework</id> - <name>neuclearframework</name> - <version>0.5</version> - </dependency> - <dependency> - <id>commons-collections</id> - <name>commons-collections</name> - <version>2.1</version> - <jar>commons-collections-2.1.jar</jar> - <properties> - <war.bundle.jar>true</war.bundle.jar> - </properties> - </dependency> - <dependency> - <id>dom4j</id> - <version>1.3</version> - <jar>dom4j-1.3.jar</jar> - <properties> - <war.bundle.jar>true</war.bundle.jar> - </properties> - </dependency> <dependency> <id>bouncycastle</id> --- 78,81 ---- *************** *** 109,113 **** </properties> </dependency> - --> <dependency> <id>junit</id> --- 87,90 ---- *************** *** 115,153 **** <version>3.8.1</version> </dependency> ! <!-- <dependency> ! <id>regexp</id> ! <name>regexp</name> ! <version>1.2</version> ! <properties> ! <war.bundle.jar>true</war.bundle.jar> ! </properties> ! </dependency> ! <dependency> ! <id>oscore</id> ! <name>oscore</name> ! <version>2.0.1</version> ! <properties> ! <war.bundle.jar>true</war.bundle.jar> ! </properties> ! </dependency> ! <dependency> ! <id>servletapi</id> ! <name>servletapi</name> ! <version>2.2</version> ! </dependency> ! <dependency> ! <id>commons-cli</id> ! <name>commons-cli</name> ! <version>1.0-beta-2</version> </dependency> - - <dependency> - <id>waterken-adt</id> - <version>2.0-beta13</version> - <properties> - <war.bundle.jar>true</war.bundle.jar> - </properties> - </dependency> - --> </dependencies> <build> --- 92,111 ---- <version>3.8.1</version> </dependency> ! <dependency> ! <id>carol</id> ! <version>1.5.2</version> ! </dependency> ! <dependency> ! <id>jotm</id> ! <version>1.4.3</version> ! </dependency> ! <dependency> ! <id>xapool</id> ! <version>1.3.1</version> ! </dependency> ! <dependency> ! <id>jta-spec</id> ! <version>1.0.1</version> </dependency> </dependencies> <build> |
|
From: <pe...@us...> - 2003-12-08 18:57:31
|
Update of /cvsroot/neuclear/neuclear-ledger/src/test/org/neuclear/ledger/implementations In directory sc8-pr-cvs1:/tmp/cvs-serv4739/src/test/org/neuclear/ledger/implementations Removed Files: EntityLedgerTest.java Log Message: Added support for the http scheme into ID. See http://neuclear.org/archives/000195.html --- EntityLedgerTest.java DELETED --- |
|
From: <pe...@us...> - 2003-12-08 18:57:25
|
Update of /cvsroot/neuclear/neuclear-pay In directory sc8-pr-cvs1:/tmp/cvs-serv4699 Modified Files: project.xml Log Message: Added support for the http scheme into ID. See http://neuclear.org/archives/000195.html Index: project.xml =================================================================== RCS file: /cvsroot/neuclear/neuclear-pay/project.xml,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** project.xml 28 Nov 2003 00:11:51 -0000 1.15 --- project.xml 8 Dec 2003 18:57:18 -0000 1.16 *************** *** 177,181 **** <version>2.3</version> </dependency> ! </dependencies> --- 177,196 ---- <version>2.3</version> </dependency> ! <dependency> ! <id>carol</id> ! <version>1.5.2</version> ! </dependency> ! <dependency> ! <id>jotm</id> ! <version>1.4.3</version> ! </dependency> ! <dependency> ! <id>xapool</id> ! <version>1.3.1</version> ! </dependency> ! <dependency> ! <id>jta-spec</id> ! <version>1.0.1</version> ! </dependency> </dependencies> |
|
From: <pe...@us...> - 2003-12-08 16:45:52
|
Update of /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id/resolver In directory sc8-pr-cvs1:/tmp/cvs-serv8354/src/test/org/neuclear/id/resolver Log Message: Directory /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id/resolver added to the repository |
|
From: <pe...@us...> - 2003-12-06 00:17:07
|
Update of /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id
In directory sc8-pr-cvs1:/tmp/cvs-serv4604/src/test/org/neuclear/id
Modified Files:
NSToolsTest.java
Log Message:
Updated various areas in NSTools.
Updated URI Validation in particular to support new expanded format
Updated createUniqueID and friends to be a lot more unique and more efficient.
In CryptoTools updated getRandom() to finally use a SecureRandom.
Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is.
Index: NSToolsTest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id/NSToolsTest.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** NSToolsTest.java 21 Nov 2003 04:45:17 -0000 1.11
--- NSToolsTest.java 6 Dec 2003 00:17:04 -0000 1.12
***************
*** 2,5 ****
--- 2,12 ----
$Id$
$Log$
+ Revision 1.12 2003/12/06 00:17:04 pelle
+ Updated various areas in NSTools.
+ Updated URI Validation in particular to support new expanded format
+ Updated createUniqueID and friends to be a lot more unique and more efficient.
+ In CryptoTools updated getRandom() to finally use a SecureRandom.
+ Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is.
+
Revision 1.11 2003/11/21 04:45:17 pelle
EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
***************
*** 20,24 ****
Revision 1.8 2003/10/23 22:02:36 pelle
Moved some certificates to live status at http://repository.neuclear.org
! Updated NSTools.url2path to support neuids with @ signs.
Revision 1.7 2003/10/22 23:11:43 pelle
--- 27,31 ----
Revision 1.8 2003/10/23 22:02:36 pelle
Moved some certificates to live status at http://repository.neuclear.org
! Updated NSTools.name2path to support neuids with @ signs.
Revision 1.7 2003/10/22 23:11:43 pelle
***************
*** 107,110 ****
--- 114,118 ----
import junit.framework.TestCase;
import org.neuclear.commons.NeuClearException;
+ import org.neuclear.commons.crypto.CryptoTools;
***************
*** 116,119 ****
--- 124,130 ----
public NSToolsTest(final String name) {
super(name);
+ CryptoTools.createRandomID();//Initialises the Random number generator to not scew times in the generateID test
+
+
}
***************
*** 127,149 ****
public final void testValidName() throws NeuClearException {
- assertValidName("/");
assertValidName("neu://");
! assertValidName("/help");
! assertValidName("neu://help");
! assertValidName("neu://help/abcdefg232Avc");
! assertValidName("/help/abcdefg232Avc");
! assertValidName("neu://pelle@help");
assertValidName("neu://pelle@help/abcdefg232Avc");
assertValidName("neu://pelle@neuclear.org");
assertValidName("neu://pelle@neuclear.org/abcdefg232Avc");
! assertValidName("/help/abcd_efg.-232Avc/");
assertInvalidName("neu:/");
assertInvalidName("neu://pelle@");
assertInvalidName("neu://test/pelle@help");
assertInvalidName("neu://test/pelle@help/abcdefg232Avc");
assertInvalidName("neu");
assertInvalidName("");
--- 138,178 ----
public final void testValidName() throws NeuClearException {
assertValidName("neu://");
! assertValidName("neu://hel-_.p");
! assertValidName("neu://help/ab-c_defg232Avc");
! assertValidName("neu://pelle.user-guy_type@help");
assertValidName("neu://pelle@help/abcdefg232Avc");
assertValidName("neu://pelle@neuclear.org");
assertValidName("neu://pelle@neuclear.org/abcdefg232Avc");
!
! assertValidName("neu://help!aasfdasdf3_.-243");
! assertValidName("neu://help/abcdefg232Avc!aasfdasdf3_.-243");
!
! assertValidName("neu://pelle@help!aasfdasdf3_.-243");
! assertValidName("neu://pelle@help/abcdefg232Avc!aasfdasdf3_.-243");
!
! assertValidName("neu://pelle@neuclear.org!aasfdasdf3_.-243");
! assertValidName("neu://pelle@neuclear.org/abcdefg232Avc!aasfdasdf3_.-243");
assertInvalidName("neu:/");
assertInvalidName("neu://pelle@");
+ assertInvalidName("neu://pelle@/test");
+ assertInvalidName("neu://@test");
assertInvalidName("neu://test/pelle@help");
assertInvalidName("neu://test/pelle@help/abcdefg232Avc");
+ assertInvalidName("neu://hel-_.p*34)");
+ assertInvalidName("neu://help/ab-c_d.efg232Avc");
+
+ assertInvalidName("neu://pelle.user-g!uy_type@help");
+ assertInvalidName("neu://pelle@help/ab.cdefg232Avc");
+
+ assertInvalidName("/");
+ assertInvalidName("/help");
+ assertInvalidName("/help/abcdefg232Avc");
+ assertInvalidName("/help/abcd_efg.-232Avc/");
+
assertInvalidName("neu");
assertInvalidName("");
***************
*** 161,185 ****
assertEquals("neu://hello", NSTools.getParentNSURI("neu://one@hello"));
assertEquals("neu://one@hello", NSTools.getParentNSURI("neu://one@hello/test"));
! assertEquals("neu://hello", NSTools.getParentNSURI("/hello/one"));
assertEquals("neu://", NSTools.getParentNSURI("neu://hello"));
! assertEquals("neu://", NSTools.getParentNSURI("/hello"));
assertEquals("neu://", NSTools.getParentNSURI("neu://"));
- assertEquals("neu://", NSTools.getParentNSURI("/"));
}
! public static void testURL2Path() {
! assertEquals("/", NSTools.url2path("neu://"));
! assertEquals("/", NSTools.url2path("/"));
! assertEquals("/test", NSTools.url2path("neu://test"));
! assertEquals("/test", NSTools.url2path("/test"));
! assertEquals("/test/@pelle", NSTools.url2path("neu://pelle@test"));
! assertEquals("/test/@pelle", NSTools.url2path("/pelle@test"));
! assertEquals("/test/@pelle/one", NSTools.url2path("neu://pelle@test/one"));
! assertEquals("/test/@pelle/one", NSTools.url2path("/pelle@test/one"));
! assertEquals("/test/@pelle/one/two", NSTools.url2path("neu://pelle@test/one/two"));
! assertEquals("/test/@pelle/one/two", NSTools.url2path("/pelle@test/one/two"));
!
}
}
--- 190,214 ----
assertEquals("neu://hello", NSTools.getParentNSURI("neu://one@hello"));
assertEquals("neu://one@hello", NSTools.getParentNSURI("neu://one@hello/test"));
! assertEquals("neu://hello", NSTools.getParentNSURI("neu://hello/one"));
assertEquals("neu://", NSTools.getParentNSURI("neu://hello"));
! assertEquals("neu://one@hello", NSTools.getParentNSURI("neu://one@hello!test"));
! assertEquals("neu://hello", NSTools.getParentNSURI("neu://hello!one"));
assertEquals("neu://", NSTools.getParentNSURI("neu://"));
}
! public static void testURL2Path() throws InvalidNamedObject {
! assertEquals("/", NSTools.name2path("neu://"));
! assertEquals("/test", NSTools.name2path("neu://test"));
! assertEquals("/test/@pelle", NSTools.name2path("neu://pelle@test"));
! assertEquals("/test/@pelle/one", NSTools.name2path("neu://pelle@test/one"));
! assertEquals("/test/@pelle/one/two", NSTools.name2path("neu://pelle@test/one/two"));
}
+ public static void testGenerateIDs() {
+ assertTrue(NSTools.isValidName(NSTools.createUniqueTransactionID("neu://bob@test", "neu://neuclear.org")));
+ assertTrue(NSTools.isValidName(NSTools.createUniqueTransactionID("neu://bob@test/one", "neu://neuclear.org")));
+ assertTrue(NSTools.isValidName(NSTools.createUniqueTransactionID("neu://neuclear.org", "neu://bob@neuclear.org")));
+ assertTrue(NSTools.isValidName(NSTools.createUniqueTransactionID("neu://bob@test.org", "neu://neuclear.org/test")));
+ }
}
|
|
From: <pe...@us...> - 2003-12-06 00:17:07
|
Update of /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id/verifier In directory sc8-pr-cvs1:/tmp/cvs-serv4604/src/test/org/neuclear/id/verifier Modified Files: VerificationTest.java Log Message: Updated various areas in NSTools. Updated URI Validation in particular to support new expanded format Updated createUniqueID and friends to be a lot more unique and more efficient. In CryptoTools updated getRandom() to finally use a SecureRandom. Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is. Index: VerificationTest.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id/verifier/VerificationTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** VerificationTest.java 21 Nov 2003 04:45:17 -0000 1.8 --- VerificationTest.java 6 Dec 2003 00:17:04 -0000 1.9 *************** *** 31,34 **** --- 31,41 ---- $Id$ $Log$ + Revision 1.9 2003/12/06 00:17:04 pelle + Updated various areas in NSTools. + Updated URI Validation in particular to support new expanded format + Updated createUniqueID and friends to be a lot more unique and more efficient. + In CryptoTools updated getRandom() to finally use a SecureRandom. + Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is. + Revision 1.8 2003/11/21 04:45:17 pelle EncryptedFileStore now works. It uses the PBECipher with DES3 afair. *************** *** 48,52 **** Revision 1.5 2003/10/23 22:02:36 pelle Moved some certificates to live status at http://repository.neuclear.org ! Updated NSTools.url2path to support neuids with @ signs. Revision 1.4 2003/10/21 22:31:14 pelle --- 55,59 ---- Revision 1.5 2003/10/23 22:02:36 pelle Moved some certificates to live status at http://repository.neuclear.org ! Updated NSTools.name2path to support neuids with @ signs. Revision 1.4 2003/10/21 22:31:14 pelle |
|
From: <pe...@us...> - 2003-12-06 00:17:07
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/store In directory sc8-pr-cvs1:/tmp/cvs-serv4604/src/java/org/neuclear/store Modified Files: EncryptedFileStore.java FileStore.java Log Message: Updated various areas in NSTools. Updated URI Validation in particular to support new expanded format Updated createUniqueID and friends to be a lot more unique and more efficient. In CryptoTools updated getRandom() to finally use a SecureRandom. Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is. Index: EncryptedFileStore.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/store/EncryptedFileStore.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** EncryptedFileStore.java 21 Nov 2003 04:45:14 -0000 1.14 --- EncryptedFileStore.java 6 Dec 2003 00:17:04 -0000 1.15 *************** *** 2,5 **** --- 2,12 ---- * $Id$ * $Log$ + * Revision 1.15 2003/12/06 00:17:04 pelle + * Updated various areas in NSTools. + * Updated URI Validation in particular to support new expanded format + * Updated createUniqueID and friends to be a lot more unique and more efficient. + * In CryptoTools updated getRandom() to finally use a SecureRandom. + * Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is. + * * Revision 1.14 2003/11/21 04:45:14 pelle * EncryptedFileStore now works. It uses the PBECipher with DES3 afair. *************** *** 180,191 **** import org.neuclear.commons.NeuClearException; - import org.neuclear.commons.crypto.CryptoTools; import org.neuclear.commons.crypto.CryptoException; import org.neuclear.id.NSTools; import org.neuclear.id.SignedNamedObject; import javax.crypto.CipherInputStream; import javax.crypto.CipherOutputStream; - import javax.crypto.Cipher; import java.io.*; --- 187,198 ---- import org.neuclear.commons.NeuClearException; import org.neuclear.commons.crypto.CryptoException; + import org.neuclear.commons.crypto.CryptoTools; import org.neuclear.id.NSTools; import org.neuclear.id.SignedNamedObject; + import javax.crypto.Cipher; import javax.crypto.CipherInputStream; import javax.crypto.CipherOutputStream; import java.io.*; *************** *** 206,210 **** outputFile.getParentFile().mkdirs(); try { ! return new CipherOutputStream(new FileOutputStream(outputFile), CryptoTools.makePBECipher(Cipher.ENCRYPT_MODE,obj.getName().toCharArray())); } catch (Exception e) { throw new CryptoException(e); --- 213,217 ---- outputFile.getParentFile().mkdirs(); try { ! return new CipherOutputStream(new FileOutputStream(outputFile), CryptoTools.makePBECipher(Cipher.ENCRYPT_MODE, obj.getName().toCharArray())); } catch (Exception e) { throw new CryptoException(e); *************** *** 219,223 **** throw new NeuClearException("NeuClear: " + name + " doesnt exist"); try { ! return new CipherInputStream(new FileInputStream(fin), CryptoTools.makePBECipher(Cipher.DECRYPT_MODE,name.toCharArray())); } catch (Exception e) { throw new CryptoException(e); --- 226,230 ---- throw new NeuClearException("NeuClear: " + name + " doesnt exist"); try { ! return new CipherInputStream(new FileInputStream(fin), CryptoTools.makePBECipher(Cipher.DECRYPT_MODE, name.toCharArray())); } catch (Exception e) { throw new CryptoException(e); *************** *** 228,232 **** protected final String getFileName(final String name) throws NeuClearException { final String deURLizedName = NSTools.normalizeNameURI(name); ! final byte[] hash = CryptoTools.formatAsURLSafe(CryptoTools.digest256(deURLizedName.getBytes())).getBytes(); //if (true) return new String(hash); final int partlength = hash.length / 8; --- 235,239 ---- protected final String getFileName(final String name) throws NeuClearException { 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; Index: FileStore.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/store/FileStore.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** FileStore.java 21 Nov 2003 04:45:16 -0000 1.15 --- FileStore.java 6 Dec 2003 00:17:04 -0000 1.16 *************** *** 2,5 **** --- 2,12 ---- * $Id$ * $Log$ + * Revision 1.16 2003/12/06 00:17:04 pelle + * Updated various areas in NSTools. + * Updated URI Validation in particular to support new expanded format + * Updated createUniqueID and friends to be a lot more unique and more efficient. + * In CryptoTools updated getRandom() to finally use a SecureRandom. + * Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is. + * * Revision 1.15 2003/11/21 04:45:16 pelle * EncryptedFileStore now works. It uses the PBECipher with DES3 afair. *************** *** 232,236 **** protected String getFileName(final String name) throws NeuClearException { ! return NSTools.url2path(name) + "/root.id"; } --- 239,243 ---- protected String getFileName(final String name) throws NeuClearException { ! return NSTools.name2path(name) + "/root.id"; } |
|
From: <pe...@us...> - 2003-12-06 00:17:07
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/source
In directory sc8-pr-cvs1:/tmp/cvs-serv4604/src/java/org/neuclear/source
Modified Files:
CachedSource.java HttpSource.java
Log Message:
Updated various areas in NSTools.
Updated URI Validation in particular to support new expanded format
Updated createUniqueID and friends to be a lot more unique and more efficient.
In CryptoTools updated getRandom() to finally use a SecureRandom.
Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is.
Index: CachedSource.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/source/CachedSource.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** CachedSource.java 4 Dec 2003 21:50:36 -0000 1.14
--- CachedSource.java 6 Dec 2003 00:17:03 -0000 1.15
***************
*** 3,6 ****
--- 3,13 ----
* $Id$
* $Log$
+ * Revision 1.15 2003/12/06 00:17:03 pelle
+ * Updated various areas in NSTools.
+ * Updated URI Validation in particular to support new expanded format
+ * Updated createUniqueID and friends to be a lot more unique and more efficient.
+ * In CryptoTools updated getRandom() to finally use a SecureRandom.
+ * Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is.
+ *
* Revision 1.14 2003/12/04 21:50:36 pelle
* Mainly documentation changes.
***************
*** 127,131 ****
protected InputStream getStream(final String endpoint, final String name) throws NeuClearException {
! final File object = new File(cachedirpath + NSTools.url2path(name) + "/root.id");
try {
if (!object.exists()) { //TODO check for freshness
--- 134,138 ----
protected InputStream getStream(final String endpoint, final String name) throws NeuClearException {
! final File object = new File(cachedirpath + NSTools.name2path(name) + "/root.id");
try {
if (!object.exists()) { //TODO check for freshness
Index: HttpSource.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/source/HttpSource.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** HttpSource.java 4 Dec 2003 21:50:36 -0000 1.10
--- HttpSource.java 6 Dec 2003 00:17:04 -0000 1.11
***************
*** 8,11 ****
--- 8,18 ----
* $Id$
* $Log$
+ * Revision 1.11 2003/12/06 00:17:04 pelle
+ * Updated various areas in NSTools.
+ * Updated URI Validation in particular to support new expanded format
+ * Updated createUniqueID and friends to be a lot more unique and more efficient.
+ * In CryptoTools updated getRandom() to finally use a SecureRandom.
+ * Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is.
+ *
* Revision 1.10 2003/12/04 21:50:36 pelle
* Mainly documentation changes.
***************
*** 102,106 ****
protected final InputStream getStream(final String endpoint, final String name) throws NeuClearException {
try {
! final String urlstring = endpoint + NSTools.url2path(name);
final URL url = new URL(urlstring);
--- 109,113 ----
protected final InputStream getStream(final String endpoint, final String name) throws NeuClearException {
try {
! final String urlstring = endpoint + NSTools.name2path(name);
final URL url = new URL(urlstring);
|
|
From: <pe...@us...> - 2003-12-06 00:17:06
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/signers/commandline
In directory sc8-pr-cvs1:/tmp/cvs-serv4604/src/java/org/neuclear/signers/commandline
Modified Files:
IdentityCreator.java
Log Message:
Updated various areas in NSTools.
Updated URI Validation in particular to support new expanded format
Updated createUniqueID and friends to be a lot more unique and more efficient.
In CryptoTools updated getRandom() to finally use a SecureRandom.
Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is.
Index: IdentityCreator.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/signers/commandline/IdentityCreator.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** IdentityCreator.java 21 Nov 2003 04:45:13 -0000 1.6
--- IdentityCreator.java 6 Dec 2003 00:17:03 -0000 1.7
***************
*** 1,4 ****
--- 1,11 ----
/* $Id$
* $Log$
+ * Revision 1.7 2003/12/06 00:17:03 pelle
+ * Updated various areas in NSTools.
+ * Updated URI Validation in particular to support new expanded format
+ * Updated createUniqueID and friends to be a lot more unique and more efficient.
+ * In CryptoTools updated getRandom() to finally use a SecureRandom.
+ * Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is.
+ *
* Revision 1.6 2003/11/21 04:45:13 pelle
* EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
***************
*** 163,166 ****
--- 170,176 ----
import org.apache.commons.cli.Options;
import org.neuclear.commons.NeuClearException;
+ import org.neuclear.commons.Utility;
+ import org.neuclear.commons.crypto.CryptoException;
+ import org.neuclear.commons.crypto.signers.PublicKeySource;
import org.neuclear.id.NSTools;
import org.neuclear.id.builders.IdentityBuilder;
***************
*** 168,174 ****
import org.neuclear.id.resolver.NSResolver;
import org.neuclear.senders.LogSender;
- import org.neuclear.commons.crypto.signers.PublicKeySource;
- import org.neuclear.commons.crypto.CryptoException;
- import org.neuclear.commons.Utility;
import java.io.File;
--- 178,181 ----
***************
*** 191,195 ****
cachedir.mkdirs();
! of = Utility.denullString(of, cachedirpath + NSTools.url2path(identity) + "/root.id");
alias = Utility.denullString(alias, NSTools.getParentNSURI(identity));
--- 198,202 ----
cachedir.mkdirs();
! of = Utility.denullString(of, cachedirpath + NSTools.name2path(identity) + "/root.id");
alias = Utility.denullString(alias, NSTools.getParentNSURI(identity));
|
|
From: <pe...@us...> - 2003-12-06 00:17:06
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id In directory sc8-pr-cvs1:/tmp/cvs-serv4604/src/java/org/neuclear/id Modified Files: NSTools.java Log Message: Updated various areas in NSTools. Updated URI Validation in particular to support new expanded format Updated createUniqueID and friends to be a lot more unique and more efficient. In CryptoTools updated getRandom() to finally use a SecureRandom. Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is. Index: NSTools.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/NSTools.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** NSTools.java 21 Nov 2003 04:45:13 -0000 1.15 --- NSTools.java 6 Dec 2003 00:17:03 -0000 1.16 *************** *** 2,5 **** --- 2,12 ---- * $Id$ * $Log$ + * Revision 1.16 2003/12/06 00:17:03 pelle + * Updated various areas in NSTools. + * Updated URI Validation in particular to support new expanded format + * Updated createUniqueID and friends to be a lot more unique and more efficient. + * In CryptoTools updated getRandom() to finally use a SecureRandom. + * Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is. + * * Revision 1.15 2003/11/21 04:45:13 pelle * EncryptedFileStore now works. It uses the PBECipher with DES3 afair. *************** *** 25,29 **** * Revision 1.11 2003/10/23 22:02:36 pelle * Moved some certificates to live status at http://repository.neuclear.org ! * Updated NSTools.url2path to support neuids with @ signs. * * Revision 1.10 2003/10/22 23:16:00 pelle --- 32,36 ---- * Revision 1.11 2003/10/23 22:02:36 pelle * Moved some certificates to live status at http://repository.neuclear.org ! * Updated NSTools.name2path to support neuids with @ signs. * * Revision 1.10 2003/10/22 23:16:00 pelle *************** *** 149,152 **** --- 156,161 ---- package org.neuclear.id; + import org.bouncycastle.crypto.Digest; + import org.bouncycastle.crypto.digests.SHA1Digest; import org.dom4j.DocumentHelper; import org.dom4j.Namespace; *************** *** 155,159 **** import org.neuclear.commons.crypto.CryptoTools; - import java.util.Random; import java.util.regex.Matcher; import java.util.regex.Pattern; --- 164,167 ---- *************** *** 170,187 **** * @throws NeuClearException If name isn't a valid NEU Name */ ! public static String normalizeNameURI(final String name) throws NeuClearException { if (!isValidName(name)) throw new InvalidNamedObject("Name: '" + name + "' is not valid"); - if (!name.startsWith("neu://")) - return "neu:/" + name; return name; } /** ! * Name must follow the follwing rules:<br> ! * Available Characters: <pre>a..zA..Z0..9_/.-</pre> <br> * <p/> ! * Name starts with either URI prefix <tt>neu://</tt> ! * or <tt>/</tt> * * @param name to test --- 178,221 ---- * @throws NeuClearException If name isn't a valid NEU Name */ ! public static String normalizeNameURI(String name) throws NeuClearException { ! if (!name.startsWith("neu://")) ! name = "neu:/" + name; if (!isValidName(name)) throw new InvalidNamedObject("Name: '" + name + "' is not valid"); return name; } /** ! * <p>Verifies if a NEU URI is syntactically correct. ! * </p> * <p/> ! * The first URI must follow the following Syntax: ! * </p> ! * <table border="2" valign="top"> ! * <tr><th>Part</th><th>Required</th><th>Example</th><th>Description</th></tr> ! * <tr><td>prefix</td><td>Y</td><td><b><tt>neu:</tt></b></td><td>The URI prefix</td></tr> ! * <tr><td>scheme</td><td>N</td><td><tt><b>neuid<br/>pgp<br/>x509</td><td>short label identifying PKI Protocol. Must contain a maximum of 6 alphanumeric characters. ! * If not used the default scheme of <b><tt>neuid</tt></b> is used.</td></tr> ! * <tr><td>path prefix</td><td>Y</td><td><b><tt>:/</tt></b></td><td>Indicates the start of the Path segment.</td></tr> ! * <tr><td>User ID</td><td>N</td><td><tt><b>joe.user@</b></tt></td> ! * <td>Optional second level user id. Must start with an alphanumeric character and can contain 0 or more of either alpha ! * numeric characters as well as the following symbols minus ('-'), underscore ('_') and period ('.'). The user id must terminate ! * in with a '@' symbol. ! * </td></tr> ! * <tr><td>Top Level Identifier</td><td>N</td><td><tt><b>test<br/>neuclear.org<br/></b></tt></td> ! * <td>Name of the top level identifier. Must start with an alphanumeric character and can contain 0 or more of either alpha ! * numeric characters as well as the following symbols minus ('-'), underscore ('_') and period ('.'). If the name includes ! * any periods this indicates that the name must follow the https authentication scheme. If not the Identity must be signed by ! * the NeuClear.org root signer.</td></tr> ! * <tr><td>Sub Level Identifiers</td><td>N</td><td><tt><b>/sales<br/>/dev/test<br/></b></tt></td> ! * <td>Identifies Identity levels below a top level identity. This identifier can be repeated 0 or more times. ! * Each identifier must start with a forward slash ('/') followed by an ! * alphanumeric character and can contain 0 or more of either alpha ! * numeric characters as well as the following symbols minus ('-') and underscore ('_'). Note that the sub levels may not contain periods.</td></tr> ! * <tr><td>Transaction Identifier</td><td>N</td><td><tt><b>!12343onetwo</b></tt></td> ! * <td>Identifies transactions signed by the preceding Identity. Must start with an exlamation mark ('!') followed by an ! * alphanumeric character and can contain 0 or more of either alpha ! * numeric characters as well as the following symbols period ('.'), minus ('-') and underscore ('_'). </td></tr> ! * </table> * * @param name to test *************** *** 198,259 **** * Returns the URI of the parent Identity for a given NEU Name * ! * @param name a valid NEU Name * @return Parent URI or null if name is the root * @throws NeuClearException if name is invalid */ ! public static String getParentNSURI(final String name) throws NeuClearException { ! final String uri = normalizeNameURI(name); final int slash = uri.lastIndexOf('/'); final int at = uri.indexOf('@'); if (slash < at) return uri.substring(0, slash + 1) + uri.substring(at + 1); ! if (uri.equals("neu://") || (slash < 5)) ! return "neu://"; ! if (slash == 5) return uri.substring(0, slash + 1); return uri.substring(0, slash); } ! public static String createUniqueNamedID(final String nameSpace, final String reqNameSpace) { ! // Yeah, yeah there are better ways to do this ! final String ms = new Long(System.currentTimeMillis() + new Random().nextLong()).toString(); //TODO seed the Random number generator ! final byte[] ticketsrc = new byte[ms.length() + reqNameSpace.length()]; ! System.arraycopy(ms.getBytes(), 0, ticketsrc, 0, ms.length()); ! System.arraycopy(reqNameSpace.getBytes(), 0, ticketsrc, ms.length(), reqNameSpace.length()); ! final String ticket = CryptoTools.formatAsURLSafe(CryptoTools.digest256(ticketsrc)); ! //Lets reuse ticketsrc for memory reasons ! int offset = ms.length() + 1; ! if (reqNameSpace.startsWith("neu://")) ! offset += 5; ! for (int i = offset; i < ticketsrc.length; i++) { ! if (ticketsrc[i] == (byte) '/' || ticketsrc[i] == (byte) '@') ! ticketsrc[i] = (byte) '.'; ! } ! /* ! byte ticketName[]=new byte[userNameSpace.length()+33]; // Create new Name byte array to hold userNameSpace a '/' and the generated ticket (size 32) ! System.arraycopy(userNameSpace.getBytes(),0,ticketName,0,userNameSpace.length()); ! ticketName[userNameSpace.length()]=(byte)'/'; ! System.arraycopy(ticket,0,ticketName,userNameSpace.length()+1,ticket.length); ! */ ! return nameSpace + '/' + new String(ticketsrc, offset, ticketsrc.length - offset) + '.' + ticket; } ! public static String url2path(final String name) { if (!Utility.isEmpty(name)) { final Matcher matcher = STRIP_URI_ARROBA.matcher(name); if (matcher.matches()) { ! return "/" + matcher.group(3) + "/@" + matcher.group(2) + Utility.denullString(matcher.group(4)); } - final int loc = name.indexOf("://"); - if (loc >= 0) - return name.substring(loc + 2); //leave in one '/' - else if (name.substring(0, 1).equals("/")) - return name; - else - return "/" + name; } ! return "/"; } --- 232,325 ---- * Returns the URI of the parent Identity for a given NEU Name * ! * @param uri a valid NEU Name * @return Parent URI or null if name is the root * @throws NeuClearException if name is invalid */ ! public static String getParentNSURI(final String uri) throws NeuClearException { ! if (!isValidName(uri)) ! throw new InvalidNamedObject("Invalid Neu ID: " + uri); ! final int bang = uri.indexOf('!'); ! ! // We hava a Transaction ID. We always return its signer ! if (bang > -1) ! return uri.substring(0, bang); ! final int slash = uri.lastIndexOf('/'); final int at = uri.indexOf('@'); + // We have a User ID if (slash < at) return uri.substring(0, slash + 1) + uri.substring(at + 1); ! // We have a top level ! if (uri.charAt(slash - 1) == '/') return uri.substring(0, slash + 1); + //Regular return uri.substring(0, slash); } ! /** ! * Creates a Globally Unique ID using the following algorithm: ! * <ol><li>Take given Identity URI</li> ! * <li>Appends Timestamp in ms</li> ! * <li>Appends large random number</li> ! * <li>Appends base36 SHA1 of Requesting Identity URI</li> ! * </ol> ! * Note if there is no Requesting Identity. Place any kind of seed in this parameter ! * ! * @param signer N ! * @param requester ! * @param isTransaction is the new Id supposed to be a transaction id? ! * @return ! */ ! public static String createUniqueNamedID(final String signer, final String requester, final boolean isTransaction) { ! final Digest dig = new SHA1Digest(); ! final StringBuffer buffy = new StringBuffer(signer); ! buffy.append((isTransaction ? '!' : '/')); ! buffy.append(System.currentTimeMillis()); ! buffy.append(CryptoTools.createRandomID()); ! final byte[] output = new byte[dig.getDigestSize()]; ! final byte reqbytes[] = requester.getBytes(); ! dig.update(reqbytes, 0, reqbytes.length); ! //TODO Add some more stuff like IP addresses etc to digest ! dig.doFinal(output, 0); + buffy.append(CryptoTools.formatAsBase36(output)); + System.out.println(buffy.toString()); + return buffy.toString(); + } ! /** ! * Creates a Globally Unique Transaction ID using the following algorithm: ! * <ol><li>Take given Identity URI</li> ! * <li>Appends Timestamp in ms</li> ! * <li>Appends large random number</li> ! * <li>Appends base36 SHA1 of Requesting Identity URI</li> ! * </ol> ! * Note if there is no Requesting Identity. Place any kind of seed in this parameter ! * ! * @param signer N ! * @param requester ! * @return ! */ ! public static String createUniqueTransactionID(final String signer, final String requester) { ! return createUniqueNamedID(signer, requester, true); } ! /** ! * Convers a NEU Name URI into a path suitable for a filesystem or for inclusion as part of a web url. ! * Essentially it strips the prefixes of the URI. If the URI is of the format <tt>neu://bob@test</tt> it returns it as ! * /test/@bob as bob is essentially below test in the hierarchy. ! * ! * @param name NEU Name URI ! * @return Path ! * @throws InvalidNamedObject If the URI is invalid ! */ ! public static String name2path(final String name) throws InvalidNamedObject { if (!Utility.isEmpty(name)) { final Matcher matcher = STRIP_URI_ARROBA.matcher(name); if (matcher.matches()) { ! return "/" + Utility.denullString(matcher.group(3)) + (matcher.group(1) != null ? ("/@" + matcher.group(2)) : "") + Utility.denullString(matcher.group(4)); } } ! throw new InvalidNamedObject("Invalid NEU ID: " + name); } *************** *** 262,273 **** public static final String NEUID_PREFIX = "neuid:"; ! private static final String VALID_TOKEN = "[\\w.-]+"; ! private static final String VALID_ID = "^(neu:\\/)?" + ! "(\\/(" + VALID_TOKEN + "@" + VALID_TOKEN + ")?" + ! "((\\/)|" + VALID_TOKEN + ")*)$"; private static final Pattern VALID = Pattern.compile(VALID_ID); ! private static final String STRIP_URI_ARROBA_EX = "^(neu:\\/)?" + ! "\\/(" + VALID_TOKEN + ")@(" + VALID_TOKEN + ")([\\/\\w.-]*)$"; private static final Pattern STRIP_URI_ARROBA = Pattern.compile(STRIP_URI_ARROBA_EX); --- 328,344 ---- public static final String NEUID_PREFIX = "neuid:"; ! ! public static final String SCHEME_PREFIX = "([\\w]{1,6}:)?"; ! private static final String VALID_TOKEN = "[\\w][\\w.-]*"; ! private static final String VALID_USER_TOKEN = "(([\\w][\\w.-]*)@)?"; ! private static final String VALID_TOP_TOKEN = VALID_USER_TOKEN + "[\\w]([\\w.-]*[\\w])?"; ! private static final String VALID_SUB_TOKEN = "(\\/[\\w][\\w-]*)*"; ! private static final String VALID_TRAN_TOKEN = "(\\![\\w][\\w.-]*)?"; ! private static final String VALID_ID = "^neu:" + SCHEME_PREFIX + "\\/\\/(" + VALID_TOP_TOKEN + ! VALID_SUB_TOKEN + VALID_TRAN_TOKEN + ")?$"; private static final Pattern VALID = Pattern.compile(VALID_ID); ! ! private static final String STRIP_URI_ARROBA_EX = "neu://((" + VALID_TOKEN + ")@)?(" + VALID_TOKEN + ")?(" + VALID_SUB_TOKEN + VALID_TRAN_TOKEN + ")$"; private static final Pattern STRIP_URI_ARROBA = Pattern.compile(STRIP_URI_ARROBA_EX); |
|
From: <pe...@us...> - 2003-12-06 00:17:06
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders
In directory sc8-pr-cvs1:/tmp/cvs-serv4604/src/java/org/neuclear/id/builders
Modified Files:
AuthenticationTicketBuilder.java SignatureRequestBuilder.java
Log Message:
Updated various areas in NSTools.
Updated URI Validation in particular to support new expanded format
Updated createUniqueID and friends to be a lot more unique and more efficient.
In CryptoTools updated getRandom() to finally use a SecureRandom.
Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is.
Index: AuthenticationTicketBuilder.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders/AuthenticationTicketBuilder.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** AuthenticationTicketBuilder.java 21 Nov 2003 04:45:10 -0000 1.3
--- AuthenticationTicketBuilder.java 6 Dec 2003 00:17:03 -0000 1.4
***************
*** 5,10 ****
import org.neuclear.auth.AuthenticationTicket;
import org.neuclear.commons.NeuClearException;
- import org.neuclear.id.NSTools;
import org.neuclear.commons.time.TimeTools;
import java.sql.Timestamp;
--- 5,10 ----
import org.neuclear.auth.AuthenticationTicket;
import org.neuclear.commons.NeuClearException;
import org.neuclear.commons.time.TimeTools;
+ import org.neuclear.id.NSTools;
import java.sql.Timestamp;
***************
*** 31,34 ****
--- 31,41 ----
$Id$
$Log$
+ Revision 1.4 2003/12/06 00:17:03 pelle
+ Updated various areas in NSTools.
+ Updated URI Validation in particular to support new expanded format
+ Updated createUniqueID and friends to be a lot more unique and more efficient.
+ In CryptoTools updated getRandom() to finally use a SecureRandom.
+ Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is.
+
Revision 1.3 2003/11/21 04:45:10 pelle
EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
***************
*** 60,64 ****
public AuthenticationTicketBuilder(final String user, final String requester, final Date validto, final String site) throws NeuClearException {
! super(NSTools.createUniqueNamedID(user, requester), AuthenticationTicket.TAG_NAME, AuthenticationTicket.NS_NSAUTH);
getElement().addAttribute(createQName("requester"), NSTools.normalizeNameURI(requester));
getElement().addAttribute(createQName("validto"), TimeTools.formatTimeStamp(validto));
--- 67,71 ----
public AuthenticationTicketBuilder(final String user, final String requester, final Date validto, final String site) throws NeuClearException {
! super(NSTools.createUniqueTransactionID(user, requester), AuthenticationTicket.TAG_NAME, AuthenticationTicket.NS_NSAUTH);
getElement().addAttribute(createQName("requester"), NSTools.normalizeNameURI(requester));
getElement().addAttribute(createQName("validto"), TimeTools.formatTimeStamp(validto));
Index: SignatureRequestBuilder.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders/SignatureRequestBuilder.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** SignatureRequestBuilder.java 21 Nov 2003 04:45:10 -0000 1.3
--- SignatureRequestBuilder.java 6 Dec 2003 00:17:03 -0000 1.4
***************
*** 3,10 ****
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.neuclear.id.NSTools;
import org.neuclear.id.SignatureRequest;
- import org.neuclear.commons.Utility;
- import org.neuclear.commons.NeuClearException;
/*
--- 3,10 ----
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
+ import org.neuclear.commons.NeuClearException;
+ import org.neuclear.commons.Utility;
import org.neuclear.id.NSTools;
import org.neuclear.id.SignatureRequest;
/*
***************
*** 28,31 ****
--- 28,38 ----
$Id$
$Log$
+ Revision 1.4 2003/12/06 00:17:03 pelle
+ Updated various areas in NSTools.
+ Updated URI Validation in particular to support new expanded format
+ Updated createUniqueID and friends to be a lot more unique and more efficient.
+ In CryptoTools updated getRandom() to finally use a SecureRandom.
+ Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is.
+
Revision 1.3 2003/11/21 04:45:10 pelle
EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
***************
*** 53,57 ****
public final class SignatureRequestBuilder extends NamedObjectBuilder {
public SignatureRequestBuilder(final String requestor, final String userid, final NamedObjectBuilder unsigned, final String description) throws NeuClearException {
! super(NSTools.createUniqueNamedID(requestor, userid), SignatureRequest.SIGREQUEST_TAG);
final Element unsignedElem = getElement().addElement(DocumentHelper.createQName("Unsigned", NSTools.NS_NEUID));
unsignedElem.add(unsigned.getElement());
--- 60,64 ----
public final class SignatureRequestBuilder extends NamedObjectBuilder {
public SignatureRequestBuilder(final String requestor, final String userid, final NamedObjectBuilder unsigned, final String description) throws NeuClearException {
! super(NSTools.createUniqueTransactionID(requestor, userid), SignatureRequest.SIGREQUEST_TAG);
final Element unsignedElem = getElement().addElement(DocumentHelper.createQName("Unsigned", NSTools.NS_NEUID));
unsignedElem.add(unsigned.getElement());
|
|
From: <pe...@us...> - 2003-12-06 00:16:37
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto
In directory sc8-pr-cvs1:/tmp/cvs-serv4564/src/java/org/neuclear/commons/crypto
Modified Files:
CryptoTools.java RawCertificate.java
Log Message:
Updated various areas in NSTools.
Updated URI Validation in particular to support new expanded format
Updated createUniqueID and friends to be a lot more unique and more efficient.
In CryptoTools updated getRandom() to finally use a SecureRandom.
Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is.
Index: CryptoTools.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/CryptoTools.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** CryptoTools.java 21 Nov 2003 04:43:41 -0000 1.5
--- CryptoTools.java 6 Dec 2003 00:16:35 -0000 1.6
***************
*** 2,5 ****
--- 2,12 ----
* $Id$
* $Log$
+ * Revision 1.6 2003/12/06 00:16:35 pelle
+ * Updated various areas in NSTools.
+ * Updated URI Validation in particular to support new expanded format
+ * Updated createUniqueID and friends to be a lot more unique and more efficient.
+ * In CryptoTools updated getRandom() to finally use a SecureRandom.
+ * Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is.
+ *
* Revision 1.5 2003/11/21 04:43:41 pelle
* EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
***************
*** 484,488 ****
}
! public static String formatAsURLSafe(final byte[] val) {
final BigInteger big = new BigInteger(val);
return big.toString(36);
--- 491,495 ----
}
! public static String formatAsBase36(final byte[] val) {
final BigInteger big = new BigInteger(val);
return big.toString(36);
***************
*** 490,494 ****
public static String createRandomID() {
! final BigInteger big = new BigInteger(4096, getRandomInstance());
return big.toString(36);
}
--- 497,506 ----
public static String createRandomID() {
! return createRandomID(RAND_BIT_LENGTH);
!
! }
!
! public static String createRandomID(int length) {
! final BigInteger big = new BigInteger(length, getRandomInstance());
return big.toString(36);
}
***************
*** 496,500 ****
private static synchronized Random getRandomInstance() {
if (randSource == null)
! randSource = new Random();
return randSource;
}
--- 508,516 ----
private static synchronized Random getRandomInstance() {
if (randSource == null)
! try {
! randSource = SecureRandom.getInstance("SHA1PRNG");
! } catch (NoSuchAlgorithmException e) {
! throw new RuntimeException(e);
! }
return randSource;
}
***************
*** 737,743 ****
public static final byte[] hexTable = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
! private static Random randSource;
public final static String DEFAULT_KEYSTORE = System.getProperty("user.home") + "/.keystore";
}
--- 753,760 ----
public static final byte[] hexTable = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
! private static SecureRandom randSource;
public final static String DEFAULT_KEYSTORE = System.getProperty("user.home") + "/.keystore";
+ public static final int RAND_BIT_LENGTH = 128;
}
Index: RawCertificate.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/RawCertificate.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** RawCertificate.java 21 Nov 2003 04:43:41 -0000 1.2
--- RawCertificate.java 6 Dec 2003 00:16:35 -0000 1.3
***************
*** 26,29 ****
--- 26,36 ----
$Id$
$Log$
+ Revision 1.3 2003/12/06 00:16:35 pelle
+ Updated various areas in NSTools.
+ Updated URI Validation in particular to support new expanded format
+ Updated createUniqueID and friends to be a lot more unique and more efficient.
+ In CryptoTools updated getRandom() to finally use a SecureRandom.
+ Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is.
+
Revision 1.2 2003/11/21 04:43:41 pelle
EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
***************
*** 89,93 ****
public final String toString() {
try {
! return CryptoTools.formatAsURLSafe(CryptoTools.digest(getEncoded()));
} catch (Exception e) {
return "error";
--- 96,100 ----
public final String toString() {
try {
! return CryptoTools.formatAsBase36(CryptoTools.digest(getEncoded()));
} catch (Exception e) {
return "error";
|
Update of /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/contracts/builders
In directory sc8-pr-cvs1:/tmp/cvs-serv4480/src/java/org/neuclear/asset/contracts/builders
Modified Files:
CancelHeldTransferReceiptBuilder.java
CancelHeldTransferRequestBuilder.java TransferBuilder.java
Log Message:
Updated various areas in NSTools.
Updated URI Validation in particular to support new expanded format
Updated createUniqueID and friends to be a lot more unique and more efficient.
In CryptoTools updated getRandom() to finally use a SecureRandom.
Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is.
Index: CancelHeldTransferReceiptBuilder.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/contracts/builders/CancelHeldTransferReceiptBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CancelHeldTransferReceiptBuilder.java 21 Nov 2003 04:43:03 -0000 1.2
--- CancelHeldTransferReceiptBuilder.java 6 Dec 2003 00:16:10 -0000 1.3
***************
*** 1,13 ****
package org.neuclear.asset.contracts.builders;
- import org.neuclear.asset.contracts.Asset;
- import org.neuclear.asset.contracts.TransferGlobals;
- import org.neuclear.asset.contracts.HeldTransferReceipt;
- import org.neuclear.asset.contracts.CancelHeldTransferRequest;
import org.neuclear.asset.InvalidTransferException;
import org.neuclear.asset.NegativeTransferException;
! import org.neuclear.id.Identity;
! import org.neuclear.id.NSTools;
import org.neuclear.commons.NeuClearException;
/**
--- 1,10 ----
package org.neuclear.asset.contracts.builders;
import org.neuclear.asset.InvalidTransferException;
import org.neuclear.asset.NegativeTransferException;
! import org.neuclear.asset.contracts.CancelHeldTransferRequest;
! import org.neuclear.asset.contracts.TransferGlobals;
import org.neuclear.commons.NeuClearException;
+ import org.neuclear.id.NSTools;
/**
***************
*** 18,21 ****
--- 15,25 ----
* $Id$
* $Log$
+ * Revision 1.3 2003/12/06 00:16:10 pelle
+ * Updated various areas in NSTools.
+ * Updated URI Validation in particular to support new expanded format
+ * Updated createUniqueID and friends to be a lot more unique and more efficient.
+ * In CryptoTools updated getRandom() to finally use a SecureRandom.
+ * Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is.
+ *
* Revision 1.2 2003/11/21 04:43:03 pelle
* EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
***************
*** 23,36 ****
* Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
* This should hopefully make everything more stable (and secure).
! *
* Revision 1.1 2003/11/10 17:42:07 pelle
* The AssetController interface has been more or less finalized.
* CurrencyController fully implemented
* AssetControlClient implementes a remote client for communicating with AssetControllers
- *
*/
public final class CancelHeldTransferReceiptBuilder extends CancelHeldTransferBuilder {
public CancelHeldTransferReceiptBuilder(final CancelHeldTransferRequest req) throws InvalidTransferException, NegativeTransferException, NeuClearException {
! super(NSTools.createUniqueNamedID(req.getAsset().getName(),req.getSignatory().getName()),TransferGlobals.CANCEL_RCPT_TAGNAME, req.getAsset(),req.getHoldId());
}
--- 27,39 ----
* Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
* This should hopefully make everything more stable (and secure).
! * <p/>
* Revision 1.1 2003/11/10 17:42:07 pelle
* The AssetController interface has been more or less finalized.
* CurrencyController fully implemented
* AssetControlClient implementes a remote client for communicating with AssetControllers
*/
public final class CancelHeldTransferReceiptBuilder extends CancelHeldTransferBuilder {
public CancelHeldTransferReceiptBuilder(final CancelHeldTransferRequest req) throws InvalidTransferException, NegativeTransferException, NeuClearException {
! super(NSTools.createUniqueTransactionID(req.getAsset().getName(), req.getSignatory().getName()), TransferGlobals.CANCEL_RCPT_TAGNAME, req.getAsset(), req.getHoldId());
}
Index: CancelHeldTransferRequestBuilder.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/contracts/builders/CancelHeldTransferRequestBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CancelHeldTransferRequestBuilder.java 21 Nov 2003 04:43:03 -0000 1.2
--- CancelHeldTransferRequestBuilder.java 6 Dec 2003 00:16:10 -0000 1.3
***************
*** 1,12 ****
package org.neuclear.asset.contracts.builders;
- import org.neuclear.asset.contracts.Asset;
- import org.neuclear.asset.contracts.TransferGlobals;
- import org.neuclear.asset.contracts.HeldTransferReceipt;
import org.neuclear.asset.InvalidTransferException;
import org.neuclear.asset.NegativeTransferException;
! import org.neuclear.id.Identity;
! import org.neuclear.id.NSTools;
import org.neuclear.commons.NeuClearException;
/**
--- 1,10 ----
package org.neuclear.asset.contracts.builders;
import org.neuclear.asset.InvalidTransferException;
import org.neuclear.asset.NegativeTransferException;
! import org.neuclear.asset.contracts.HeldTransferReceipt;
! import org.neuclear.asset.contracts.TransferGlobals;
import org.neuclear.commons.NeuClearException;
+ import org.neuclear.id.NSTools;
/**
***************
*** 17,20 ****
--- 15,25 ----
* $Id$
* $Log$
+ * Revision 1.3 2003/12/06 00:16:10 pelle
+ * Updated various areas in NSTools.
+ * Updated URI Validation in particular to support new expanded format
+ * Updated createUniqueID and friends to be a lot more unique and more efficient.
+ * In CryptoTools updated getRandom() to finally use a SecureRandom.
+ * Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is.
+ *
* Revision 1.2 2003/11/21 04:43:03 pelle
* EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
***************
*** 22,35 ****
* Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
* This should hopefully make everything more stable (and secure).
! *
* Revision 1.1 2003/11/10 17:42:07 pelle
* The AssetController interface has been more or less finalized.
* CurrencyController fully implemented
* AssetControlClient implementes a remote client for communicating with AssetControllers
- *
*/
public final class CancelHeldTransferRequestBuilder extends CancelHeldTransferBuilder {
public CancelHeldTransferRequestBuilder(final HeldTransferReceipt held) throws InvalidTransferException, NegativeTransferException, NeuClearException {
! super(NSTools.createUniqueNamedID(held.getTo().getName(),held.getAsset().getName()),TransferGlobals.CANCEL_TAGNAME, held.getAsset(),held.getName());
}
--- 27,39 ----
* Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
* This should hopefully make everything more stable (and secure).
! * <p/>
* Revision 1.1 2003/11/10 17:42:07 pelle
* The AssetController interface has been more or less finalized.
* CurrencyController fully implemented
* AssetControlClient implementes a remote client for communicating with AssetControllers
*/
public final class CancelHeldTransferRequestBuilder extends CancelHeldTransferBuilder {
public CancelHeldTransferRequestBuilder(final HeldTransferReceipt held) throws InvalidTransferException, NegativeTransferException, NeuClearException {
! super(NSTools.createUniqueTransactionID(held.getTo().getName(), held.getAsset().getName()), TransferGlobals.CANCEL_TAGNAME, held.getAsset(), held.getName());
}
Index: TransferBuilder.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/contracts/builders/TransferBuilder.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** TransferBuilder.java 28 Nov 2003 00:11:50 -0000 1.7
--- TransferBuilder.java 6 Dec 2003 00:16:10 -0000 1.8
***************
*** 35,38 ****
--- 35,45 ----
$Id$
$Log$
+ Revision 1.8 2003/12/06 00:16:10 pelle
+ Updated various areas in NSTools.
+ Updated URI Validation in particular to support new expanded format
+ Updated createUniqueID and friends to be a lot more unique and more efficient.
+ In CryptoTools updated getRandom() to finally use a SecureRandom.
+ Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is.
+
Revision 1.7 2003/11/28 00:11:50 pelle
Getting the NeuClear web transactions working.
***************
*** 90,94 ****
public abstract class TransferBuilder extends NamedObjectBuilder {
protected TransferBuilder(final String tagname, final Asset asset, final Identity signer, final Identity to, final double amount, final Date valuetime, final String comment) throws InvalidTransferException, NegativeTransferException, NeuClearException {
! super(NSTools.createUniqueNamedID(signer.getName(), to.getName()), TransferGlobals.createQName(tagname));
if (amount < 0)
throw new NegativeTransferException(amount);
--- 97,101 ----
public abstract class TransferBuilder extends NamedObjectBuilder {
protected TransferBuilder(final String tagname, final Asset asset, final Identity signer, final Identity to, final double amount, final Date valuetime, final String comment) throws InvalidTransferException, NegativeTransferException, NeuClearException {
! super(NSTools.createUniqueTransactionID(signer.getName(), to.getName()), TransferGlobals.createQName(tagname));
if (amount < 0)
throw new NegativeTransferException(amount);
|
|
From: <pe...@us...> - 2003-12-04 21:50:39
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/source
In directory sc8-pr-cvs1:/tmp/cvs-serv19614/src/java/org/neuclear/source
Modified Files:
CachedSource.java HttpSource.java Source.java
Log Message:
Mainly documentation changes.
Index: CachedSource.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/source/CachedSource.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** CachedSource.java 21 Nov 2003 04:45:14 -0000 1.13
--- CachedSource.java 4 Dec 2003 21:50:36 -0000 1.14
***************
*** 3,6 ****
--- 3,9 ----
* $Id$
* $Log$
+ * Revision 1.14 2003/12/04 21:50:36 pelle
+ * Mainly documentation changes.
+ *
* Revision 1.13 2003/11/21 04:45:14 pelle
* EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
***************
*** 107,110 ****
--- 110,118 ----
* This is a simple Cached version of the Source.
* It can be used in front of any other Source, such as a HTTP based source to cache items locally.
+ * <p/>
+ * The items are stored in a cache folder in the users home directory called:
+ * <p/>
+ * <code>~/.neuclear/cache</code>
+ * <p>This can safely be removed at all times.
*/
public final class CachedSource extends Source {
Index: HttpSource.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/source/HttpSource.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** HttpSource.java 21 Nov 2003 04:45:14 -0000 1.9
--- HttpSource.java 4 Dec 2003 21:50:36 -0000 1.10
***************
*** 1,11 ****
package org.neuclear.source;
- import org.neuclear.commons.NeuClearException;
- import org.neuclear.id.NSTools;
- import org.neuclear.id.SignedNamedObject;
-
- import java.io.InputStream;
- import java.net.URL;
-
/**
* (C) 2003 Antilles Software Ventures SA
--- 1,4 ----
***************
*** 15,18 ****
--- 8,14 ----
* $Id$
* $Log$
+ * Revision 1.10 2003/12/04 21:50:36 pelle
+ * Mainly documentation changes.
+ *
* Revision 1.9 2003/11/21 04:45:14 pelle
* EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
***************
*** 74,77 ****
--- 70,100 ----
* It doesnt quite verify things correctly yet. I'm not yet sure why.
* CommandLineSigner is simplified to make it easier to use.
+ */
+
+ import org.neuclear.commons.NeuClearException;
+ import org.neuclear.id.NSTools;
+ import org.neuclear.id.SignedNamedObject;
+
+ import java.io.InputStream;
+ import java.net.URL;
+
+ /**
+ * Implementation of Source that uses HTTP to fetch an XMLStream from a repository on a web server.
+ * <p/>
+ * The following points apply to storing the XML on the web site:
+ * <dl>
+ * <dt>The Endpoint provided should be the root of the repository of the webserver.</dt>
+ * <dd>Such as <tt>http://repository.neuclear.org</tt> and not <tt>http://repository.neuclear.org/test/bob@</tt>
+ * <dt>The files are to be stored like this on the web server:</dt>
+ * <dd>
+ * <table border="2"><tr><th>NeuClear ID</th><th>Relative path to root of repository on web server</th></tr>
+ * <tr><td><tt>neu://</tt></td><td>./root.id</td></tr>
+ * <tr><td><tt>neu://test</tt></td><td>./test/root.id</td></tr>
+ * <tr><td><tt>neu://bob@test</tt></td><td>./test/bob@/root.id</td></tr>
+ * <tr><td><tt>neu://test/alice</tt></td><td>./test/alice/root.id</td></tr>
+ * <tr><td><tt>neu://bob@test/funds</tt></td><td>./test/bob@/funds/root.id</td></tr>
+ * </table>
+ * </dd>
+ * </dl>
*/
public final class HttpSource extends Source {
Index: Source.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/source/Source.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Source.java 21 Nov 2003 04:45:14 -0000 1.7
--- Source.java 4 Dec 2003 21:50:36 -0000 1.8
***************
*** 1,15 ****
package org.neuclear.source;
- import org.neuclear.commons.NeuClearException;
- import org.neuclear.id.NSTools;
- import org.neuclear.id.SignedNamedObject;
- import org.neuclear.id.verifier.VerifyingReader;
- import org.neuclear.commons.Utility;
- import org.neuclear.xml.XMLException;
-
- import java.io.InputStream;
- import java.util.HashMap;
- import java.util.Map;
-
/**
* (C) 2003 Antilles Software Ventures SA
--- 1,4 ----
***************
*** 19,22 ****
--- 8,14 ----
* $Id$
* $Log$
+ * Revision 1.8 2003/12/04 21:50:36 pelle
+ * Mainly documentation changes.
+ *
* Revision 1.7 2003/11/21 04:45:14 pelle
* EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
***************
*** 77,80 ****
--- 69,90 ----
* CommandLineSigner is simplified to make it easier to use.
*/
+
+ import org.neuclear.commons.NeuClearException;
+ import org.neuclear.commons.Utility;
+ import org.neuclear.id.NSTools;
+ import org.neuclear.id.SignedNamedObject;
+ import org.neuclear.id.verifier.VerifyingReader;
+ import org.neuclear.xml.XMLException;
+
+ import java.io.InputStream;
+ import java.util.HashMap;
+ import java.util.Map;
+
+ /**
+ * A Source for fetching a SignedNamedObject from some specified source.
+ * Developers not writing core NeuClear services would propably prefer to use the much simpler NSResolver.
+ *
+ * @see org.neuclear.id.resolver.NSResolver
+ */
public abstract class Source {
protected Source() {
***************
*** 82,85 ****
--- 92,108 ----
}
+ /**
+ * This is the main entry point to the Source pattern. Pass it a endpoint such as a URL as well as the name of the
+ * object in mind. It operates a two level caching with verified objects in memory and raw signed object stored on
+ * disk. Currently the default implementation is @see HttpSource which fetches via http.
+ * <code>
+ * SignedNamedObject obj=Source.getInstance().fetch("http://repository.neuclear.org/","neu://test");
+ * </code>
+ *
+ * @param endpoint
+ * @param name
+ * @return
+ * @throws NeuClearException
+ */
public final SignedNamedObject fetch(final String endpoint, String name) throws NeuClearException {
try {
***************
*** 99,103 ****
/**
! * This gets the stream of the content from the source
*
* @param endpoint
--- 122,126 ----
/**
! * This gets the stream of the content from the source. Implementers should overide this and return a Stream to the Signed Unverified information.
*
* @param endpoint
|
|
From: <pe...@us...> - 2003-12-04 21:50:39
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/resolver
In directory sc8-pr-cvs1:/tmp/cvs-serv19614/src/java/org/neuclear/id/resolver
Modified Files:
NSResolver.java
Log Message:
Mainly documentation changes.
Index: NSResolver.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/resolver/NSResolver.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** NSResolver.java 21 Nov 2003 04:45:11 -0000 1.11
--- NSResolver.java 4 Dec 2003 21:50:36 -0000 1.12
***************
*** 10,14 ****
/**
! * Secure Identity resolver
*/
public final class NSResolver {
--- 10,21 ----
/**
! * Secure Identity resolver. To get an Identity object simply do:
! * <code>
! * Identity bob=NSResolver.resolveIdentity("neu://bob@test");
! * </code>
! * To resolve an arbitrary SignedNamedObject use:
! * <code>
! * SignedNamedObject obj=NSResolver.resolve("neu://bob@test/wicked");
! * </code>
*/
public final class NSResolver {
|
|
From: <pe...@us...> - 2003-12-03 23:22:09
|
Update of /cvsroot/neuclear/neuclear-commons/src/java In directory sc8-pr-cvs1:/tmp/cvs-serv23691/src/java Modified Files: neuclear-ledger.properties Added Files: neuclear-sql.properties Log Message: Got rid of ofbiz support. Way over the top for our use. --- NEW FILE: neuclear-sql.properties --- ledger.name=SuperBux ledger.class=org.neuclear.ledger.implementations.SQLLedger jndi.name=jdbc/DefaultDS jdbc.class=org.hsqldb.jdbcDriver jdbc.url=jdbc:hsqldb:target/testdata/db/ledger jdbc.username=sa jdbc.password= Index: neuclear-ledger.properties =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/java/neuclear-ledger.properties,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** neuclear-ledger.properties 20 Sep 2003 23:18:11 -0000 1.1.1.1 --- neuclear-ledger.properties 3 Dec 2003 23:22:06 -0000 1.2 *************** *** 1,6 **** ledger.name=SuperBux ledger.class=org.neuclear.ledger.implementations.SQLLedger ! jdbc.class=com.mysql.jdbc.Driver ! jdbc.url=jdbc:mysql://localhost/ledger?autoReconnect=true ! jdbc.username=ledger_user ! jdbc.password=password --- 1,7 ---- ledger.name=SuperBux ledger.class=org.neuclear.ledger.implementations.SQLLedger ! jndi.name=jdbc/DefaultDs ! jdbc.class=org.hsqldb.jdbcDriver ! jdbc.url=jdbc:hsqldb:target/testdata/db ! jdbc.username=sa ! jdbc.password= |
|
From: <pe...@us...> - 2003-12-03 23:22:09
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/sql
In directory sc8-pr-cvs1:/tmp/cvs-serv23691/src/java/org/neuclear/commons/sql
Modified Files:
DefaultConnectionSource.java SQLTools.java
XAConnectionSource.java
Log Message:
Got rid of ofbiz support. Way over the top for our use.
Index: DefaultConnectionSource.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/sql/DefaultConnectionSource.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** DefaultConnectionSource.java 1 Dec 2003 15:44:53 -0000 1.3
--- DefaultConnectionSource.java 3 Dec 2003 23:22:06 -0000 1.4
***************
*** 4,17 ****
import javax.naming.NamingException;
import java.sql.Connection;
import java.sql.SQLException;
- import java.sql.DriverManager;
- import java.io.IOException;
- import java.util.Map;
- import java.util.HashMap;
import java.util.Properties;
/**
- *
* User: pelleb
* Date: Aug 6, 2003
--- 4,13 ----
import javax.naming.NamingException;
+ import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Properties;
/**
* User: pelleb
* Date: Aug 6, 2003
***************
*** 20,25 ****
public final class DefaultConnectionSource implements ConnectionSource {
public DefaultConnectionSource() throws SQLException, NeuClearException, IOException, NamingException {
! final Properties props=SQLTools.loadProperties();
cs = new XAConnectionSource(
props.getProperty("jdbc.class"),
props.getProperty("jdbc.url"),
--- 16,22 ----
public final class DefaultConnectionSource implements ConnectionSource {
public DefaultConnectionSource() throws SQLException, NeuClearException, IOException, NamingException {
! final Properties props = SQLTools.loadProperties();
cs = new XAConnectionSource(
+ props.getProperty("jndi.name"),
props.getProperty("jdbc.class"),
props.getProperty("jdbc.url"),
Index: SQLTools.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/sql/SQLTools.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** SQLTools.java 1 Dec 2003 15:44:54 -0000 1.3
--- SQLTools.java 3 Dec 2003 23:22:06 -0000 1.4
***************
*** 1,25 ****
package org.neuclear.commons.sql;
- import org.neuclear.commons.NeuClearException;
- import org.objectweb.jotm.Jotm;
import org.objectweb.carol.util.configuration.CarolConfiguration;
import org.objectweb.carol.util.configuration.RMIConfigurationException;
- import javax.transaction.UserTransaction;
- import javax.transaction.TransactionManager;
- import javax.transaction.SystemException;
- import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NamingException;
! import java.sql.SQLException;
import java.sql.DriverManager;
import java.sql.Timestamp;
import java.util.Properties;
- import java.util.Date;
- import java.io.FileInputStream;
- import java.io.File;
- import java.io.IOException;
- import java.io.InputStream;
- import java.net.URL;
/**
--- 1,21 ----
package org.neuclear.commons.sql;
import org.objectweb.carol.util.configuration.CarolConfiguration;
import org.objectweb.carol.util.configuration.RMIConfigurationException;
+ import org.objectweb.jotm.Jotm;
import javax.naming.Context;
+ import javax.naming.InitialContext;
import javax.naming.NamingException;
! import javax.transaction.SystemException;
! import javax.transaction.TransactionManager;
! import javax.transaction.UserTransaction;
! import java.io.File;
! import java.io.FileInputStream;
! import java.io.IOException;
import java.sql.DriverManager;
+ import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Properties;
/**
***************
*** 31,39 ****
*/
public final class SQLTools {
! private static final String PROPS_FILE = "neuclear-ledger.properties";
public final static java.sql.Connection getConnection() throws SQLException, IOException {
! final Properties props=loadProperties();
! try {
Class.forName(props.getProperty("jdbc.class")).newInstance();
} catch (InstantiationException e) {
--- 27,35 ----
*/
public final class SQLTools {
! private static final String PROPS_FILE = "neuclear-sql.properties";
public final static java.sql.Connection getConnection() throws SQLException, IOException {
! final Properties props = loadProperties();
! try {
Class.forName(props.getProperty("jdbc.class")).newInstance();
} catch (InstantiationException e) {
***************
*** 54,62 ****
static Properties loadProperties() throws IOException {
! final Properties props=new Properties();
! final File propsFile= new File(
! System.getProperty("user.home")+
! System.getProperty("file.separator")+
! PROPS_FILE) ;
if (!propsFile.exists()) {
System.out.println("getting props from system classpath");
--- 50,58 ----
static Properties loadProperties() throws IOException {
! final Properties props = new Properties();
! final File propsFile = new File(
! System.getProperty("user.home") +
! System.getProperty("file.separator") +
! PROPS_FILE);
if (!propsFile.exists()) {
System.out.println("getting props from system classpath");
***************
*** 70,82 ****
public final static Timestamp toTimestamp(final java.util.Date date) {
! if (date==null)
return null;
return new Timestamp(date.getTime());
}
! public final static UserTransaction getUserTransaction() throws NamingException,SystemException {
! Context ctx = new InitialContext();
UserTransaction ut = null;
try {
! ut = (UserTransaction)ctx.lookup(USERXACT);
} catch (NamingException e) {
getTransactionManager().getTransaction();
--- 66,79 ----
public final static Timestamp toTimestamp(final java.util.Date date) {
! if (date == null)
return null;
return new Timestamp(date.getTime());
}
!
! public final static UserTransaction getUserTransaction() throws NamingException, SystemException {
! Context ctx = new InitialContext();
UserTransaction ut = null;
try {
! ut = (UserTransaction) ctx.lookup(USERXACT);
} catch (NamingException e) {
getTransactionManager().getTransaction();
***************
*** 89,105 ****
public final static synchronized TransactionManager getTransactionManager() throws NamingException {
! if (jotm==null){
Context ctx = new InitialContext();
! jotm=new Jotm(true,false);
! ctx.rebind(USERXACT,jotm.getUserTransaction());
}
return jotm.getTransactionManager();
}
! final static void loadDefaultContext(){
! try{
! System.setProperty("java.naming.factory.initial","org.objectweb.carol.jndi.spi.MultiOrbInitialContextFactory");
! Context ctx=new InitialContext();
! } catch (Exception ex){
try {
--- 86,104 ----
public final static synchronized TransactionManager getTransactionManager() throws NamingException {
! if (jotm == null) {
Context ctx = new InitialContext();
! jotm = new Jotm(true, false);
! ctx.rebind(USERXACT, jotm.getUserTransaction());
}
return jotm.getTransactionManager();
}
!
! public final static Context loadDefaultContext() {
! try {
! System.setProperty("java.naming.factory.initial", "org.objectweb.carol.jndi.spi.MultiOrbInitialContextFactory");
! Context ctx = new InitialContext();
! return ctx;
! } catch (Exception ex) {
try {
***************
*** 109,116 ****
throw new RuntimeException(e);
} catch (NamingException e) {
! throw new RuntimeException(e) ;
}
}
}
--- 108,116 ----
throw new RuntimeException(e);
} catch (NamingException e) {
! throw new RuntimeException(e);
}
}
+ return null;
}
Index: XAConnectionSource.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/sql/XAConnectionSource.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** XAConnectionSource.java 1 Dec 2003 15:44:54 -0000 1.1
--- XAConnectionSource.java 3 Dec 2003 23:22:06 -0000 1.2
***************
*** 4,19 ****
import org.neuclear.commons.NeuClearException;
! import javax.sql.XADataSource;
! import javax.sql.XAConnection;
import javax.naming.NamingException;
import java.sql.Connection;
import java.sql.SQLException;
- import java.sql.DriverManager;
- import java.io.IOException;
- import java.util.Map;
- import java.util.HashMap;
/**
- *
* User: pelleb
* Date: Aug 6, 2003
--- 4,15 ----
import org.neuclear.commons.NeuClearException;
! import javax.naming.Context;
import javax.naming.NamingException;
+ import javax.sql.XADataSource;
+ import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
/**
* User: pelleb
* Date: Aug 6, 2003
***************
*** 21,41 ****
*/
public final class XAConnectionSource implements ConnectionSource {
! public XAConnectionSource(final String driver, final String url, final String user, final String password) throws SQLException, NeuClearException, NamingException{
! SQLTools.loadDefaultContext();
try {
! Class.forName(driver).newInstance();
! } catch (InstantiationException e) {
! e.printStackTrace(); //To change body of catch statement use Options | File Templates.
! } catch (IllegalAccessException e) {
! e.printStackTrace(); //To change body of catch statement use Options | File Templates.
! } catch (ClassNotFoundException e) {
! e.printStackTrace(); //To change body of catch statement use Options | File Templates.
! }
! this.user=user;
! this.password=password;
xads = new StandardXADataSource();
((StandardXADataSource) xads).setDriverName(driver);
((StandardXADataSource) xads).setUrl(url);
((StandardXADataSource) xads).setTransactionManager(SQLTools.getTransactionManager());
}
--- 17,41 ----
*/
public final class XAConnectionSource implements ConnectionSource {
! public XAConnectionSource(final String name, final String driver, final String url, final String user, final String password) throws SQLException, NeuClearException, NamingException {
! Context ctx = SQLTools.loadDefaultContext();
! SQLTools.getTransactionManager();
try {
! Class.forName(driver).newInstance();
! } catch (InstantiationException e) {
! e.printStackTrace(); //To change body of catch statement use Options | File Templates.
! } catch (IllegalAccessException e) {
! e.printStackTrace(); //To change body of catch statement use Options | File Templates.
! } catch (ClassNotFoundException e) {
! e.printStackTrace(); //To change body of catch statement use Options | File Templates.
! }
xads = new StandardXADataSource();
((StandardXADataSource) xads).setDriverName(driver);
((StandardXADataSource) xads).setUrl(url);
((StandardXADataSource) xads).setTransactionManager(SQLTools.getTransactionManager());
+ ((StandardXADataSource) xads).setUser(user);
+ ((StandardXADataSource) xads).setPassword(password);
+
+
+ ctx.bind(name, xads);
}
***************
*** 43,51 ****
public Connection getConnection() throws SQLException, IOException {
! return xads.getXAConnection(user,password).getConnection();
}
- private final String user;
- private final String password;
private final XADataSource xads;
// private XAConnection xaConnection;
--- 43,49 ----
public Connection getConnection() throws SQLException, IOException {
! return xads.getXAConnection().getConnection();
}
private final XADataSource xads;
// private XAConnection xaConnection;
|
|
From: <pe...@us...> - 2003-12-03 23:21:47
|
Update of /cvsroot/neuclear/neuclear-ledger/src/test/org/neuclear/ledger
In directory sc8-pr-cvs1:/tmp/cvs-serv23579/src/test/org/neuclear/ledger
Modified Files:
LedgerTest.java SQLLedgerTest.java
Log Message:
Got rid of ofbiz support. Way over the top for our use.
Index: LedgerTest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-ledger/src/test/org/neuclear/ledger/LedgerTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** LedgerTest.java 21 Nov 2003 04:43:21 -0000 1.5
--- LedgerTest.java 3 Dec 2003 23:21:43 -0000 1.6
***************
*** 2,14 ****
import junit.framework.TestCase;
import java.math.BigInteger;
import java.util.Calendar;
import java.util.Date;
import java.util.Random;
- import org.neuclear.ledger.implementations.SQLLedger;
- import org.neuclear.commons.sql.DefaultConnectionSource;
-
/**
* (C) 2003 Antilles Software Ventures SA
--- 2,18 ----
import junit.framework.TestCase;
+ import org.neuclear.commons.NeuClearException;
+ import org.neuclear.commons.sql.DefaultConnectionSource;
+ import org.neuclear.ledger.implementations.SQLLedger;
+ import javax.naming.NamingException;
+ import javax.transaction.UserTransaction;
+ import java.io.IOException;
import java.math.BigInteger;
+ import java.sql.SQLException;
import java.util.Calendar;
import java.util.Date;
import java.util.Random;
/**
* (C) 2003 Antilles Software Ventures SA
***************
*** 18,21 ****
--- 22,28 ----
* $Id$
* $Log$
+ * Revision 1.6 2003/12/03 23:21:43 pelle
+ * Got rid of ofbiz support. Way over the top for our use.
+ *
* Revision 1.5 2003/11/21 04:43:21 pelle
* EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
***************
*** 23,27 ****
* Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
* This should hopefully make everything more stable (and secure).
! *
* Revision 1.4 2003/11/11 21:17:32 pelle
* Further vital reshuffling.
--- 30,34 ----
* Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
* This should hopefully make everything more stable (and secure).
! * <p/>
* Revision 1.4 2003/11/11 21:17:32 pelle
* Further vital reshuffling.
***************
*** 29,33 ****
* org.neuclear.signers.* as well as org.neuclear.passphraseagents have been moved under org.neuclear.commons.crypto as well.
* Did a bit of work on the Canonicalizer and changed a few other minor bits.
! *
* Revision 1.3 2003/10/29 21:15:13 pelle
* Refactored the whole signing process. Now we have an interface called Signer which is the old SignerStore.
--- 36,40 ----
* org.neuclear.signers.* as well as org.neuclear.passphraseagents have been moved under org.neuclear.commons.crypto as well.
* Did a bit of work on the Canonicalizer and changed a few other minor bits.
! * <p/>
* Revision 1.3 2003/10/29 21:15:13 pelle
* Refactored the whole signing process. Now we have an interface called Signer which is the old SignerStore.
***************
*** 36,40 ****
* This new Signer pattern allows us to use secure signing hardware such as N-Cipher in the future for server applications as well
* as SmartCards for end user applications.
! *
* Revision 1.2 2003/10/28 23:43:15 pelle
* The GuiDialogAgent now works. It simply presents itself as a simple modal dialog box asking for a passphrase.
--- 43,47 ----
* This new Signer pattern allows us to use secure signing hardware such as N-Cipher in the future for server applications as well
* as SmartCards for end user applications.
! * <p/>
* Revision 1.2 2003/10/28 23:43:15 pelle
* The GuiDialogAgent now works. It simply presents itself as a simple modal dialog box asking for a passphrase.
***************
*** 105,109 ****
! public LedgerTest(final String s) throws LowlevelLedgerException, UnknownLedgerException {
super(s);
ledger = new SQLLedger(new DefaultConnectionSource(), "neu://superbux/reserve");
--- 112,116 ----
! public LedgerTest(final String s) throws LowlevelLedgerException, UnknownLedgerException, SQLException, NamingException, IOException, NeuClearException {
super(s);
ledger = new SQLLedger(new DefaultConnectionSource(), "neu://superbux/reserve");
***************
*** 117,121 ****
--- 124,130 ----
final Book alice = getNewAliceBook();
final Date t1 = new Date();
+ UserTransaction ut = ledger.beginUT();
bob.transfer(alice, 100, "Loan", t1);
+ ledger.commitUT(ut);
}
***************
*** 136,142 ****
--- 145,153 ----
public final void testAccountCreate() throws LedgerException {
+ UserTransaction ut = ledger.beginUT();
final Book bob = getNewBobBook();
assertNotNull(bob);
assertTrue(ledger.bookExists(bob.getBookID()));
+ ledger.commitUT(ut);
}
***************
*** 148,154 ****
--- 159,168 ----
final double amount = 105;
final Date t1 = new Date();
+ UserTransaction ut = ledger.beginUT();
+
alice.transfer(bob, amount, "Repayment", t1);
assertEquals(aliceBalance - amount, alice.getBalance(), 0);
assertEquals(bobBalance + amount, bob.getBalance(), 0);
+ ledger.commitUT(ut);
}
***************
*** 164,167 ****
--- 178,182 ----
cal.add(Calendar.DAY_OF_YEAR, 1);
final Date t5 = cal.getTime();
+ UserTransaction ut = ledger.beginUT();
final Book alice = getNewAliceBook();
***************
*** 188,191 ****
--- 203,208 ----
assertEquals(aliceBalance - amount, alice.getBalance(t5), 0);
assertEquals(bobBalance + amount, bob.getBalance(t5), 0);
+ ledger.commitUT(ut);
+
}
***************
*** 201,204 ****
--- 218,222 ----
cal.add(Calendar.DAY_OF_YEAR, 1);
final Date t5 = cal.getTime();
+ UserTransaction ut = ledger.beginUT();
final Book alice = getNewAliceBook();
***************
*** 243,250 ****
--- 261,270 ----
assertEquals(bob.getBalance(t5), bob.getAvailableBalance(t5), 0);
}
+ ledger.commitUT(ut);
}
public final void testReversal() throws LedgerException {
+ UserTransaction ut = ledger.beginUT();
final Book bob = getNewBobBook();
final Book alice = getNewAliceBook();
***************
*** 259,262 ****
--- 279,283 ----
assertNotNull(reverse);
assertEquals(bob.getBalance(), balance, 0);
+ ledger.commitUT(ut);
}
***************
*** 274,277 ****
--- 295,299 ----
final Date t5 = cal.getTime();
+ UserTransaction ut = ledger.beginUT();
final Book ignacio = createNewBook("neu://verax/testusers/Ignacio");
***************
*** 318,325 ****
--- 340,349 ----
assertTrue("Did throw exception here", true);
}
+ ledger.commitUT(ut);
}
public final void testFindTransaction() throws LowlevelLedgerException, BookExistsException, UnBalancedTransactionException, InvalidTransactionException, UnknownTransactionException, UnknownBookException {
+ UserTransaction ut = ledger.beginUT();
final Book bob = getNewBobBook();
final Book alice = getNewAliceBook();
***************
*** 331,337 ****
--- 355,363 ----
assertNotNull(found);
assertEquals(found.getXid(), tran.getXid());
+ ledger.commitUT(ut);
}
public final void testFindHeldTransaction() throws LowlevelLedgerException, BookExistsException, UnBalancedTransactionException, InvalidTransactionException, UnknownTransactionException, UnknownBookException {
+ UserTransaction ut = ledger.beginUT();
final Book bob = getNewBobBook();
final Book alice = getNewAliceBook();
***************
*** 343,349 ****
--- 369,377 ----
assertNotNull(found);
assertEquals(found.getXid(), tran.getXid());
+ ledger.commitUT(ut);
}
public final void testCancelHeld() throws LedgerException {
+ UserTransaction ut = ledger.beginUT();
final Calendar cal = Calendar.getInstance();
final Date t1 = cal.getTime();
***************
*** 376,379 ****
--- 404,408 ----
}
+ ledger.commitUT(ut);
}
Index: SQLLedgerTest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-ledger/src/test/org/neuclear/ledger/SQLLedgerTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SQLLedgerTest.java 21 Nov 2003 04:43:21 -0000 1.2
--- SQLLedgerTest.java 3 Dec 2003 23:21:43 -0000 1.3
***************
*** 1,11 ****
package org.neuclear.ledger;
! import org.neuclear.ledger.implementations.SQLLedger;
! import org.neuclear.commons.sql.SQLTools;
! import java.sql.Connection;
! import java.sql.DriverManager;
! import java.sql.SQLException;
import java.io.IOException;
/**
--- 1,9 ----
package org.neuclear.ledger;
! import org.neuclear.commons.NeuClearException;
! import javax.naming.NamingException;
import java.io.IOException;
+ import java.sql.SQLException;
/**
***************
*** 16,22 ****
* To change this template use Options | File Templates.
*/
! public final class SQLLedgerTest extends LedgerTest{
! public SQLLedgerTest(final String s) throws LowlevelLedgerException, UnknownLedgerException {
super(s);
}
--- 14,21 ----
* To change this template use Options | File Templates.
*/
! public final class SQLLedgerTest extends LedgerTest {
! public SQLLedgerTest(final String s) throws LowlevelLedgerException, UnknownLedgerException, SQLException, NamingException, IOException, NeuClearException {
super(s);
+
}
|
|
From: <pe...@us...> - 2003-12-03 23:21:47
|
Update of /cvsroot/neuclear/neuclear-ledger/src/test/org/neuclear/ledger/implementations
In directory sc8-pr-cvs1:/tmp/cvs-serv23579/src/test/org/neuclear/ledger/implementations
Modified Files:
EntityLedgerTest.java
Log Message:
Got rid of ofbiz support. Way over the top for our use.
Index: EntityLedgerTest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-ledger/src/test/org/neuclear/ledger/implementations/EntityLedgerTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** EntityLedgerTest.java 21 Nov 2003 04:43:21 -0000 1.2
--- EntityLedgerTest.java 3 Dec 2003 23:21:43 -0000 1.3
***************
*** 2,6 ****
--- 2,16 ----
import junit.framework.TestCase;
+ import org.neuclear.commons.NeuClearException;
+ import org.neuclear.commons.sql.DefaultConnectionSource;
import org.neuclear.commons.time.TimeTools;
+ import org.ofbiz.core.entity.GenericDelegator;
+ import org.ofbiz.core.entity.GenericEntityException;
+ import org.ofbiz.core.entity.GenericValue;
+ import org.ofbiz.core.util.UtilMisc;
+
+ import javax.naming.NamingException;
+ import java.io.IOException;
+ import java.sql.SQLException;
/*
***************
*** 24,27 ****
--- 34,40 ----
$Id$
$Log$
+ Revision 1.3 2003/12/03 23:21:43 pelle
+ Got rid of ofbiz support. Way over the top for our use.
+
Revision 1.2 2003/11/21 04:43:21 pelle
EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
***************
*** 44,49 ****
*/
public final class EntityLedgerTest extends TestCase {
! /* public void testEntityEngine() throws GenericEntityException {
//Instantiate the delegator.
GenericDelegator delegator = GenericDelegator.getGenericDelegator("default");
--- 57,66 ----
*/
public final class EntityLedgerTest extends TestCase {
+ public EntityLedgerTest(String string) throws NamingException, SQLException, IOException, NeuClearException {
+ super(string);
+ new DefaultConnectionSource();
+ }
! public void testEntityEngine() throws GenericEntityException {
//Instantiate the delegator.
GenericDelegator delegator = GenericDelegator.getGenericDelegator("default");
***************
*** 61,64 ****
UtilMisc.toMap("id", "neu://test"));
assertNotNull("Couldn't find Ledger", foundBook);
! }*/
}
--- 78,82 ----
UtilMisc.toMap("id", "neu://test"));
assertNotNull("Couldn't find Ledger", foundBook);
! }
!
}
|
Update of /cvsroot/neuclear/neuclear-ledger/src/java/entitydefs In directory sc8-pr-cvs1:/tmp/cvs-serv23579/src/java/entitydefs Removed Files: entitygroup.xml entitymodel.xml fieldtype-cloudscape.xml fieldtype-firebird.xml fieldtype-hsql.xml fieldtype-mckoidb.xml fieldtype-mssql.xml fieldtype-mysql.xml fieldtype-oracle.xml fieldtype-postgres.xml fieldtype-postgres72.xml fieldtype-sapdb.xml fieldtype-sybase.xml Log Message: Got rid of ofbiz support. Way over the top for our use. --- entitygroup.xml DELETED --- --- entitymodel.xml DELETED --- --- fieldtype-cloudscape.xml DELETED --- --- fieldtype-firebird.xml DELETED --- --- fieldtype-hsql.xml DELETED --- --- fieldtype-mckoidb.xml DELETED --- --- fieldtype-mssql.xml DELETED --- --- fieldtype-mysql.xml DELETED --- --- fieldtype-oracle.xml DELETED --- --- fieldtype-postgres.xml DELETED --- --- fieldtype-postgres72.xml DELETED --- --- fieldtype-sapdb.xml DELETED --- --- fieldtype-sybase.xml DELETED --- |