You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(119) |
Oct
(111) |
Nov
(238) |
Dec
(395) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(239) |
Feb
(59) |
Mar
(354) |
Apr
(489) |
May
(23) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
(4) |
May
(5) |
Jun
(2) |
Jul
|
Aug
|
Sep
(3) |
Oct
(14) |
Nov
(17) |
Dec
(9) |
| 2007 |
Jan
(4) |
Feb
(3) |
Mar
|
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
|
Aug
|
Sep
(1) |
Oct
(2) |
Nov
(1) |
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
(7) |
May
(3) |
Jun
(6) |
Jul
(4) |
Aug
(3) |
Sep
(15) |
Oct
(13) |
Nov
(35) |
Dec
(40) |
| 2009 |
Jan
(19) |
Feb
(21) |
Mar
(16) |
Apr
(18) |
May
(36) |
Jun
(20) |
Jul
(32) |
Aug
(11) |
Sep
(3) |
Oct
(2) |
Nov
(2) |
Dec
(13) |
| 2010 |
Jan
(5) |
Feb
(5) |
Mar
(7) |
Apr
(1) |
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
(1) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
(1) |
Aug
(1) |
Sep
(1) |
Oct
(4) |
Nov
|
Dec
(3) |
| 2012 |
Jan
(3) |
Feb
(3) |
Mar
(1) |
Apr
(4) |
May
(8) |
Jun
(4) |
Jul
(9) |
Aug
(2) |
Sep
(8) |
Oct
(3) |
Nov
(8) |
Dec
(4) |
| 2013 |
Jan
(2) |
Feb
(1) |
Mar
(5) |
Apr
(6) |
May
(10) |
Jun
(5) |
Jul
(6) |
Aug
(7) |
Sep
(5) |
Oct
(2) |
Nov
(4) |
Dec
(4) |
| 2014 |
Jan
(13) |
Feb
(4) |
Mar
(7) |
Apr
(9) |
May
(20) |
Jun
(13) |
Jul
(10) |
Aug
(3) |
Sep
(5) |
Oct
(2) |
Nov
(2) |
Dec
(2) |
| 2015 |
Jan
(3) |
Feb
(3) |
Mar
(5) |
Apr
(4) |
May
(3) |
Jun
(2) |
Jul
(4) |
Aug
(3) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
(3) |
| 2016 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
(4) |
Sep
(3) |
Oct
(3) |
Nov
(4) |
Dec
(2) |
| 2017 |
Jan
|
Feb
(2) |
Mar
|
Apr
(2) |
May
(1) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <pe...@us...> - 2004-03-05 23:26:34
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/channels In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23701/src/java/org/neuclear/commons/crypto/channels Log Message: Directory /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/channels added to the repository |
|
From: <bug...@ve...> - 2004-03-05 20:26:50
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://devone.veraxpay.com:9090/browse/XMLSIG-4 Here is an overview of the issue: --------------------------------------------------------------------- Key: XMLSIG-4 Summary: Allow multiple References in constructor to SignedInfo Type: New Feature Status: Open Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear XMLSig Fix Fors: 0.12 Versions: 0.12 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Fri, 5 Mar 2004 12:19 PM Updated: Fri, 5 Mar 2004 12:19 PM Description: --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://devone.veraxpay.com:9090/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-03-05 20:23:45
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://devone.veraxpay.com:9090/browse/XMLSIG-3 Here is an overview of the issue: --------------------------------------------------------------------- Key: XMLSIG-3 Summary: Add getReferences() to SignedInfo Type: New Feature Status: Open Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear XMLSig Fix Fors: 0.12 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Fri, 5 Mar 2004 12:15 PM Updated: Fri, 5 Mar 2004 12:15 PM Description: SignedInfo needs to return an unmodifiable List of its included References. It also needs to be able to take multiple references in its Constructor. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://devone.veraxpay.com:9090/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-03-05 20:20:46
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://devone.veraxpay.com:9090/browse/XMLSIG-2 Here is an overview of the issue: --------------------------------------------------------------------- Key: XMLSIG-2 Summary: Add getData() to Reference Type: New Feature Status: Open Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear XMLSig Fix Fors: 0.12 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Fri, 5 Mar 2004 12:13 PM Updated: Fri, 5 Mar 2004 12:13 PM Description: To verify exactly what was signed, we need to have a reference to the original data from Reference. I am not sure how to do it yet, but will probably take some ideas from JSR105 and simply return the URI, which could be referenced via the XMLSignature class. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://devone.veraxpay.com:9090/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-03-05 19:47:45
|
Message:
The following issue has been closed.
Resolver: Pelle Braendgaard
Date: Fri, 5 Mar 2004 11:39 AM
XML Pull doesn't fit all that well within the XMLSig verification pattern. Lets skip this.
---------------------------------------------------------------------
View the issue:
http://devone.veraxpay.com:9090/browse/NEU-3
Here is an overview of the issue:
---------------------------------------------------------------------
Key: NEU-3
Summary: Implement XML Pull based verifier.
Type: New Feature
Status: Closed
Priority: Major
Resolution: WON'T FIX
Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown
Project: NeuClear Identity
Fix Fors:
1.0
Versions:
0.7
Assignee: Pelle Braendgaard
Reporter: Pelle Braendgaard
Created: Mon, 22 Sep 2003 12:03 PM
Updated: Fri, 5 Mar 2004 11:39 AM
Description:
Adding an XML Pull based verifier would drastically improve performance for transaction verifiers.
It should probably be made the standard method for verifying transactions which ofcourse means a new xmlsec implementation for XMLPull.
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://devone.veraxpay.com:9090/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|
|
From: <bug...@ve...> - 2004-03-05 19:45:49
|
Message:
The following issue has been closed.
Resolver: Pelle Braendgaard
Date: Fri, 5 Mar 2004 11:37 AM
No real need for this at the moment.
---------------------------------------------------------------------
View the issue:
http://devone.veraxpay.com:9090/browse/BET-4
Here is an overview of the issue:
---------------------------------------------------------------------
Key: BET-4
Summary: Add Database implemented version of Pari Mutual totalizer
Type: New Feature
Status: Closed
Priority: Major
Resolution: WON'T FIX
Original Estimate: 4 days
Time Spent: Unknown
Remaining: 4 days
Project: NeuClear Bet
Assignee: Pelle Braendgaard
Reporter: Pelle Braendgaard
Created: Sat, 23 Aug 2003 4:20 PM
Updated: Fri, 5 Mar 2004 11:37 AM
Description:
The current totalizer works entirely in memory.
A version needs to be developed that uses a database for storage of events, outcomes and bets.
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://devone.veraxpay.com:9090/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|
|
From: <bug...@ve...> - 2004-03-05 19:44:32
|
Message:
The following issue has been closed.
Resolver: Pelle Braendgaard
Date: Fri, 5 Mar 2004 11:35 AM
There really is no reason that I can see to do this.
---------------------------------------------------------------------
View the issue:
http://devone.veraxpay.com:9090/browse/NEU-6
Here is an overview of the issue:
---------------------------------------------------------------------
Key: NEU-6
Summary: Fully create JCE implementation of Certificate Infrastructure
Type: New Feature
Status: Closed
Priority: Minor
Resolution: WON'T FIX
Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown
Project: NeuClear Identity
Fix Fors:
1.0
Assignee: Pelle Braendgaard
Reporter: Pelle Braendgaard
Created: Wed, 1 Oct 2003 12:58 PM
Updated: Fri, 5 Mar 2004 11:35 AM
Description:
It might be usefull to create a version of neuclear-id in the future that is fully compatible with Sun JCE's Certificate and CertificatePath framework: http://java.sun.com/j2se/1.4.2/docs/guide/security/certpath/CertPathProgGuide.html
Why? Mainly because it would allow easier integration within existing pki code, the main interesting one for me being codesigning.
Why not? The API is bloated and I dont think very easy to work with. It isnt very appropriate either for Server or J2ME based apps due to its bloat.
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://devone.veraxpay.com:9090/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|
|
From: <bug...@ve...> - 2004-03-05 19:32:49
|
Message: The following issue has been closed. --------------------------------------------------------------------- View the issue: http://devone.veraxpay.com:9090/browse/NEU-20 Here is an overview of the issue: --------------------------------------------------------------------- Key: NEU-20 Summary: Add AuthorizationFilter Type: New Feature Status: Closed Priority: Major Resolution: FIXED Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Identity Fix Fors: 0.8 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Fri, 21 Nov 2003 7:35 PM Updated: Fri, 5 Mar 2004 11:25 AM Description: We need an authorization servlet filter to require a user to have logged in earlier through the AuthenticationServlet. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://devone.veraxpay.com:9090/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-03-05 19:32:44
|
Message: Work on this issue has been started by Pelle Braendgaard (mailto:pe...@ve...) --------------------------------------------------------------------- View the issue: http://devone.veraxpay.com:9090/browse/GL-16 Here is an overview of the issue: --------------------------------------------------------------------- Key: GL-16 Summary: Create LedgerBrowserServlet Type: New Feature Status: In Progress Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Ledger Fix Fors: r_0_4 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Wed, 19 Nov 2003 12:26 PM Updated: Fri, 5 Mar 2004 11:24 AM Description: Create a LedgerBrowserServlet, which will format and page the items for a particular account a ledger. The Servlet should be setup in its Init parameters with information about: - The Ledger Instance to use - The Ledger ID The account in mention will be determined by a request parameter. AccessControl should be done outside of this Servlet in a filter. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://devone.veraxpay.com:9090/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-03-05 19:30:45
|
Message: The following issue has been closed. --------------------------------------------------------------------- View the issue: http://devone.veraxpay.com:9090/browse/XMLSIG-1 Here is an overview of the issue: --------------------------------------------------------------------- Key: XMLSIG-1 Summary: XMLInputStreamServlet misparses base64 encoded xml Type: Bug Status: Closed Priority: Major Resolution: FIXED Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear XMLSig Fix Fors: 0.10 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Fri, 21 Nov 2003 7:28 PM Updated: Fri, 5 Mar 2004 11:23 AM Description: org.neuclear.xml.XMLException: org.dom4j.DocumentException: null Nested exception: null at org.neuclear.xml.XMLTools.rethrowException(XMLTools.java:274) at org.neuclear.xml.XMLTools.loadDocument(XMLTools.java:179) at org.neuclear.id.verifier.VerifyingReader.read(VerifyingReader.java:139) at org.neuclear.receiver.ReceiverServlet.handleInputStream(ReceiverServlet.java:115) at org.neuclear.xml.soap.XMLInputStreamServlet.doPost(XMLInputStreamServlet.java:86) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://devone.veraxpay.com:9090/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-03-05 19:28:44
|
Message: The following issue has been closed. --------------------------------------------------------------------- View the issue: http://devone.veraxpay.com:9090/browse/NEU-12 Here is an overview of the issue: --------------------------------------------------------------------- Key: NEU-12 Summary: EncryptedFileStore throws NoSuchAlgorithmException Type: Bug Status: Closed Priority: Major Resolution: FIXED Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Identity Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Tue, 18 Nov 2003 4:06 PM Updated: Fri, 5 Mar 2004 11:20 AM Description: It claims that AES doesnt exist. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://devone.veraxpay.com:9090/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-03-05 19:26:46
|
Message: The following issue has been closed. --------------------------------------------------------------------- View the issue: http://devone.veraxpay.com:9090/browse/NEU-13 Here is an overview of the issue: --------------------------------------------------------------------- Key: NEU-13 Summary: Implement some sort of versioning on Store Type: New Feature Status: Closed Priority: Major Resolution: WON'T FIX Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Identity Fix Fors: 1.0 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Tue, 18 Nov 2003 4:09 PM Updated: Fri, 5 Mar 2004 11:18 AM Description: We need to have some sort of way of managing changes to Certificates. This should be done using some sort of Versioning system. More thought is needed. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://devone.veraxpay.com:9090/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-03-05 19:24:51
|
Message: The following issue has been closed. --------------------------------------------------------------------- View the issue: http://devone.veraxpay.com:9090/browse/PAY-6 Here is an overview of the issue: --------------------------------------------------------------------- Key: PAY-6 Summary: Create Asset Controller Servlet Type: New Feature Status: Closed Priority: Major Resolution: FIXED Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Payments Fix Fors: 0.3 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Tue, 18 Nov 2003 6:08 PM Updated: Fri, 5 Mar 2004 11:17 AM Description: The AssetControl server is a wrapper around the AssetControlReceiver. This should also allow JSP's etc in the web application a way of receiving information about the Asset. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://devone.veraxpay.com:9090/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <pe...@us...> - 2004-03-04 22:07:50
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25355/src/java/org/neuclear/commons/crypto Modified Files: Base32.java Log Message: Fixed Base32 encoding. I now use a more elegant understandable approach using BigInteger. It is however 2-3 times slower than Tyler's approach. I'm trying to cut down on the amount of dependencies, and dont want to import another jar for just one method. Index: Base32.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/Base32.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Base32.java 3 Mar 2004 23:24:25 -0000 1.5 --- Base32.java 4 Mar 2004 21:54:13 -0000 1.6 *************** *** 2,5 **** --- 2,6 ---- import java.math.BigInteger; + /* NeuClear Distributed Transaction Clearing Platform *************** *** 22,25 **** --- 23,29 ---- $Id$ $Log$ + Revision 1.6 2004/03/04 21:54:13 pelle + Fixed Base32 encoding. I now use a more elegant understandable approach using BigInteger. It is however 2-3 times slower than Tyler's approach. I'm trying to cut down on the amount of dependencies, and dont want to import another jar for just one method. + Revision 1.5 2004/03/03 23:24:25 pelle Added a "test" alias to testkeys.jks *************** *** 48,145 **** public final class Base32 { //Disallow Instantiation ! private Base32(){ } /** ! * Encode in Base32 the given <code>{@link java.math.BigInteger}<code>. ! * ! * @param big ! * @return String with Base32 encoding ! */ ! public static String encode(final BigInteger big) { // System.out.println("JDK toByteArray(): "+encode(big.toByteArray())); // System.out.println("getBytes(): "+encode(getBytes(big))); ! return encode(big.toByteArray()); ! } ! ! /** ! * Method decodeBase32Element ! * ! * ! * @param raw ! * ! * @return ! */ ! public static byte[] decode(final byte[] raw) throws CryptoException { ! final int baselength = (raw.length*5); ! final int mod=baselength%8; ! final int length=getDecodedLength(raw.length); ! final byte decoded[]=new byte[length]; ! final byte chunk[]=new byte[5]; ! long chs=0; ! for (int ri=0,di=0;ri<(raw.length);ri=ri+8,di=di+5){ ! int rchsize=(raw.length-ri)>=8?8:(raw.length-ri); ! for (int j=0;j<rchsize;j++){ ! chs=(chs<<5)|decodeVal(raw[ri+j]); ! } ! switch(rchsize){ ! case 0: ! break; ! case 8: ! break; ! case 2: ! if ((chs&0x03)!=0) ! throw new CryptoException("Encoding Error"); ! chs>>=2; ! break; ! case 4: ! if ((chs&0x0F)!=0) throw new CryptoException("Encoding Error"); ! chs>>=4; ! break; ! case 5: ! if ((chs&0x01)!=0) throw new CryptoException("Encoding Error"); ! chs>>=1; ! break; ! case 7: ! if ((chs&0x07)!=0) throw new CryptoException("Encoding Error"); ! chs>>=3; ! break; ! default: throw new CryptoException("Encoding Error"); ! } ! int chsize=(length-di)>=5?5:(length-di); ! for (int j=0;j<chsize;j++){ ! decoded[di+(chsize-1-j)]=(byte) ((chs>>(8*j))&0xFF); ! } ! } ! return decoded; ! } ! /** ! * <p>Decode a Base32-encoded string to a byte array</p> ! * ! * @param base32 <code>String</code> encoded string (single line only !!) ! * @return Decoded data in a byte array ! */ ! public static byte[] decode(final String base32) throws CryptoException { ! return decode(base32.getBytes()); ! } ! /** ! * ! * @param raw <code>byte[]<code> to be base32 encoded ! * @return the <code>String<code> with encoded data ! */ ! public static String encode(final byte[] raw) { ! return new String(encodeToByteArray(raw)); ! } /** --- 52,147 ---- public final class Base32 { //Disallow Instantiation ! private Base32() { } + /** ! * Encode in Base32 the given <code>{@link java.math.BigInteger}<code>. ! * ! * @param big ! * @return String with Base32 encoding ! */ ! public static String encode(final BigInteger big) { // System.out.println("JDK toByteArray(): "+encode(big.toByteArray())); // System.out.println("getBytes(): "+encode(getBytes(big))); ! return encode(big.toByteArray()); ! } ! /** ! * Method decodeBase32Element ! * ! * @param raw ! * @return ! */ ! public static byte[] decode(final byte[] raw) throws CryptoException { ! final int baselength = (raw.length * 5); ! final int mod = baselength % 8; ! final int length = getDecodedLength(raw.length); ! final byte decoded[] = new byte[length]; ! final byte chunk[] = new byte[5]; ! long chs = 0; ! for (int ri = 0, di = 0; ri < (raw.length); ri = ri + 8, di = di + 5) { ! int rchsize = (raw.length - ri) >= 8 ? 8 : (raw.length - ri); ! for (int j = 0; j < rchsize; j++) { ! chs = (chs << 5) | decodeVal(raw[ri + j]); ! } ! switch (rchsize) { ! case 0: ! break; ! case 8: ! break; ! case 2: ! if ((chs & 0x03) != 0) throw new CryptoException("Encoding Error"); ! chs >>= 2; ! break; ! case 4: ! if ((chs & 0x0F) != 0) throw new CryptoException("Encoding Error"); ! chs >>= 4; ! break; ! case 5: ! if ((chs & 0x01) != 0) throw new CryptoException("Encoding Error"); ! chs >>= 1; ! break; ! case 7: ! if ((chs & 0x07) != 0) throw new CryptoException("Encoding Error"); ! chs >>= 3; ! break; ! default: ! throw new CryptoException("Encoding Error"); ! } ! int chsize = (length - di) >= 5 ? 5 : (length - di); ! for (int j = 0; j < chsize; j++) { ! decoded[di + (chsize - 1 - j)] = (byte) ((chs >> (8 * j)) & 0xFF); ! } ! } ! return decoded; ! } ! /** ! * <p>Decode a Base32-encoded string to a byte array</p> ! * ! * @param base32 <code>String</code> encoded string (single line only !!) ! * @return Decoded data in a byte array ! */ ! public static byte[] decode(final String base32) throws CryptoException { ! return decode(base32.getBytes()); ! } ! /** ! * @param raw <code>byte[]<code> to be base32 encoded ! * @return the <code>String<code> with encoded data ! */ ! public static String encode(final byte[] raw) { ! // return com.waterken.url.Base32.encode(raw); ! return new String(encodeToByteArray(raw)); ! } /** *************** *** 152,169 **** return encode(raw.getBytes()); } ! ! public static int getEncodedLength(int src) { ! final int baselength = src*8; ! final int mod=baselength%5; ! if (mod!=0) ! return baselength/5+1; ! return baselength/5; ! } ! public static int getDecodedLength(int src) { ! final int baselength = src*5; ! return baselength/8; } ! public static byte[] encodeToByteArray(final byte[]raw) { final int baselength = (raw.length*8); final int mod=baselength%5; --- 154,175 ---- return encode(raw.getBytes()); } ! ! public static int getEncodedLength(int src) { ! final int baselength = src * 8; ! final int mod = baselength % 5; ! if (mod != 0) ! return baselength / 5 + 1; ! return baselength / 5; } ! public static int getDecodedLength(int src) { ! final int baselength = src * 5; ! return baselength / 8; ! } ! ! // More efficient but doesnt work so I've disabled it for the more elegant and working ! // version using BigInteger ! /* ! public static byte[] encodeToByteArrayOrig(final byte[]raw) { final int baselength = (raw.length*8); final int mod=baselength%5; *************** *** 179,186 **** int rcsize=(raw.length-ri)>=5?5:(raw.length-ri); for (int j=ri;j<(ri+rcsize);j++){ ! chs|=raw[j]; chs<<=8; } ! chs>>=8; int ecsize=(length-ei)>=8?8:(length-ei); switch((ecsize)){ --- 185,192 ---- int rcsize=(raw.length-ri)>=5?5:(raw.length-ri); for (int j=ri;j<(ri+rcsize);j++){ ! chs|=(byte)raw[j]; chs<<=8; } ! // chs>>=8; int ecsize=(length-ei)>=8?8:(length-ei); switch((ecsize)){ *************** *** 205,224 **** return encoded; } ! private static byte getPart(long chunk,int num){ ! return (byte) ((chunk>>>((7-num)*5))&31); ! } private static byte encodeVal(byte val) { ! if (val>31) throw new RuntimeException("Base32 Encoding Overflow"); return CROSS[val]; } private static byte decodeVal(byte val) throws CryptoException { ! if(val >= 'a' && val <= 'z') return (byte) (val - 'a'); ! else if(val >= '2' && val <= '7') return (byte) (val - '2' + 26); ! else if(val>= 'A' && val <= 'Z') ! return (byte)(val - 'A'); else throw new CryptoException("Encode Overflow"); --- 211,264 ---- return encoded; } ! */ ! ! public static byte[] encodeToByteArray(final byte[] raw) { ! final int length = getEncodedLength(raw.length); ! final byte encoded[] = new byte[length]; ! if (length > 0) { ! BigInteger data = new BigInteger(raw); ! //Handle exceptions ! switch (length % 8) { ! case 2: ! data = data.shiftLeft(2); ! break; ! case 4: ! data = data.shiftLeft(4); ! break; ! case 5: ! data = data.shiftLeft(1); ! break; ! case 7: ! data = data.shiftLeft(3); ! break; ! } ! for (int i = length - 1; i >= 0; i--) { ! encoded[i] = encodeVal((byte) (data.byteValue() & 31)); ! // encoded[i]=encodeVal(data.and(MASK).byteValue()); ! data = data.shiftRight(5); ! } ! } ! return encoded; ! } ! ! private static final BigInteger MASK = new BigInteger(new byte[]{(byte) 31}); ! ! private static byte getPart(long chunk, int num) { ! return (byte) ((chunk >>> ((7 - num) * 5)) & 31); ! } private static byte encodeVal(byte val) { ! if (val > 31) throw new RuntimeException("Base32 Encoding Overflow"); return CROSS[val]; } + private static byte decodeVal(byte val) throws CryptoException { ! if (val >= 'a' && val <= 'z') return (byte) (val - 'a'); ! else if (val >= '2' && val <= '7') return (byte) (val - '2' + 26); ! else if (val >= 'A' && val <= 'Z') ! return (byte) (val - 'A'); else throw new CryptoException("Encode Overflow"); *************** *** 226,233 **** private static final byte[] CROSS = new byte[]{ ! 'a','b','c','d','e','f','g','h', ! 'i','j','k','l','m','n','o','p', ! 'q','r','s','t','u','v','w','x', ! 'y','z','2','3','4','5','6','7' }; --- 266,273 ---- private static final byte[] CROSS = new byte[]{ ! 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', ! 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', ! 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', ! 'y', 'z', '2', '3', '4', '5', '6', '7' }; |
|
From: <pe...@us...> - 2004-03-04 22:07:50
|
Update of /cvsroot/neuclear/neuclear-commons/src/test/org/neuclear/commons/crypto In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25355/src/test/org/neuclear/commons/crypto Modified Files: Base32Tests.java Log Message: Fixed Base32 encoding. I now use a more elegant understandable approach using BigInteger. It is however 2-3 times slower than Tyler's approach. I'm trying to cut down on the amount of dependencies, and dont want to import another jar for just one method. Index: Base32Tests.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/test/org/neuclear/commons/crypto/Base32Tests.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Base32Tests.java 3 Mar 2004 23:24:25 -0000 1.7 --- Base32Tests.java 4 Mar 2004 21:54:14 -0000 1.8 *************** *** 23,26 **** --- 23,29 ---- $Id$ $Log$ + Revision 1.8 2004/03/04 21:54:14 pelle + Fixed Base32 encoding. I now use a more elegant understandable approach using BigInteger. It is however 2-3 times slower than Tyler's approach. I'm trying to cut down on the amount of dependencies, and dont want to import another jar for just one method. + Revision 1.7 2004/03/03 23:24:25 pelle Added a "test" alias to testkeys.jks *************** *** 51,57 **** /** ! * User: pelleb ! * Date: Jan 16, 2004 ! * Time: 9:52:41 PM */ public class Base32Tests extends TestCase { --- 54,58 ---- /** ! * Tests of Base32 Encode. I'm testing against data produced by Tyler Close http://www.waterken.com's implementation */ public class Base32Tests extends TestCase { *************** *** 83,99 **** public void testSHA1vsDecodedTyler() throws CryptoException { ! for (int i=0;i<TESTSTRINGS.length;i++){ ! assertTrue("TESTSTRINGS["+i+"]",CryptoTools.equalByteArrays(CryptoTools.digest(TESTSTRINGS[i]),Base32.decode(TYLER_SHA1_OUTPUT[i]))); } } public void testSHA1vsDecodedOwn() throws CryptoException { ! for (int i=0;i<TESTSTRINGS.length;i++){ ! byte[] hash=Base32.encode(CryptoTools.digest(TESTSTRINGS[i])).getBytes(); ! assertTrue("TESTSTRINGS["+i+"]",CryptoTools.equalByteArrays(CryptoTools.digest(TESTSTRINGS[i]),Base32.decode(hash))); } } public void testSHA1HomevsTyler() throws CryptoException { ! for (int i=0;i<TESTSTRINGS.length;i++){ ! assertEquals("TESTSTRINGS["+i+"]",Base32.encode(CryptoTools.digest(TESTSTRINGS[i])),TYLER_SHA1_OUTPUT); } } --- 84,102 ---- public void testSHA1vsDecodedTyler() throws CryptoException { ! for (int i = 0; i < TESTSTRINGS.length; i++) { ! assertTrue("TESTSTRINGS[" + i + "]", CryptoTools.equalByteArrays(CryptoTools.digest(TESTSTRINGS[i]), Base32.decode(TYLER_SHA1_OUTPUT[i]))); } } + public void testSHA1vsDecodedOwn() throws CryptoException { ! for (int i = 0; i < TESTSTRINGS.length; i++) { ! String hash = Base32.encode(CryptoTools.digest(TESTSTRINGS[i])); ! assertEquals("TESTSTRINGS[" + i + "]", new String(CryptoTools.digest(TESTSTRINGS[i])), new String(Base32.decode(hash))); } } + public void testSHA1HomevsTyler() throws CryptoException { ! for (int i = 0; i < TESTSTRINGS.length; i++) { ! assertEquals("TESTSTRINGS[" + i + "]", TYLER_SHA1_OUTPUT[i], Base32.encode(CryptoTools.digest(TESTSTRINGS[i]))); } } *************** *** 101,107 **** public void testBase32vsTyler() throws CryptoException { ! for (int i=0;i<TESTSTRINGS.length;i++){ final String encoded = Base32.encode(TESTSTRINGS[i]); ! assertEquals("TESTSTRINGS["+i+"]",TYLER_OUTPUT[i],encoded); } } --- 104,110 ---- public void testBase32vsTyler() throws CryptoException { ! for (int i = 0; i < TESTSTRINGS.length; i++) { final String encoded = Base32.encode(TESTSTRINGS[i]); ! assertEquals("TESTSTRINGS[" + i + "]", TYLER_OUTPUT[i], encoded); } } *************** *** 109,117 **** public void testDecodeTyler() throws CryptoException { ! for (int i=0;i<TESTSTRINGS.length;i++){ final byte decoded[] = Base32.decode(TYLER_OUTPUT[i]); ! assertEquals("TESTSTRINGS["+i+"]",TESTSTRINGS[i].getBytes(),decoded); } } public void assertEquals(String description, byte a[], byte b[]) { assertEquals(description + " length", a.length, b.length); --- 112,121 ---- public void testDecodeTyler() throws CryptoException { ! for (int i = 0; i < TESTSTRINGS.length; i++) { final byte decoded[] = Base32.decode(TYLER_OUTPUT[i]); ! assertEquals("TESTSTRINGS[" + i + "]", TESTSTRINGS[i].getBytes(), decoded); } } + public void assertEquals(String description, byte a[], byte b[]) { assertEquals(description + " length", a.length, b.length); *************** *** 131,134 **** --- 135,173 ---- */ + /** + * Silly Microbenchmark + * + * @throws CryptoException + */ + public void testBenchmark() throws CryptoException { + System.out.println("BigInteger encoding benchmarks:"); + final int ITERATIONS = 100000; + final Runtime runtime = Runtime.getRuntime(); + long start = System.currentTimeMillis(); + long memstart = runtime.freeMemory(); + for (int i = 0; i < ITERATIONS; i++) { + final String encoded = Base32.encode(TESTSTRINGS[i % TESTSTRINGS.length]); + assertEquals("TESTSTRINGS[" + i + "]", TYLER_OUTPUT[i % TESTSTRINGS.length], encoded); + } + long dur = System.currentTimeMillis() - start; + long memuse = memstart - runtime.freeMemory(); + System.out.println(ITERATIONS + " iterations took: " + dur + "ms"); + System.out.println(ITERATIONS + " iterations used: " + memuse + " bytes"); + /* + System.out.println("\nWaterken encoding benchmarks:"); + start=System.currentTimeMillis(); + memstart=runtime.freeMemory(); + for (int i=0;i<ITERATIONS;i++){ + final String encoded = com.waterken.url.Base32.encode(TESTSTRINGS[i%TESTSTRINGS.length].getBytes()); + assertEquals("TESTSTRINGS["+i+"]",TYLER_OUTPUT[i%TESTSTRINGS.length],encoded); + } + dur=System.currentTimeMillis()-start; + memuse=memstart-runtime.freeMemory(); + System.out.println(ITERATIONS+" iterations took: "+dur+"ms"); + System.out.println(ITERATIONS+" iterations used: "+memuse+" bytes"); + */ + + } + static final String TESTSTRINGS[] = new String[]{ "", *************** *** 148,152 **** }; ! static final String TYLER_OUTPUT[]=new String[]{ "", "ga", --- 187,191 ---- }; ! static final String TYLER_OUTPUT[] = new String[]{ "", "ga", *************** *** 165,169 **** }; ! static final String TYLER_SHA1_OUTPUT[]=new String[]{ "3i42h3s6nnfq2msvx7xzkyayscx5qbyj", "wzmj7rvlbxecz4jathi4fvakxgkoqqim", --- 204,208 ---- }; ! static final String TYLER_SHA1_OUTPUT[] = new String[]{ "3i42h3s6nnfq2msvx7xzkyayscx5qbyj", "wzmj7rvlbxecz4jathi4fvakxgkoqqim", |
|
From: <pe...@us...> - 2004-03-03 23:41:08
|
Update of /cvsroot/neuclear/neuclear-pay/src/test/org/neuclear/asset/orders/builders In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20556/src/test/org/neuclear/asset/orders/builders Modified Files: TransferOrderBuilderTest.java Log Message: Updated tests to use AbstractObjectCreationTest Index: TransferOrderBuilderTest.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-pay/src/test/org/neuclear/asset/orders/builders/TransferOrderBuilderTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TransferOrderBuilderTest.java 18 Feb 2004 00:13:31 -0000 1.2 --- TransferOrderBuilderTest.java 3 Mar 2004 23:28:14 -0000 1.3 *************** *** 34,37 **** --- 34,40 ---- $Id$ $Log$ + Revision 1.3 2004/03/03 23:28:14 pelle + Updated tests to use AbstractObjectCreationTest + Revision 1.2 2004/02/18 00:13:31 pelle Many, many clean ups. I've readded Targets in a new method. *************** *** 48,55 **** * Time: 9:11:44 PM */ ! public class TransferOrderBuilderTest extends AbstractObjectCreationTest{ public TransferOrderBuilderTest(String string) throws NeuClearException, GeneralSecurityException { super(string); ! asset=createTestAsset(); } --- 51,58 ---- * Time: 9:11:44 PM */ ! public class TransferOrderBuilderTest extends AbstractObjectCreationTest { public TransferOrderBuilderTest(String string) throws NeuClearException, GeneralSecurityException { super(string); ! asset = createTestAsset(); } *************** *** 57,74 **** assertNotNull(obj); assertTrue(obj instanceof TransferOrder); ! TransferOrder order=(TransferOrder) obj; ! assertEquals(asset.getDigest(),order.getAsset().getDigest()); ! assertEquals(getSigner().getPublicKey("neu://test").getEncoded(),order.getSignatory().getPublicKey().getEncoded()); ! assertEquals(getBob().getPublicKey().getEncoded(),order.getRecipient().getPublicKey().getEncoded()); ! assertEquals("Test",order.getComment()); ! assertEquals(20.0,order.getAmount().getAmount(),0); } protected Builder createBuilder() throws NeuClearException, InvalidTransferException, XMLException { ! Builder builder=new TransferOrderBuilder("neu://test/bux","neu://bob@test",new Amount(20),"Test"); System.out.println(builder.asXML()); return builder; } ! public Asset createTestAsset() throws NonExistingSignerException { // return new Asset("http://localhost",getSigner().getPublicKey("neu://test/bux"),1,1); return null;//TODO FIX --- 60,82 ---- assertNotNull(obj); assertTrue(obj instanceof TransferOrder); ! TransferOrder order = (TransferOrder) obj; ! assertEquals(asset.getDigest(), order.getAsset().getDigest()); ! assertEquals(getSigner().getPublicKey("neu://test").getEncoded(), order.getSignatory().getPublicKey().getEncoded()); ! assertEquals(getBob().getPublicKey().getEncoded(), order.getRecipient().getPublicKey().getEncoded()); ! assertEquals("Test", order.getComment()); ! assertEquals(20.0, order.getAmount().getAmount(), 0); ! } ! ! protected Class getRequiredClass() { ! return TransferOrder.class; } protected Builder createBuilder() throws NeuClearException, InvalidTransferException, XMLException { ! Builder builder = new TransferOrderBuilder("neu://test/bux", "neu://bob@test", new Amount(20), "Test"); System.out.println(builder.asXML()); return builder; } ! ! public Asset createTestAsset() throws NonExistingSignerException { // return new Asset("http://localhost",getSigner().getPublicKey("neu://test/bux"),1,1); return null;//TODO FIX |
|
From: <pe...@us...> - 2004-03-03 23:41:08
|
Update of /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/orders In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20556/src/java/org/neuclear/asset/orders Modified Files: TransferGlobals.java Log Message: Updated tests to use AbstractObjectCreationTest Index: TransferGlobals.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/orders/TransferGlobals.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TransferGlobals.java 13 Jan 2004 15:11:17 -0000 1.6 --- TransferGlobals.java 3 Mar 2004 23:28:14 -0000 1.7 *************** *** 2,7 **** import org.dom4j.*; - import org.neuclear.asset.contracts.Asset; import org.neuclear.asset.InvalidTransferException; import org.neuclear.commons.Utility; import org.neuclear.commons.time.TimeTools; --- 2,7 ---- import org.dom4j.*; import org.neuclear.asset.InvalidTransferException; + import org.neuclear.asset.contracts.Asset; import org.neuclear.commons.Utility; import org.neuclear.commons.time.TimeTools; *************** *** 15,19 **** import java.sql.Timestamp; import java.text.ParseException; - import java.util.StringTokenizer; /* --- 15,18 ---- *************** *** 37,40 **** --- 36,42 ---- $Id$ $Log$ + Revision 1.7 2004/03/03 23:28:14 pelle + Updated tests to use AbstractObjectCreationTest + Revision 1.6 2004/01/13 15:11:17 pelle Now builds. *************** *** 151,173 **** return elem; } public static String getElementValue(final Element element, final String name) throws InvalidNamedObjectException { ! return getElementValue(element,createQName(name)); } public static String getElementValue(final Element element, final QName name) throws InvalidNamedObjectException { ! final Element value=element.element(name); ! if (value==null) ! throw new InvalidNamedObjectException("Missing required element: "+name); ! final String text=value.getTextTrim(); if (Utility.isEmpty(text)) ! throw new InvalidNamedObjectException("Required element: "+name+" is empty"); return text; } public static String parseCommentElement(final Element element) { ! final Element value=element.element(createQName(COMMENT_TAG)); ! if (value==null) return ""; ! final String text=value.getTextTrim(); return Utility.denullString(text); } --- 153,176 ---- return elem; } + public static String getElementValue(final Element element, final String name) throws InvalidNamedObjectException { ! return getElementValue(element, createQName(name)); } public static String getElementValue(final Element element, final QName name) throws InvalidNamedObjectException { ! final Element value = element.element(name); ! if (value == null) ! throw new InvalidNamedObjectException("Missing required element: " + name); ! final String text = value.getTextTrim(); if (Utility.isEmpty(text)) ! throw new InvalidNamedObjectException("Required element: " + name + " is empty"); return text; } public static String parseCommentElement(final Element element) { ! final Element value = element.element(createQName(COMMENT_TAG)); ! if (value == null) return ""; ! final String text = value.getTextTrim(); return Utility.denullString(text); } *************** *** 183,198 **** public static final Timestamp parseValueTimeElement(final Element elem) throws InvalidNamedObjectException { ! return parseTimeStampElement(elem,createQName(VALUE_TIME_TAG)); } ! public static final Timestamp parseTimeStampElement(final Element elem,final String name) throws InvalidNamedObjectException { ! return parseTimeStampElement(elem,createQName(name)); } ! public static final Timestamp parseTimeStampElement(final Element elem,final QName qn) throws InvalidNamedObjectException { try { ! final Element telem=elem.element(qn); ! if (telem==null) throw new InvalidNamedObjectException("missing time stamp element"); ! final String value=telem.getTextTrim(); if (Utility.isEmpty(value)) throw new InvalidNamedObjectException("missing time stamp"); --- 186,202 ---- public static final Timestamp parseValueTimeElement(final Element elem) throws InvalidNamedObjectException { ! return parseTimeStampElement(elem, createQName(VALUE_TIME_TAG)); } ! public static final Timestamp parseTimeStampElement(final Element elem, final String name) throws InvalidNamedObjectException { ! return parseTimeStampElement(elem, createQName(name)); } ! ! public static final Timestamp parseTimeStampElement(final Element elem, final QName qn) throws InvalidNamedObjectException { try { ! final Element telem = elem.element(qn); ! if (telem == null) throw new InvalidNamedObjectException("missing time stamp element"); ! final String value = telem.getTextTrim(); if (Utility.isEmpty(value)) throw new InvalidNamedObjectException("missing time stamp"); *************** *** 206,225 **** public static final Asset parseAssetTag(Element elem) throws InvalidNamedObjectException { ! final String name = getElementValue(elem,ASSET_TAG); try { return (Asset) NSResolver.resolveIdentity(name); } catch (ClassCastException e) { ! throw new InvalidNamedObjectException(name,e); } catch (NameResolutionException e) { ! throw new InvalidNamedObjectException(name,e); } } public static final Identity parseRecipientTag(Element elem) throws InvalidNamedObjectException { ! final String name = getElementValue(elem,RECIPIENT_TAG); try { ! return NSResolver.resolveIdentity(name); } catch (NameResolutionException e) { ! throw new InvalidNamedObjectException(name,e); } --- 210,230 ---- public static final Asset parseAssetTag(Element elem) throws InvalidNamedObjectException { ! final String name = getElementValue(elem, ASSET_TAG); try { return (Asset) NSResolver.resolveIdentity(name); } catch (ClassCastException e) { ! throw new InvalidNamedObjectException(name, e); } catch (NameResolutionException e) { ! throw new InvalidNamedObjectException(name, e); } } + public static final Identity parseRecipientTag(Element elem) throws InvalidNamedObjectException { ! final String name = getElementValue(elem, RECIPIENT_TAG); try { ! return NSResolver.resolveIdentity(name); } catch (NameResolutionException e) { ! throw new InvalidNamedObjectException(name, e); } *************** *** 227,231 **** public static final Value parseValueTag(Element elem) throws InvalidNamedObjectException { ! if (elem.elements(createQName(AMOUNT_TAG))!=null) return parseAmountTag(elem); else --- 232,236 ---- public static final Value parseValueTag(Element elem) throws InvalidNamedObjectException { ! if (elem.elements(createQName(AMOUNT_TAG)) != null) return parseAmountTag(elem); else *************** *** 235,276 **** private static SerialNumbers parseSerialNumbers(Element elem) throws InvalidNamedObjectException { ! final String numbers=getElementValue(elem,SERIAL_NOS_TAG); return new SerialNumbers(numbers.split("\\s*")); } private static Amount parseAmountTag(Element elem) throws InvalidNamedObjectException { ! final String amount=getElementValue(elem,AMOUNT_TAG); try { return new Amount(Double.parseDouble(amount)); } catch (NumberFormatException e) { ! throw new InvalidNamedObjectException("Badly formatted number",e); } } ! public static Element createValueTag(Value value) throws InvalidTransferException { ! if (value instanceof Amount){ ! return createElement(TransferGlobals.AMOUNT_TAG,Double.toString(value.getAmount())); } ! SerialNumbers nos=((SerialNumbers)value); ! if (value.getAmount()>0) { ! final StringBuffer buf=new StringBuffer((int) (nos.getAmount()*(nos.getNumber(0).length())+1)); ! for (int i=0;i<nos.getAmount();i++) buf.append(nos.getNumber(i)); ! buf.append("\n"); ! return createElement(TransferGlobals.SERIAL_NOS_TAG,buf.toString()); } throw new InvalidTransferException("Cant have an empty list"); } ! public static final SignedNamedObject parseEmbedded(Element elem,QName name) throws InvalidNamedObjectException { ! Element embedded=elem.element(name); ! if (embedded==null) ! throw new InvalidNamedObjectException("Element: "+elem.getName()+" doesnt contain a "+name.getQualifiedName()); ! try { ! return VerifyingReader.getInstance().read(embedded); ! } catch (NameResolutionException e) { ! throw new InvalidNamedObjectException("Element: "+elem.getName()+" had a problem identifying signer",e); ! } } static { registerReaders(); --- 240,279 ---- private static SerialNumbers parseSerialNumbers(Element elem) throws InvalidNamedObjectException { ! final String numbers = getElementValue(elem, SERIAL_NOS_TAG); return new SerialNumbers(numbers.split("\\s*")); } private static Amount parseAmountTag(Element elem) throws InvalidNamedObjectException { ! final String amount = getElementValue(elem, AMOUNT_TAG); try { return new Amount(Double.parseDouble(amount)); } catch (NumberFormatException e) { ! throw new InvalidNamedObjectException("Badly formatted number", e); } } ! public static Element createValueTag(Value value) throws InvalidTransferException { ! if (value instanceof Amount) { ! return createElement(TransferGlobals.AMOUNT_TAG, Double.toString(value.getAmount())); } ! SerialNumbers nos = ((SerialNumbers) value); ! if (value.getAmount() > 0) { ! final StringBuffer buf = new StringBuffer((int) (nos.getAmount() * (nos.getNumber(0).length()) + 1)); ! for (int i = 0; i < nos.getAmount(); i++) buf.append(nos.getNumber(i)); ! buf.append("\n"); ! return createElement(TransferGlobals.SERIAL_NOS_TAG, buf.toString()); } throw new InvalidTransferException("Cant have an empty list"); } ! ! public static final SignedNamedObject parseEmbedded(Element elem, QName name) throws InvalidNamedObjectException { ! Element embedded = elem.element(name); ! if (embedded == null) ! throw new InvalidNamedObjectException("Element: " + elem.getName() + " doesnt contain a " + name.getQualifiedName()); ! return VerifyingReader.getInstance().read(embedded); } + static { registerReaders(); *************** *** 281,289 **** public static final String XFER_NSPREFIX = "xfer"; public static final String XFER_NSURI = "http://neuclear.org/neu/xfer.xsd"; ! public static final String VALUE_TIME_TAG="ValueTime"; ! public static final String COMMENT_TAG="Comment"; ! public static final String ASSET_TAG="Asset"; ! public static final String AMOUNT_TAG="Amount"; ! public static final String SERIAL_NOS_TAG="SerialNumbers"; public static final String RECIPIENT_TAG = "Recipient"; } --- 284,292 ---- public static final String XFER_NSPREFIX = "xfer"; public static final String XFER_NSURI = "http://neuclear.org/neu/xfer.xsd"; ! public static final String VALUE_TIME_TAG = "ValueTime"; ! public static final String COMMENT_TAG = "Comment"; ! public static final String ASSET_TAG = "Asset"; ! public static final String AMOUNT_TAG = "Amount"; ! public static final String SERIAL_NOS_TAG = "SerialNumbers"; public static final String RECIPIENT_TAG = "Recipient"; } |
|
From: <pe...@us...> - 2004-03-03 23:41:07
|
Update of /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/exchange/orders In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20556/src/java/org/neuclear/exchange/orders Modified Files: CancelExchangeReceipt.java Log Message: Updated tests to use AbstractObjectCreationTest Index: CancelExchangeReceipt.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/exchange/orders/CancelExchangeReceipt.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CancelExchangeReceipt.java 10 Jan 2004 00:00:46 -0000 1.3 --- CancelExchangeReceipt.java 3 Mar 2004 23:28:14 -0000 1.4 *************** *** 4,8 **** import org.neuclear.asset.contracts.AssetGlobals; import org.neuclear.asset.orders.TransferGlobals; ! import org.neuclear.id.*; import org.neuclear.id.verifier.VerifyingReader; --- 4,11 ---- import org.neuclear.asset.contracts.AssetGlobals; import org.neuclear.asset.orders.TransferGlobals; ! import org.neuclear.id.InvalidNamedObjectException; ! import org.neuclear.id.NamedObjectReader; ! import org.neuclear.id.SignedNamedCore; ! import org.neuclear.id.SignedNamedObject; import org.neuclear.id.verifier.VerifyingReader; *************** *** 15,27 **** * Time: 5:35:26 PM */ ! public final class CancelExchangeReceipt extends ExchangeTransactionContract{ ! private CancelExchangeReceipt(SignedNamedCore core,CancelExchangeOrder order,final Date canceltime) { super(core, order.getAsset(), order.getAgent()); ! this.canceltime=canceltime.getTime(); ! this.order=order; } ! public CancelExchangeOrder getOrder(){ return order; } --- 18,30 ---- * Time: 5:35:26 PM */ ! public final class CancelExchangeReceipt extends ExchangeTransactionContract { ! private CancelExchangeReceipt(SignedNamedCore core, CancelExchangeOrder order, final Date canceltime) { super(core, order.getAsset(), order.getAgent()); ! this.canceltime = canceltime.getTime(); ! this.order = order; } ! public CancelExchangeOrder getOrder() { return order; } *************** *** 31,35 **** } ! private final long canceltime; private final CancelExchangeOrder order; --- 34,38 ---- } ! private final long canceltime; private final CancelExchangeOrder order; *************** *** 43,58 **** public final SignedNamedObject read(final SignedNamedCore core, final Element elem) throws InvalidNamedObjectException { if (!elem.getNamespace().equals(AssetGlobals.NS_ASSET)) ! throw new InvalidNamedObjectException(core.getName(),"Not in XML NameSpace: "+AssetGlobals.NS_ASSET.getURI()); ! try { ! if (elem.getName().equals(ExchangeGlobals.CANCEL_RCPT_TAGNAME)){ ! final Date valuetime = TransferGlobals.parseValueTimeElement(elem); ! CancelExchangeOrder order=(CancelExchangeOrder) VerifyingReader.getInstance().read(elem.element(ExchangeGlobals.createQName(ExchangeGlobals.CANCEL_TAGNAME))); ! return new CancelExchangeReceipt(core,order,valuetime); ! } ! } catch (NameResolutionException e) { ! throw new InvalidNamedObjectException(core.getName(),e); ! } ! throw new InvalidNamedObjectException(core.getName(),"Not Matched"); } } --- 46,57 ---- public final SignedNamedObject read(final SignedNamedCore core, final Element elem) throws InvalidNamedObjectException { if (!elem.getNamespace().equals(AssetGlobals.NS_ASSET)) ! throw new InvalidNamedObjectException(core.getName(), "Not in XML NameSpace: " + AssetGlobals.NS_ASSET.getURI()); ! if (elem.getName().equals(ExchangeGlobals.CANCEL_RCPT_TAGNAME)) { ! final Date valuetime = TransferGlobals.parseValueTimeElement(elem); ! CancelExchangeOrder order = (CancelExchangeOrder) VerifyingReader.getInstance().read(elem.element(ExchangeGlobals.createQName(ExchangeGlobals.CANCEL_TAGNAME))); ! return new CancelExchangeReceipt(core, order, valuetime); ! } ! throw new InvalidNamedObjectException(core.getName(), "Not Matched"); } } |
|
From: <pe...@us...> - 2004-03-03 23:40:16
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19593/src/java/org/neuclear/id/builders Modified Files: Builder.java Log Message: Updated various tests to use the AbstractObjectCreationTest Index: Builder.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders/Builder.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Builder.java 20 Jan 2004 20:28:23 -0000 1.5 --- Builder.java 3 Mar 2004 23:26:42 -0000 1.6 *************** *** 36,40 **** createDocument(); } ! final public SignedNamedObject convert() throws InvalidNamedObjectException, NameResolutionException{ return VerifyingReader.getInstance().read(getElement()); --- 36,40 ---- createDocument(); } ! final public SignedNamedObject convert() throws InvalidNamedObjectException{ return VerifyingReader.getInstance().read(getElement()); *************** *** 63,67 **** } ! public final SignedNamedObject convert(String name,Signer signer) throws NameResolutionException, InvalidNamedObjectException { try { sign(name,signer); --- 63,67 ---- } ! public final SignedNamedObject convert(String name,Signer signer) throws InvalidNamedObjectException { try { sign(name,signer); |
|
From: <pe...@us...> - 2004-03-03 23:40:16
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19593/src/java/org/neuclear/id Modified Files: SignedNamedCore.java Log Message: Updated various tests to use the AbstractObjectCreationTest Index: SignedNamedCore.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/SignedNamedCore.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** SignedNamedCore.java 2 Mar 2004 18:59:11 -0000 1.20 --- SignedNamedCore.java 3 Mar 2004 23:26:42 -0000 1.21 *************** *** 2,5 **** --- 2,8 ---- * $Id$ * $Log$ + * Revision 1.21 2004/03/03 23:26:42 pelle + * Updated various tests to use the AbstractObjectCreationTest + * * Revision 1.20 2004/03/02 18:59:11 pelle * Further cleanups in neuclear-id. Moved everything under id. *************** *** 362,366 **** * @throws InvalidNamedObjectException */ ! public final static SignedNamedCore read(final Element elem) throws InvalidNamedObjectException, NameResolutionException { try { return readUnnamed(elem); --- 365,369 ---- * @throws InvalidNamedObjectException */ ! public final static SignedNamedCore read(final Element elem) throws InvalidNamedObjectException { try { return readUnnamed(elem); |
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/receiver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19593/src/java/org/neuclear/id/receiver Added Files: Receiver.java ReceiverServlet.java SimpleReceipt.java UnsupportedTransaction.java Log Message: Updated various tests to use the AbstractObjectCreationTest --- NEW FILE: Receiver.java --- package org.neuclear.id.receiver; /** * Created by IntelliJ IDEA. * User: pelleb * Date: Oct 10, 2002 * Time: 11:24:59 PM * To change this template use Options | File Templates. * $Id: Receiver.java,v 1.1 2004/03/03 23:26:43 pelle Exp $ * $Log: Receiver.java,v $ * Revision 1.1 2004/03/03 23:26:43 pelle * Updated various tests to use the AbstractObjectCreationTest * * Revision 1.14 2004/01/13 15:11:35 pelle * Now builds. * Now need to do unit tests * * Revision 1.13 2003/12/10 23:58:51 pelle * Did some cleaning up in the builders * Fixed some stuff in IdentityCreator * New maven goal to create executable jarapp * We are close to 0.8 final of ID, 0.11 final of XMLSIG and 0.5 of commons. * Will release shortly. * * Revision 1.12 2003/11/19 23:33:59 pelle * Signers now can generatekeys via the generateKey() method. * Refactored the relationship between SignedNamedObject and NamedObjectBuilder a bit. * SignedNamedObject now contains the full xml which is returned with getEncoded() * This means that it is now possible to further receive on or process a SignedNamedObject, leaving * NamedObjectBuilder for its original purposes of purely generating new Contracts. * NamedObjectBuilder.sign() now returns a SignedNamedObject which is the prefered way of processing it. * Updated all major interfaces that used the old model to use the new model. * * Revision 1.11 2003/11/11 21:18:43 pelle * Further vital reshuffling. * org.neudist.crypto.* and org.neudist.utils.* have been moved to respective areas under org.neuclear.commons * 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.10 2003/11/10 17:42:36 pelle * The AssetController interface has been more or less finalized. * CurrencyController fully implemented * AssetControlClient implementes a remote client for communicating with AssetControllers * * Revision 1.9 2003/11/09 03:27:19 pelle * More house keeping and shuffling about mainly pay * * Revision 1.8 2003/11/08 01:40:52 pelle * WARNING this rev is majorly unstable and will almost certainly not compile. * More major refactoring in neuclear-pay. * Got rid of neuclear-ledger like features of pay such as Account and Issuer. * Accounts have been replaced by Identity from neuclear-id * Issuer is now Asset which is a subclass of Identity * AssetController supports more than one Asset. Which is important for most non ecurrency implementations. * TransferRequest/Receipt and its Held companions are now SignedNamedObjects. Thus to create them you must use * their matching TransferRequest/ReceiptBuilder classes. * PaymentProcessor has been renamed CurrencyController. I will extract a superclass later to be named AbstractLedgerController * which will handle all neuclear-ledger based AssetControllers. * * Revision 1.7 2003/11/06 23:48:59 pelle * Major Refactoring of CurrencyController. * Factored out AssetController to be new abstract parent class together with most of its support classes. * Created (Half way) AssetControlClient, which can perform transactions on external AssetControllers via NeuClear. * Created the first attempt at the ExchangeAgent. This will need use of the AssetControlClient. * SOAPTools was changed to return a stream. This is required by the VerifyingReader in NeuClear. * * Revision 1.6 2003/10/03 23:48:51 pelle * Did various security related updates in the pay package with regards to immutability of fields etc. * AssetControllerReceiver should now be operational. Real testing needs to be done including in particular setting the * private key of the Receiver. * A new class TransferGlobals contains usefull settings for making life easier in the other contract based classes. * TransferContract the signed contract is functional and has a matching TransferRequestBuilder class for programmatically creating * TransferRequests for signing. * TransferReceiptBuilder has been created for use by Transfer processors. It is used in the AssetControllerReceiver. * * Revision 1.5 2003/09/26 23:53:10 pelle * Changes mainly in receiver and related fun. * First real neuclear stuff in the payment package. Added TransferContract and AssetControllerReceiver. * * Revision 1.4 2003/09/24 23:56:48 pelle * Refactoring nearly done. New model for creating signed objects. * With view for supporting the xmlpull api shortly for performance reasons. * Currently still uses dom4j but that has been refactored out that it * should now be very quick to implement a xmlpull implementation. * * A side benefit of this is that the API has been further simplified. I still have some work * todo with regards to cleaning up some of the outlying parts of the code. * * Revision 1.3 2003/09/23 19:16:28 pelle * Changed NameSpace to Identity. * To cause less confusion in the future. * * Revision 1.2 2003/09/22 19:24:02 pelle * More fixes throughout to problems caused by renaming. * * Revision 1.1.1.1 2003/09/19 14:41:49 pelle * First import into the neuclear project. This was originally under the SF neuclear * project. This marks a general major refactoring and renaming ahead. * * The new name for this code is NeuClear Identity and has the general package header of * org.neuclear.id * There are other areas within the current code which will be split out into other subprojects later on. * In particularly the signers will be completely seperated out as well as the contract types. * * * Revision 1.3 2003/02/18 14:57:19 pelle * Finished Cleaning up Receivers and Stores. * Also updated nsdl.xsd xml schema with latest changes. * The whole API is now very simple. * */ import org.neuclear.commons.NeuClearException; import org.neuclear.id.SignedNamedObject; /** * <p>The Receiver interface is the base interface for almost all applications based on the NeuDist Framework. * You simply implement this to process the different types of NamedObjects.</p> * <p>For a fully fledged application SubClass ReceiverServlet to handle an instance of your Receiver.</p> */ public interface Receiver { /** * Add your main transaction processing logic within this method. * Remember you must check the validity of the SignedNamedObject here. Until you do so * you can not trust it. * * @param obj * @throws UnsupportedTransaction */ SignedNamedObject receive(SignedNamedObject obj) throws UnsupportedTransaction, NeuClearException; } --- NEW FILE: ReceiverServlet.java --- /* * $Id: ReceiverServlet.java,v 1.1 2004/03/03 23:26:43 pelle Exp $ * $Log: ReceiverServlet.java,v $ * Revision 1.1 2004/03/03 23:26:43 pelle * Updated various tests to use the AbstractObjectCreationTest * * Revision 1.16 2004/01/13 15:11:35 pelle * Now builds. * Now need to do unit tests * * Revision 1.15 2003/12/15 23:33:04 pelle * added ServletTools.getInitParam() which first tries the ServletConfig, then the context config. * All the web.xml's have been updated to support this. Also various further generalizations have been done throughout * for getServiceid(), getTitle(), getSigner() * * Revision 1.14 2003/12/14 20:53:04 pelle * Added ServletPassPhraseAgent which uses ThreadLocal to transfer the passphrase to the signer. * Added ServletSignerFactory, which builds Signers for use within servlets based on parameters in the Servlets * Init parameters in web.xml * Updated SQLContext to use ThreadLocal * Added jakarta cactus unit tests to neuclear-commons to test the 2 new features above. * Added use of the new features in neuclear-commons to the servilets within neuclear-id and added * configuration parameters in web.xml * * Revision 1.13 2003/12/12 15:12:50 pelle * The ReceiverServletTest now passes. * Add first stab at a SigningServletTest which currently doesnt pass. * * Revision 1.12 2003/12/12 00:13:11 pelle * This may actually work now. Need to put a few more test cases in to make sure. * * Revision 1.11 2003/12/08 19:32:32 pelle * Added support for the http scheme into ID. See http://neuclear.org/archives/000195.html * * Revision 1.10 2003/11/28 00:12:58 pelle * Getting the NeuClear web transactions working. * * Revision 1.9 2003/11/24 23:33:37 pelle * More Cactus unit testing going on. * * Revision 1.8 2003/11/22 00:23:47 pelle * All unit tests in commons, id and xmlsec now work. * AssetController now successfully processes payments in the unit test. * Payment Web App has working form that creates a TransferRequest presents it to the signer * and forwards it to AssetControlServlet. (Which throws an XML Parser Exception) I think the XMLReaderServlet is bust. * * Revision 1.7 2003/11/21 04:45:13 pelle * EncryptedFileStore now works. It uses the PBECipher with DES3 afair. * Otherwise You will Finaliate. * 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.6 2003/11/11 21:18:43 pelle * Further vital reshuffling. * org.neudist.crypto.* and org.neudist.utils.* have been moved to respective areas under org.neuclear.commons * 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.5 2003/10/21 22:31:13 pelle * Renamed NeudistException to NeuClearException and moved it to org.neuclear.commons where it makes more sense. * Unhooked the XMLException in the xmlsig library from NeuClearException to make all of its exceptions an independent hierarchy. * Obviously had to perform many changes throughout the code to support these changes. * * Revision 1.4 2003/09/26 00:22:07 pelle * Cleanups and final changes to code for refactoring of the Verifier and Reader part. * * Revision 1.3 2003/09/24 23:56:48 pelle * Refactoring nearly done. New model for creating signed objects. * With view for supporting the xmlpull api shortly for performance reasons. * Currently still uses dom4j but that has been refactored out that it * should now be very quick to implement a xmlpull implementation. * * A side benefit of this is that the API has been further simplified. I still have some work * todo with regards to cleaning up some of the outlying parts of the code. * * Revision 1.2 2003/09/22 19:24:02 pelle * More fixes throughout to problems caused by renaming. * * Revision 1.1.1.1 2003/09/19 14:41:49 pelle * First import into the neuclear project. This was originally under the SF neuclear * project. This marks a general major refactoring and renaming ahead. * * The new name for this code is NeuClear Identity and has the general package header of * org.neuclear.id * There are other areas within the current code which will be split out into other subprojects later on. * In particularly the signers will be completely seperated out as well as the contract types. * * * Revision 1.8 2003/02/18 14:57:20 pelle * Finished Cleaning up Receivers and Stores. * Also updated nsdl.xsd xml schema with latest changes. * The whole API is now very simple. * * Revision 1.7 2003/02/09 00:15:55 pelle * Fixed things so they now compile with r_0.7 of XMLSig * * Revision 1.6 2002/12/04 13:52:48 pelle * Biggest change is a fix to the Canonicalization Writer It should be a lot more compliant with C14N now. * I think the only thing left to do is to sort the element attributes. * * Revision 1.5 2002/10/02 21:03:45 pelle * Major Commit * I completely redid the namespace resolving code. * It now works correctly with the new store attribute of the namespace * And can correctly work out the location of a namespace file * by hierarchically signing it. * I have also included several top level namespaces and finalised * the root namespace. * In short all of the above means that we can theoretically call * Neubia live now. (Well on my first deployment anyway). * There is a new CommandLineSigner utility class which creates and signs * namespaces using standard java keystores. * I'm now working on updating the documentation, so other people * than me might have a chance at using it. * * Revision 1.4 2002/09/21 23:11:16 pelle * A bunch of clean ups. Got rid of as many hard coded URL's as I could. * * User: pelleb * Date: Sep 19, 2002 * Time: 5:20:55 PM * To change template for new class use * Code Style | Class Templates options (Tools | IDE Options). */ package org.neuclear.id.receiver; import org.dom4j.DocumentHelper; import org.dom4j.Element; import org.neuclear.commons.NeuClearException; import org.neuclear.commons.crypto.signers.ServletSignerFactory; import org.neuclear.commons.crypto.signers.Signer; import org.neuclear.commons.servlets.ServletTools; import org.neuclear.id.SignedNamedObject; import org.neuclear.id.verifier.VerifyingReader; import org.neuclear.xml.XMLException; import org.neuclear.xml.soap.XMLInputStreamServlet; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.security.GeneralSecurityException; public class ReceiverServlet extends XMLInputStreamServlet { public void init(final ServletConfig config) throws ServletException { super.init(config); try { serviceid = ServletTools.getInitParam("serviceid", config); title = ServletTools.getInitParam("title", config); signer = createSigner(config); } catch (Exception e) { ctx.log("Error in ReceiverServlet: " + e.getLocalizedMessage()); throw new ServletException(e); } } protected final void handleInputStream(final InputStream is, final HttpServletRequest request, final HttpServletResponse response) throws IOException, NeuClearException, XMLException { final boolean isXML = request.getContentType().equals("text/xml"); if (isXML) { response.setContentType("text/xml"); } else { response.setContentType("text/html"); } final PrintWriter writer = response.getWriter(); if (!isXML) writer.print("<html><head><title>ReceiverServler</title></head><body>"); final SignedNamedObject obj = VerifyingReader.getInstance().read(is); if (obj == null) throw new NeuClearException("Missing Request"); ctx.log("NeuClear: Got Request " + obj.getName()); ctx.log(obj.getEncoded()); SignedNamedObject receipt = receiver.receive(obj); if (isXML) writer.print(receipt.getEncoded()); else { writer.print("<h1>"); writer.print(receipt.getName()); writer.print("</h1>"); } writer.close(); } protected final void setReceiver(final Receiver receiver) { this.receiver = receiver; } final Receiver getReceiver() { return receiver; } public Signer getSigner() { return signer; } ; protected Signer createSigner(ServletConfig config) throws GeneralSecurityException, NeuClearException, IOException { return ServletSignerFactory.getInstance().createSigner(config); } public final String getTitle() { return title; } public final String getServiceid() { return serviceid; } private Receiver receiver; private Signer signer; private static final Element OK = DocumentHelper.createElement("Status"); private String serviceid; private String title; { OK.setText("OK"); } } --- NEW FILE: SimpleReceipt.java --- package org.neuclear.id.receiver; import org.neuclear.id.NSTools; import org.neuclear.id.builders.Builder; /** * A receipt for returning simple status from a Receiver. */ public class SimpleReceipt extends Builder { public SimpleReceipt(String message) { super("Receipt", NSTools.NS_NEUID); getElement().setText(message); } } --- NEW FILE: UnsupportedTransaction.java --- package org.neuclear.id.receiver; import org.neuclear.commons.NeuClearException; import org.neuclear.id.SignedNamedCore; import org.neuclear.id.SignedNamedObject; /* NeuClear Distributed Transaction Clearing Platform (C) 2003 Pelle Braendgaard This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA $Id: UnsupportedTransaction.java,v 1.1 2004/03/03 23:26:43 pelle Exp $ $Log: UnsupportedTransaction.java,v $ Revision 1.1 2004/03/03 23:26:43 pelle Updated various tests to use the AbstractObjectCreationTest Revision 1.5 2003/11/22 00:23:47 pelle All unit tests in commons, id and xmlsec now work. AssetController now successfully processes payments in the unit test. Payment Web App has working form that creates a TransferRequest presents it to the signer and forwards it to AssetControlServlet. (Which throws an XML Parser Exception) I think the XMLReaderServlet is bust. Revision 1.4 2003/11/21 04:45:13 pelle EncryptedFileStore now works. It uses the PBECipher with DES3 afair. Otherwise You will Finaliate. 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.3 2003/11/09 03:27:19 pelle More house keeping and shuffling about mainly pay Revision 1.2 2003/10/21 22:31:13 pelle Renamed NeudistException to NeuClearException and moved it to org.neuclear.commons where it makes more sense. Unhooked the XMLException in the xmlsig library from NeuClearException to make all of its exceptions an independent hierarchy. Obviously had to perform many changes throughout the code to support these changes. Revision 1.1 2003/09/26 23:53:10 pelle Changes mainly in receiver and related fun. First real neuclear stuff in the payment package. Added TransferContract and AssetControllerReceiver. */ /** * User: pelleb * Date: Sep 26, 2003 * Time: 1:48:58 PM */ public final class UnsupportedTransaction extends NeuClearException { /** * @param obj */ public UnsupportedTransaction(final SignedNamedCore obj) { super("NeuClear Transaction not Supported by this Reader: " + obj.getClass().getName()); } public UnsupportedTransaction(final SignedNamedObject obj) { super("NeuClear Transaction not Supported by this Receiver: " + obj.getClass().getName()); } } |
|
From: <pe...@us...> - 2004-03-03 23:39:43
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/signers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19593/src/java/org/neuclear/id/signers Modified Files: SigningServlet.java Log Message: Updated various tests to use the AbstractObjectCreationTest Index: SigningServlet.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/signers/SigningServlet.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SigningServlet.java 2 Mar 2004 18:59:10 -0000 1.1 --- SigningServlet.java 3 Mar 2004 23:26:43 -0000 1.2 *************** *** 2,5 **** --- 2,8 ---- * $Id$ * $Log$ + * Revision 1.2 2004/03/03 23:26:43 pelle + * Updated various tests to use the AbstractObjectCreationTest + * * Revision 1.1 2004/03/02 18:59:10 pelle * Further cleanups in neuclear-id. Moved everything under id. *************** *** 202,206 **** * * Revision 1.10 2002/10/10 21:29:31 pelle ! * Oops. XML-Signature's SignedInfo element I had coded as SignatureInfo * As I thought Canonicalisation doesnt seem to be standard. * Updated the SignedServlet to default to using ~/.neuclear/signers.ks --- 205,209 ---- * * Revision 1.10 2002/10/10 21:29:31 pelle ! * Oops. XML-Signature's SignedInfo element I had coded as SignedInfo * As I thought Canonicalisation doesnt seem to be standard. * Updated the SignedServlet to default to using ~/.neuclear/signers.ks *************** *** 296,300 **** context.log("NEUCLEAR: Initialising SigningServlet"); try { ! title = ServletTools.getInitParam("title",config); signer = createSigner(config); } catch (GeneralSecurityException e) { --- 299,303 ---- context.log("NEUCLEAR: Initialising SigningServlet"); try { ! title = ServletTools.getInitParam("title", config); signer = createSigner(config); } catch (GeneralSecurityException e) { *************** *** 336,340 **** boolean isSigned = false; if (!signer.canSignFor(username)) { ! out.println("<h3>Can not Sign for:"); out.println(username); out.println("</h3>"); --- 339,343 ---- boolean isSigned = false; if (!signer.canSignFor(username)) { ! out.println("<h3>Can not Sign for:"); out.println(username); out.println("</h3>"); *************** *** 355,359 **** } out.println("</td></tr><tr><td style=\"background:lightgrey;color:black\"><tt>"); ! Matcher matcher=xmlescape.matcher(named.asXML()); out.println(matcher.replaceAll("<")); --- 358,362 ---- } out.println("</td></tr><tr><td style=\"background:lightgrey;color:black\"><tt>"); ! Matcher matcher = xmlescape.matcher(named.asXML()); out.println(matcher.replaceAll("<")); *************** *** 364,368 **** out.flush(); try { ! isSigned = sign(named,username, out); } catch (InvalidNamedObjectException e) { --- 367,371 ---- out.flush(); try { ! isSigned = sign(named, username, out); } catch (InvalidNamedObjectException e) { *************** *** 406,413 **** } ! private boolean sign(final Builder named, String username,final PrintWriter out) throws NeuClearException, XMLException { boolean isSigned; context.log("SIGN: Signing with " + username); ! final SignedNamedObject signed = named.convert(username,signer); isSigned = true; out.println("<li>Signed</li>"); --- 409,416 ---- } ! private boolean sign(final Builder named, String username, final PrintWriter out) throws NeuClearException, XMLException { boolean isSigned; context.log("SIGN: Signing with " + username); ! final SignedNamedObject signed = named.convert(username, signer); isSigned = true; out.println("<li>Signed</li>"); *************** *** 429,432 **** --- 432,436 ---- * Return True when ready to sign. * Multirequest signers, need to verify that the correct request parameters are available. + * * @param request * @return *************** *** 441,448 **** - protected javax.servlet.ServletContext context; private Signer signer; private String title; ! static private Pattern xmlescape=Pattern.compile("(\\<)"); } --- 445,451 ---- protected javax.servlet.ServletContext context; private Signer signer; private String title; ! static private Pattern xmlescape = Pattern.compile("(\\<)"); } |
|
From: <pe...@us...> - 2004-03-03 23:39:43
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19593/src/java/org/neuclear/tests Modified Files: AbstractObjectCreationTest.java Log Message: Updated various tests to use the AbstractObjectCreationTest Index: AbstractObjectCreationTest.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/tests/AbstractObjectCreationTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AbstractObjectCreationTest.java 21 Jan 2004 23:41:08 -0000 1.4 --- AbstractObjectCreationTest.java 3 Mar 2004 23:26:44 -0000 1.5 *************** *** 25,35 **** assertNotNull(builder); // assertTrue(NSTools.isNamedObject(builder.getElement())); ! SignedNamedObject obj=builder.convert("neu://test",getSigner()); assertNotNull(obj); verifyObject(obj); } ! protected abstract void verifyObject(SignedNamedObject obj) throws NonExistingSignerException; ! protected abstract Builder createBuilder() throws Exception; } --- 25,38 ---- assertNotNull(builder); // assertTrue(NSTools.isNamedObject(builder.getElement())); ! SignedNamedObject obj=builder.convert(NAME,getSigner()); assertNotNull(obj); + assertEquals(getRequiredClass(),obj.getClass()); verifyObject(obj); } ! protected abstract void verifyObject(SignedNamedObject obj) throws Exception; ! protected abstract Class getRequiredClass(); protected abstract Builder createBuilder() throws Exception; + + public static final String NAME="test"; } |
Update of /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id/builders In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19593/src/test/org/neuclear/id/builders Modified Files: AuthenticationBuilderTest.java SigningRequestBuilderTest.java Removed Files: IdentityBuilderTest.java Log Message: Updated various tests to use the AbstractObjectCreationTest Index: AuthenticationBuilderTest.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id/builders/AuthenticationBuilderTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AuthenticationBuilderTest.java 2 Mar 2004 18:59:12 -0000 1.8 --- AuthenticationBuilderTest.java 3 Mar 2004 23:26:45 -0000 1.9 *************** *** 3,8 **** --- 3,11 ---- import org.neuclear.id.auth.AuthenticationTicket; import org.neuclear.commons.NeuClearException; + import org.neuclear.commons.crypto.signers.NonExistingSignerException; import org.neuclear.id.InvalidNamedObjectException; + import org.neuclear.id.SignedNamedObject; import org.neuclear.tests.AbstractSigningTest; + import org.neuclear.tests.AbstractObjectCreationTest; import org.neuclear.xml.XMLException; *************** *** 29,32 **** --- 32,38 ---- $Id$ $Log$ + Revision 1.9 2004/03/03 23:26:45 pelle + Updated various tests to use the AbstractObjectCreationTest + Revision 1.8 2004/03/02 18:59:12 pelle Further cleanups in neuclear-id. Moved everything under id. *************** *** 76,96 **** * Time: 3:28:05 PM */ ! public final class AuthenticationBuilderTest extends AbstractSigningTest { public AuthenticationBuilderTest(final String string) throws NeuClearException, GeneralSecurityException { super(string); } ! public final void testAuthenticate() throws NeuClearException, XMLException { ! final AuthenticationTicketBuilder authreq = new AuthenticationTicketBuilder("neu://bob@test", "neu://test", "http://users.neuclear.org:8080"); ! // assertEquals(authreq.getSignatory().getName(), "neu://bob@test"); ! try { ! final AuthenticationTicket auth = (AuthenticationTicket) authreq.convert("neu://bob@test",signer); ! assertTrue(authreq.isSigned()); ! // assertEquals(auth.getName(), authreq.); ! assertEquals(auth.getSiteHref(), "http://users.neuclear.org:8080"); ! } catch (InvalidNamedObjectException e) { ! assertTrue(false); ! } } } --- 82,102 ---- * Time: 3:28:05 PM */ ! public final class AuthenticationBuilderTest extends AbstractObjectCreationTest { public AuthenticationBuilderTest(final String string) throws NeuClearException, GeneralSecurityException { super(string); } ! protected void verifyObject(SignedNamedObject obj) throws NonExistingSignerException { ! final AuthenticationTicket auth = (AuthenticationTicket)obj; ! assertEquals(auth.getSiteHref(), "http://users.neuclear.org:8080"); ! } + protected Class getRequiredClass() { + return AuthenticationTicket.class; } + + protected Builder createBuilder() throws Exception { + return new AuthenticationTicketBuilder("neu://bob@test", "neu://test", "http://users.neuclear.org:8080"); + } + } Index: SigningRequestBuilderTest.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id/builders/SigningRequestBuilderTest.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** SigningRequestBuilderTest.java 2 Mar 2004 18:59:12 -0000 1.11 --- SigningRequestBuilderTest.java 3 Mar 2004 23:26:45 -0000 1.12 *************** *** 3,9 **** --- 3,13 ---- import org.neuclear.id.auth.AuthenticationTicket; import org.neuclear.commons.NeuClearException; + import org.neuclear.commons.crypto.signers.NonExistingSignerException; import org.neuclear.id.InvalidNamedObjectException; import org.neuclear.id.SignatureRequest; + import org.neuclear.id.SignedNamedObject; + import org.neuclear.id.NameResolutionException; import org.neuclear.tests.AbstractSigningTest; + import org.neuclear.tests.AbstractObjectCreationTest; import org.neuclear.xml.XMLException; *************** *** 30,33 **** --- 34,40 ---- $Id$ $Log$ + Revision 1.12 2004/03/03 23:26:45 pelle + Updated various tests to use the AbstractObjectCreationTest + Revision 1.11 2004/03/02 18:59:12 pelle Further cleanups in neuclear-id. Moved everything under id. *************** *** 88,117 **** * Time: 3:28:05 PM */ ! public final class SigningRequestBuilderTest extends AbstractSigningTest { public SigningRequestBuilderTest(final String string) throws NeuClearException, GeneralSecurityException { super(string); } ! public final void testSignatureRequest() throws NeuClearException, XMLException { ! final AuthenticationTicketBuilder authreq = new AuthenticationTicketBuilder("neu://bob@test", "neu://test", "http://users.neuclear.org:8080"); ! final SignatureRequestBuilder sigreq = new SignatureRequestBuilder( "neu://bob@test", authreq, "For testing purposes"); ! // assertEquals(sigreq.getSignatory().getName(), "neu://test"); ! try { ! final SignatureRequest tosign = (SignatureRequest) sigreq.convert("neu://test",signer); ! assertTrue(sigreq.isSigned()); ! ! final Builder auth2 = tosign.getUnsigned(); // assertEquals(auth2.getSignatory().getName(), "neu://bob@test"); ! assertNotNull(auth2); ! assertNotNull(auth2.getElement()); ! final AuthenticationTicket auth = (AuthenticationTicket) auth2.convert("neu://bob@test",signer); ! assertTrue(auth2.isSigned()); // assertEquals(auth.getName(), authreq.getName()); ! assertEquals(auth.getSiteHref(), "http://users.neuclear.org:8080"); ! } catch (InvalidNamedObjectException e) { ! e.printStackTrace(); ! assertTrue(false); ! } } } --- 95,125 ---- * Time: 3:28:05 PM */ ! public final class SigningRequestBuilderTest extends AbstractObjectCreationTest { public SigningRequestBuilderTest(final String string) throws NeuClearException, GeneralSecurityException { super(string); } ! protected void verifyObject(SignedNamedObject obj) throws Exception { ! SignatureRequest tosign=(SignatureRequest) obj; ! assertNotNull(tosign.getUnsigned()); ! final Builder auth2 = tosign.getUnsigned(); // assertEquals(auth2.getSignatory().getName(), "neu://bob@test"); ! assertNotNull(auth2); ! assertNotNull(auth2.getElement()); ! final AuthenticationTicket auth = (AuthenticationTicket) auth2.convert("neu://bob@test",signer); ! assertTrue(auth2.isSigned()); // assertEquals(auth.getName(), authreq.getName()); ! assertEquals(auth.getSiteHref(), "http://users.neuclear.org:8080"); ! ! } + protected Class getRequiredClass() { + return SignatureRequest.class; } + + protected Builder createBuilder() throws Exception { + final AuthenticationTicketBuilder authreq = new AuthenticationTicketBuilder("neu://bob@test", "neu://test", "http://users.neuclear.org:8080"); + return new SignatureRequestBuilder( "neu://bob@test", authreq, "For testing purposes"); + } + } --- IdentityBuilderTest.java DELETED --- |
|
From: <pe...@us...> - 2004-03-03 23:39:43
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/verifier In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19593/src/java/org/neuclear/id/verifier Modified Files: VerifyingReader.java Log Message: Updated various tests to use the AbstractObjectCreationTest Index: VerifyingReader.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/verifier/VerifyingReader.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** VerifyingReader.java 2 Mar 2004 18:59:11 -0000 1.20 --- VerifyingReader.java 3 Mar 2004 23:26:43 -0000 1.21 *************** *** 31,34 **** --- 31,37 ---- $Id$ $Log$ + Revision 1.21 2004/03/03 23:26:43 pelle + Updated various tests to use the AbstractObjectCreationTest + Revision 1.20 2004/03/02 18:59:11 pelle Further cleanups in neuclear-id. Moved everything under id. *************** *** 188,192 **** } ! public final SignedNamedObject read(final Element elem) throws InvalidNamedObjectException, NameResolutionException { return resolveReader(elem).read(SignedNamedCore.read(elem), elem); } --- 191,195 ---- } ! public final SignedNamedObject read(final Element elem) throws InvalidNamedObjectException { return resolveReader(elem).read(SignedNamedCore.read(elem), elem); } |