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-09-22 19:24:37
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/targets
In directory sc8-pr-cvs1:/tmp/cvs-serv4908/src/java/org/neuclear/id/targets
Modified Files:
TargetReference.java
Log Message:
More fixes throughout to problems caused by renaming.
Index: TargetReference.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/targets/TargetReference.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** TargetReference.java 19 Sep 2003 14:41:10 -0000 1.1.1.1
--- TargetReference.java 22 Sep 2003 19:24:01 -0000 1.2
***************
*** 2,5 ****
--- 2,8 ----
* $Id$
* $Log$
+ * Revision 1.2 2003/09/22 19:24:01 pelle
+ * More fixes throughout to problems caused by renaming.
+ *
* Revision 1.1.1.1 2003/09/19 14:41:10 pelle
* First import into the neuclear project. This was originally under the SF neudist
***************
*** 50,82 ****
import org.neuclear.id.NamedObject;
import org.neuclear.senders.Sender;
! import org.neuclear.utils.NeudistException;
! import org.neuclear.utils.Utility;
! import org.neuclear.xml.AbstractElementProxy;
public class TargetReference extends AbstractElementProxy {
! public TargetReference(NamedObject obj, Element elem) throws NeudistException{
super(elem);
if (!elem.getName().equals(TAG_NAME))
throw new NeudistException("Element is not a <Target/> Element");
! owner=obj;
}
! public TargetReference(NamedObject obj,String href,String type) {
! super(DocumentHelper.createQName(TAG_NAME,NamedObject.NS_NSDL));
if (!Utility.isEmpty(href))
! getElement().addAttribute(DocumentHelper.createQName("href",NamedObject.NS_NSDL),href);
if (!Utility.isEmpty(type))
! getElement().addAttribute(DocumentHelper.createQName("type",NamedObject.NS_NSDL),type);
! owner=obj;
! }
public String getHref() {
! return getElement().attributeValue(DocumentHelper.createQName("href",NamedObject.NS_NSDL));
}
public String getType() {
! return getElement().attributeValue(DocumentHelper.createQName("type",NamedObject.NS_NSDL));
}
! private static final String TAG_NAME="Target";
public String getTagName() {
--- 53,86 ----
import org.neuclear.id.NamedObject;
import org.neuclear.senders.Sender;
! import org.neudist.utils.NeudistException;
! import org.neudist.utils.Utility;
! import org.neudist.xml.AbstractElementProxy;
public class TargetReference extends AbstractElementProxy {
! public TargetReference(NamedObject obj, Element elem) throws NeudistException {
super(elem);
if (!elem.getName().equals(TAG_NAME))
throw new NeudistException("Element is not a <Target/> Element");
! owner = obj;
}
! public TargetReference(NamedObject obj, String href, String type) {
! super(DocumentHelper.createQName(TAG_NAME, NamedObject.NS_NSDL));
if (!Utility.isEmpty(href))
! getElement().addAttribute(DocumentHelper.createQName("href", NamedObject.NS_NSDL), href);
if (!Utility.isEmpty(type))
! getElement().addAttribute(DocumentHelper.createQName("type", NamedObject.NS_NSDL), type);
! owner = obj;
! }
public String getHref() {
! return getElement().attributeValue(DocumentHelper.createQName("href", NamedObject.NS_NSDL));
}
+
public String getType() {
! return getElement().attributeValue(DocumentHelper.createQName("type", NamedObject.NS_NSDL));
}
! private static final String TAG_NAME = "Target";
public String getTagName() {
***************
*** 87,92 ****
return NamedObject.NS_NSDL;
}
public void send() throws NeudistException {
! Sender.quickSend(getHref(),owner);
}
--- 91,97 ----
return NamedObject.NS_NSDL;
}
+
public void send() throws NeudistException {
! Sender.quickSend(getHref(), owner);
}
|
|
From: <pe...@us...> - 2003-09-22 19:24:37
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/signrequest
In directory sc8-pr-cvs1:/tmp/cvs-serv4908/src/java/org/neuclear/id/signrequest
Modified Files:
SignatureRequest.java
Log Message:
More fixes throughout to problems caused by renaming.
Index: SignatureRequest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/signrequest/SignatureRequest.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** SignatureRequest.java 19 Sep 2003 14:41:13 -0000 1.1.1.1
--- SignatureRequest.java 22 Sep 2003 19:24:01 -0000 1.2
***************
*** 12,20 ****
import org.dom4j.Element;
import org.dom4j.Namespace;
- import org.neuclear.crypto.CryptoTools;
import org.neuclear.id.NamedObject;
import org.neuclear.id.NamedObjectFactory;
! import org.neuclear.utils.NeudistException;
! import org.neuclear.utils.Utility;
import java.security.PrivateKey;
--- 12,20 ----
import org.dom4j.Element;
import org.dom4j.Namespace;
import org.neuclear.id.NamedObject;
import org.neuclear.id.NamedObjectFactory;
! import org.neudist.crypto.CryptoTools;
! import org.neudist.utils.NeudistException;
! import org.neudist.utils.Utility;
import java.security.PrivateKey;
***************
*** 39,49 ****
* @param payload the NamedObject to request signing
*/
! private SignatureRequest(String reqNameSpace,String target,NamedObject payload) throws NeudistException {
! super(createUniqueTicketName(reqNameSpace,payload.getName()), SignatureRequest.TAG_NAME,SignatureRequest.NS_NSSIGREQ);
addElement(payload);
! this.payload=payload;
! Element root=getElement();
if (!Utility.isEmpty(target))
! root.addAttribute(DocumentHelper.createQName("target",NS_NSSIGREQ),target);
}
--- 39,49 ----
* @param payload the NamedObject to request signing
*/
! private SignatureRequest(String reqNameSpace, String target, NamedObject payload) throws NeudistException {
! super(createUniqueTicketName(reqNameSpace, payload.getName()), SignatureRequest.TAG_NAME, SignatureRequest.NS_NSSIGREQ);
addElement(payload);
! this.payload = payload;
! Element root = getElement();
if (!Utility.isEmpty(target))
! root.addAttribute(DocumentHelper.createQName("target", NS_NSSIGREQ), target);
}
***************
*** 55,68 ****
public SignatureRequest(Element elem) throws NeudistException {
super(elem);
! Element payloadElement=(Element)elem.elements().get(0);
! if (payloadElement!=null)
! payload=NamedObjectFactory.createNamedObject(payloadElement);
}
! public static SignatureRequest createRequest(String requester,String targeturl,NamedObject payload,PrivateKey signer) throws NeudistException {
! SignatureRequest req=new SignatureRequest(requester,targeturl,payload);
req.sign(signer);
return req;
}
/**
* This is just used to create a unique ticket for use by the ticket
--- 55,69 ----
public SignatureRequest(Element elem) throws NeudistException {
super(elem);
! Element payloadElement = (Element) elem.elements().get(0);
! if (payloadElement != null)
! payload = NamedObjectFactory.createNamedObject(payloadElement);
}
! public static SignatureRequest createRequest(String requester, String targeturl, NamedObject payload, PrivateKey signer) throws NeudistException {
! SignatureRequest req = new SignatureRequest(requester, targeturl, payload);
req.sign(signer);
return req;
}
+
/**
* This is just used to create a unique ticket for use by the ticket
***************
*** 71,90 ****
* @return
*/
! private static String createUniqueTicketName(String targetNameSpace,String reqNameSpace) {
// Yeah, yeah there are better ways to do this
! String ms=new Long(new Date().getTime()).toString();
! 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());
! 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)'.';
}
/*
--- 72,91 ----
* @return
*/
! private static String createUniqueTicketName(String targetNameSpace, String reqNameSpace) {
// Yeah, yeah there are better ways to do this
! String ms = new Long(new Date().getTime()).toString();
! 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());
! 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) '.';
}
/*
***************
*** 94,98 ****
System.arraycopy(ticket,0,ticketName,userNameSpace.length()+1,ticket.length);
*/
! return targetNameSpace+'/'+new String(ticketsrc,offset,ticketsrc.length-offset)+'.'+ticket;
}
--- 95,99 ----
System.arraycopy(ticket,0,ticketName,userNameSpace.length()+1,ticket.length);
*/
! return targetNameSpace + '/' + new String(ticketsrc, offset, ticketsrc.length - offset) + '.' + ticket;
}
***************
*** 102,110 ****
*/
public String getSiteHref() {
! return getElement().attributeValue(DocumentHelper.createQName("href",NS_NSSIGREQ));
}
public String getTagName() {
! return TAG_NAME;
! }
/**
--- 103,112 ----
*/
public String getSiteHref() {
! return getElement().attributeValue(DocumentHelper.createQName("href", NS_NSSIGREQ));
}
+
public String getTagName() {
! return TAG_NAME;
! }
/**
***************
*** 118,126 ****
return payload;
}
private NamedObject payload;
! private static final String TAG_NAME="SignatureRequest";
! public static final String URI_NSSIGREQ="http://neuclear.org/neu/nssigrequest";
! public static final Namespace NS_NSSIGREQ=DocumentHelper.createNamespace("nsauth",URI_NSSIGREQ);
}
--- 120,129 ----
return payload;
}
+
private NamedObject payload;
! private static final String TAG_NAME = "SignatureRequest";
! public static final String URI_NSSIGREQ = "http://neuclear.org/neu/nssigrequest";
! public static final Namespace NS_NSSIGREQ = DocumentHelper.createNamespace("nsauth", URI_NSSIGREQ);
}
|
|
From: <pe...@us...> - 2003-09-22 19:24:37
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/cache
In directory sc8-pr-cvs1:/tmp/cvs-serv4908/src/java/org/neuclear/id/cache
Modified Files:
NSCache.java
Log Message:
More fixes throughout to problems caused by renaming.
Index: NSCache.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/cache/NSCache.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** NSCache.java 19 Sep 2003 14:41:09 -0000 1.1.1.1
--- NSCache.java 22 Sep 2003 19:24:01 -0000 1.2
***************
*** 5,9 ****
import org.neuclear.id.NSTools;
import org.neuclear.id.NameSpace;
! import org.neuclear.utils.NeudistException;
/**
* The Idea of the NSCache is to have a quick cache of verified public NameSpaces. This is not stored, but is created from scratch
--- 5,10 ----
import org.neuclear.id.NSTools;
import org.neuclear.id.NameSpace;
! import org.neudist.utils.NeudistException;
!
/**
* The Idea of the NSCache is to have a quick cache of verified public NameSpaces. This is not stored, but is created from scratch
***************
*** 14,18 ****
public final class NSCache {
private NSCache() {
! spaces=new Cache();
}
--- 15,19 ----
public final class NSCache {
private NSCache() {
! spaces = new Cache();
}
***************
*** 20,31 ****
return new NSCache();
}
/**
! * Attempts to get a verified PublicKey for the given name from the cache
! * @param name Fully Normalised name
! * @return a valid NameSpace object if found otherwise null
! */
! public NameSpace fetchCached(String name) {
try { // I dont like the way it forces me to catch this. I need to rewrite it.
! return (NameSpace)spaces.fetch(name);
} catch (NoSuchElement noSuchElement) {
return null;
--- 21,33 ----
return new NSCache();
}
+
/**
! * Attempts to get a verified PublicKey for the given name from the cache
! * @param name Fully Normalised name
! * @return a valid NameSpace object if found otherwise null
! */
! public NameSpace fetchCached(String name) {
try { // I dont like the way it forces me to catch this. I need to rewrite it.
! return (NameSpace) spaces.fetch(name);
} catch (NoSuchElement noSuchElement) {
return null;
***************
*** 33,43 ****
}
! public void cache(NameSpace ns) throws NeudistException{
// Only store if it's parent is already here
! String parentName=NSTools.getParentNSURI(ns.getName());
! if ((fetchCached(parentName)!=null)||(parentName.equals("neu://"))){
! spaces.put(ns.getName(),ns);
}
}
private final Cache spaces;
}
--- 35,46 ----
}
! public void cache(NameSpace ns) throws NeudistException {
// Only store if it's parent is already here
! String parentName = NSTools.getParentNSURI(ns.getName());
! if ((fetchCached(parentName) != null) || (parentName.equals("neu://"))) {
! spaces.put(ns.getName(), ns);
}
}
+
private final Cache spaces;
}
|
|
From: <pe...@us...> - 2003-09-22 19:24:14
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/store In directory sc8-pr-cvs1:/tmp/cvs-serv4908/src/java/org/neuclear/store Modified Files: EncryptedFileStore.java FileStore.java Store.java Log Message: More fixes throughout to problems caused by renaming. Index: EncryptedFileStore.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/store/EncryptedFileStore.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** EncryptedFileStore.java 19 Sep 2003 14:41:22 -0000 1.1.1.1 --- EncryptedFileStore.java 22 Sep 2003 19:24:02 -0000 1.2 *************** *** 2,5 **** --- 2,8 ---- * $Id$ * $Log$ + * 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:22 pelle * First import into the neuclear project. This was originally under the SF neudist *************** *** 116,128 **** import org.dom4j.DocumentException; import org.dom4j.DocumentHelper; - import org.neuclear.crypto.CryptoTools; import org.neuclear.id.NSTools; import org.neuclear.id.NamedObject; import org.neuclear.id.NamedObjectFactory; ! import org.neuclear.utils.NeudistException; ! import org.neuclear.utils.Utility; ! import org.neuclear.xml.xmlsec.XMLSecTools; import java.io.*; /** * We need both a simple FileStore and an encrypted one. The encrypted one stores each object using a filename generated through --- 119,132 ---- import org.dom4j.DocumentException; import org.dom4j.DocumentHelper; import org.neuclear.id.NSTools; import org.neuclear.id.NamedObject; import org.neuclear.id.NamedObjectFactory; ! import org.neudist.crypto.CryptoTools; ! import org.neudist.utils.NeudistException; ! import org.neudist.utils.Utility; ! import org.neudist.xml.xmlsec.XMLSecTools; import java.io.*; + /** * We need both a simple FileStore and an encrypted one. The encrypted one stores each object using a filename generated through *************** *** 131,173 **** * */ ! public class EncryptedFileStore extends FileStore { public EncryptedFileStore(String base) { super(base); } ! protected void rawStore(NamedObject obj) throws IOException,NeudistException { ! String outputFilename=base+getFileName(obj); ! System.out.println("Outputting to: "+outputFilename); ! File outputFile=new File(outputFilename); outputFile.getParentFile().mkdirs(); // Quick and dirty encryption for now. // String xmlData=obj.getElement().asXML(); ! byte encrypted[]=CryptoTools.encrypt(obj.getName(),XMLSecTools.getElementBytes(obj.getElement())); ! BufferedOutputStream os=new BufferedOutputStream(new FileOutputStream(outputFile)); os.write(encrypted); os.close(); ! } ! protected NamedObject fetch(String name) throws NeudistException { ! String deURLizedName=NSTools.normalizeNameURI(name); ! String inputFilename=base+getFileName(deURLizedName); ! System.out.println("Loading from: "+inputFilename); ! File fin=new File(inputFilename); if (!fin.exists()) return null; ! NamedObject ns=null; try { ! byte input[]=new byte[(int)fin.length()]; ! FileInputStream fis=new FileInputStream(fin); ! fis.read(input,0,input.length); ! byte clear[]=CryptoTools.decrypt(deURLizedName.getBytes(),input); ! int last=clear.length; ! for (last=clear.length;clear[last-1]!=(byte)'>';last--); ! String clearString=new String(clear,0,last); // System.out.print("Read: "); // System.out.println(clearString); ! org.dom4j.Document doc=DocumentHelper.parseText(clearString); ! ns=NamedObjectFactory.createNamedObject(doc); // Utility.rethrowException(e); } catch (IOException e) { --- 135,179 ---- * */ ! public class EncryptedFileStore extends FileStore { public EncryptedFileStore(String base) { super(base); } ! ! protected void rawStore(NamedObject obj) throws IOException, NeudistException { ! String outputFilename = base + getFileName(obj); ! System.out.println("Outputting to: " + outputFilename); ! File outputFile = new File(outputFilename); outputFile.getParentFile().mkdirs(); // Quick and dirty encryption for now. // String xmlData=obj.getElement().asXML(); ! byte encrypted[] = CryptoTools.encrypt(obj.getName(), XMLSecTools.getElementBytes(obj.getElement())); ! BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(outputFile)); os.write(encrypted); os.close(); ! } ! ! protected NamedObject fetch(String name) throws NeudistException { ! String deURLizedName = NSTools.normalizeNameURI(name); ! String inputFilename = base + getFileName(deURLizedName); ! System.out.println("Loading from: " + inputFilename); ! File fin = new File(inputFilename); if (!fin.exists()) return null; ! NamedObject ns = null; try { ! byte input[] = new byte[(int) fin.length()]; ! FileInputStream fis = new FileInputStream(fin); ! fis.read(input, 0, input.length); ! byte clear[] = CryptoTools.decrypt(deURLizedName.getBytes(), input); ! int last = clear.length; ! for (last = clear.length; clear[last - 1] != (byte) '>'; last--) ; ! String clearString = new String(clear, 0, last); // System.out.print("Read: "); // System.out.println(clearString); ! org.dom4j.Document doc = DocumentHelper.parseText(clearString); ! ns = NamedObjectFactory.createNamedObject(doc); // Utility.rethrowException(e); } catch (IOException e) { *************** *** 182,204 **** } ! protected static String getFileName(String name) throws NeudistException{ ! String deURLizedName=NSTools.normalizeNameURI(name); ! byte hash[]=CryptoTools.formatAsURLSafe(CryptoTools.digest512(deURLizedName.getBytes())).getBytes(); ! //if (true) return new String(hash); ! int partlength=hash.length/8; ! byte newName[]=new byte[hash.length+8]; ! for (int i=0;i<8;i++) { ! newName[i*(partlength+1)]=(byte)'/'; ! System.arraycopy(hash,(i*partlength),newName,(i*(partlength+1))+1,partlength); } try { ! if (hash.length%8!=0) ! System.arraycopy(hash,8*partlength,newName,(8*(partlength+1)),hash.length%8); } catch (ArrayIndexOutOfBoundsException e) { ! System.err.println("hash.length="+hash.length+", newName.length="+newName.length+", partlength="+partlength); ! System.err.println("System.arraycopy(hash,"+9*partlength+",newName,"+(9*(partlength+1))+","+hash.length%8+");"); } return new String(newName); } protected static String getFileName(NamedObject obj) throws NeudistException { return getFileName(obj.getName()); --- 188,211 ---- } ! protected static String getFileName(String name) throws NeudistException { ! String deURLizedName = NSTools.normalizeNameURI(name); ! byte hash[] = CryptoTools.formatAsURLSafe(CryptoTools.digest512(deURLizedName.getBytes())).getBytes(); ! //if (true) return new String(hash); ! int partlength = hash.length / 8; ! byte newName[] = new byte[hash.length + 8]; ! for (int i = 0; i < 8; i++) { ! newName[i * (partlength + 1)] = (byte) '/'; ! System.arraycopy(hash, (i * partlength), newName, (i * (partlength + 1)) + 1, partlength); } try { ! if (hash.length % 8 != 0) ! System.arraycopy(hash, 8 * partlength, newName, (8 * (partlength + 1)), hash.length % 8); } catch (ArrayIndexOutOfBoundsException e) { ! System.err.println("hash.length=" + hash.length + ", newName.length=" + newName.length + ", partlength=" + partlength); ! System.err.println("System.arraycopy(hash," + 9 * partlength + ",newName," + (9 * (partlength + 1)) + "," + hash.length % 8 + ");"); } return new String(newName); } + protected static String getFileName(NamedObject obj) throws NeudistException { return getFileName(obj.getName()); Index: FileStore.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/store/FileStore.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** FileStore.java 19 Sep 2003 14:41:19 -0000 1.1.1.1 --- FileStore.java 22 Sep 2003 19:24:02 -0000 1.2 *************** *** 2,5 **** --- 2,8 ---- * $Id$ * $Log$ + * 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:19 pelle * First import into the neuclear project. This was originally under the SF neudist *************** *** 100,109 **** //import org.neuclear.id.NSDLObject; import org.dom4j.Document; import org.neuclear.id.NSTools; import org.neuclear.id.NamedObject; import org.neuclear.id.NamedObjectFactory; ! import org.neuclear.utils.NeudistException; ! import org.neuclear.xml.XMLTools; import java.io.File; --- 103,113 ---- //import org.neuclear.id.NSDLObject; + import org.dom4j.Document; import org.neuclear.id.NSTools; import org.neuclear.id.NamedObject; import org.neuclear.id.NamedObjectFactory; ! import org.neudist.utils.NeudistException; ! import org.neudist.xml.XMLTools; import java.io.File; *************** *** 111,114 **** --- 115,119 ---- import java.io.FileNotFoundException; import java.io.IOException; + /** * We need both a simple FileStore and an encrypted one. The encrypted one stores each object using a filename generated through *************** *** 117,131 **** * */ ! public class FileStore extends Store { public FileStore(String base) { ! this.base=base; } ! protected void rawStore(NamedObject obj) throws IOException,NeudistException { ! String outputFilename=base+getFileName(obj); ! System.out.println("Outputting to: "+outputFilename); ! File outputFile=new File(outputFilename); outputFile.getParentFile().mkdirs(); ! XMLTools.writeFile(outputFile,obj.getElement()); ! } // public void store(Document doc) throws InvalidNameSpaceException,IOException { --- 122,137 ---- * */ ! public class FileStore extends Store { public FileStore(String base) { ! this.base = base; } ! ! protected void rawStore(NamedObject obj) throws IOException, NeudistException { ! String outputFilename = base + getFileName(obj); ! System.out.println("Outputting to: " + outputFilename); ! File outputFile = new File(outputFilename); outputFile.getParentFile().mkdirs(); ! XMLTools.writeFile(outputFile, obj.getElement()); ! } // public void store(Document doc) throws InvalidNameSpaceException,IOException { *************** *** 133,147 **** // } ! protected NamedObject fetch(String name) throws NeudistException { ! String inputFilename=base+getFileName(NSTools.normalizeNameURI(name)); ! System.out.println("Loading from: "+inputFilename); ! File fin=new File(inputFilename); if (!fin.exists()) return null; ! NamedObject ns=null; try { ! Document doc=XMLTools.loadDocument(new FileInputStream(fin)); ! ns=NamedObjectFactory.createNamedObject(doc); // System.out.println("NEUDIST: Fetched NamedObject tag:"+rootName.getName()+" URI:"+rootName.getNamespaceURI()); // } catch (ParserConfigurationException e) { --- 139,153 ---- // } ! protected NamedObject fetch(String name) throws NeudistException { ! String inputFilename = base + getFileName(NSTools.normalizeNameURI(name)); ! System.out.println("Loading from: " + inputFilename); ! File fin = new File(inputFilename); if (!fin.exists()) return null; ! NamedObject ns = null; try { ! Document doc = XMLTools.loadDocument(new FileInputStream(fin)); ! ns = NamedObjectFactory.createNamedObject(doc); // System.out.println("NEUDIST: Fetched NamedObject tag:"+rootName.getName()+" URI:"+rootName.getNamespaceURI()); // } catch (ParserConfigurationException e) { *************** *** 156,168 **** ! protected static String getFileName(String name) throws NeudistException{ if (name.startsWith("neu://")) ! name=name.substring(5); ! if (name.equals("/")||name.equals("")) return "/root.id"; else ! return name+".id"; } ! protected static String getFileName(NamedObject obj) throws NeudistException{ return getFileName(obj.getName()); // if (! (obj instanceof NameSpace)) --- 162,175 ---- ! protected static String getFileName(String name) throws NeudistException { if (name.startsWith("neu://")) ! name = name.substring(5); ! if (name.equals("/") || name.equals("")) return "/root.id"; else ! return name + ".id"; } ! ! protected static String getFileName(NamedObject obj) throws NeudistException { return getFileName(obj.getName()); // if (! (obj instanceof NameSpace)) Index: Store.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/store/Store.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Store.java 19 Sep 2003 14:41:16 -0000 1.1.1.1 --- Store.java 22 Sep 2003 19:24:02 -0000 1.2 *************** *** 2,5 **** --- 2,8 ---- * $Id$ * $Log$ + * 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:16 pelle * First import into the neuclear project. This was originally under the SF neudist *************** *** 115,119 **** import org.neuclear.id.verifier.NSVerifier; import org.neuclear.receiver.Receiver; ! import org.neuclear.utils.NeudistException; import java.io.IOException; --- 118,122 ---- import org.neuclear.id.verifier.NSVerifier; import org.neuclear.receiver.Receiver; ! import org.neudist.utils.NeudistException; import java.io.IOException; *************** *** 126,130 **** * This handles the NameSpace checking on the object. */ ! public final void receive(NamedObject obj) throws InvalidNameSpaceException, NeudistException { try { // Dont allow overwrites --- 129,133 ---- * This handles the NameSpace checking on the object. */ ! public final void receive(NamedObject obj) throws InvalidNameSpaceException, NeudistException { try { // Dont allow overwrites *************** *** 134,140 **** if (!NSVerifier.isNameValid(obj)) ! throw new InvalidNameSpaceException("The name: "+obj.getName()+" is not allowed"); rawStore(obj); ! if (next!=null) next.receive(obj); --- 137,143 ---- if (!NSVerifier.isNameValid(obj)) ! throw new InvalidNameSpaceException("The name: " + obj.getName() + " is not allowed"); rawStore(obj); ! if (next != null) next.receive(obj); *************** *** 154,158 **** * Override this for each specific Store type */ ! protected void rawStore(NamedObject obj) throws IOException,NeudistException { ; } --- 157,161 ---- * Override this for each specific Store type */ ! protected void rawStore(NamedObject obj) throws IOException, NeudistException { ; } |
|
From: <pe...@us...> - 2003-09-22 19:24:13
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/signers/servlet
In directory sc8-pr-cvs1:/tmp/cvs-serv4908/src/java/org/neuclear/signers/servlet
Modified Files:
DemoSigningServlet.java SigningServlet.java
Log Message:
More fixes throughout to problems caused by renaming.
Index: DemoSigningServlet.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/signers/servlet/DemoSigningServlet.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** DemoSigningServlet.java 19 Sep 2003 14:41:32 -0000 1.1.1.1
--- DemoSigningServlet.java 22 Sep 2003 19:24:02 -0000 1.2
***************
*** 2,5 ****
--- 2,8 ----
* $Id$
* $Log$
+ * 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:32 pelle
* First import into the neuclear project. This was originally under the SF neudist
***************
*** 99,104 ****
import org.neuclear.id.NSTools;
import org.neuclear.id.NameSpace;
! import org.neuclear.signers.SimpleSignerStore;
! import org.neuclear.utils.NeudistException;
import javax.servlet.ServletConfig;
--- 102,108 ----
import org.neuclear.id.NSTools;
import org.neuclear.id.NameSpace;
! import org.neudist.crypto.signerstores.SignerStore;
! import org.neudist.crypto.signerstores.SimpleSignerStore;
! import org.neudist.utils.NeudistException;
import javax.servlet.ServletConfig;
***************
*** 110,139 ****
import java.security.interfaces.RSAPrivateKey;
! public class DemoSigningServlet extends SigningServlet {
! private void buildTree() throws GeneralSecurityException,NeudistException,IOException {
! System.out.println("NEUDIST: Creating NameSpace Tree");
! kpg=KeyPairGenerator.getInstance("RSA");
! kpg.initialize(2048,new SecureRandom("Cartagena".getBytes()));
! PrivateKey signer=getTestKey();
! createNS("/test/one","password",signer);
! createNS("/test/two","password",signer);
}
! private RSAPrivateKey getTestKey() throws GeneralSecurityException,IOException {
! KeyStore ks=KeyStore.getInstance("Uber");
! FileInputStream in=new FileInputStream(context.getRealPath("/WEB-INF/testkeys.ks"));
! ks.load(in,"neuclear".toCharArray());
! return (RSAPrivateKey)ks.getKey("neu://test","neuclear".toCharArray());
}
! private void createNS(String name,String newPassword,PrivateKey signer) throws IOException, NeudistException, GeneralSecurityException {
! name=NSTools.normalizeNameURI(name);
! System.out.println("NEUDIST: Generating key and NameSpace for: "+name);
! KeyPair kp=kpg.generateKeyPair();
! ((org.neuclear.crypto.signerstores.SimpleSignerStore)getKeyStore()).addKey(name,newPassword.toCharArray(),kp.getPrivate());
System.out.println("NEUDIST: Creating NameSpace");
! NameSpace ns=new NameSpace(name,kp.getPublic(),"http://neuclear.org:8080/neudistframework/Store","http://neuclear.org:8080/neudistframework/Signer","http://neuclear.org:8080/neudistframework/Logger","");//TODO Fix these values
// id.addTarget(new TargetReference(id,,"store"));
System.out.println("NEUDIST: Signing");
--- 114,143 ----
import java.security.interfaces.RSAPrivateKey;
! public class DemoSigningServlet extends SigningServlet {
! private void buildTree() throws GeneralSecurityException, NeudistException, IOException {
! System.out.println("NEUDIST: Creating NameSpace Tree");
! kpg = KeyPairGenerator.getInstance("RSA");
! kpg.initialize(2048, new SecureRandom("Cartagena".getBytes()));
! PrivateKey signer = getTestKey();
! createNS("/test/one", "password", signer);
! createNS("/test/two", "password", signer);
}
! private RSAPrivateKey getTestKey() throws GeneralSecurityException, IOException {
! KeyStore ks = KeyStore.getInstance("Uber");
! FileInputStream in = new FileInputStream(context.getRealPath("/WEB-INF/testkeys.ks"));
! ks.load(in, "neuclear".toCharArray());
! return (RSAPrivateKey) ks.getKey("neu://test", "neuclear".toCharArray());
}
! private void createNS(String name, String newPassword, PrivateKey signer) throws IOException, NeudistException, GeneralSecurityException {
! name = NSTools.normalizeNameURI(name);
! System.out.println("NEUDIST: Generating key and NameSpace for: " + name);
! KeyPair kp = kpg.generateKeyPair();
! ((SimpleSignerStore) getKeyStore()).addKey(name, newPassword.toCharArray(), kp.getPrivate());
System.out.println("NEUDIST: Creating NameSpace");
! NameSpace ns = new NameSpace(name, kp.getPublic(), "http://neuclear.org:8080/neudistframework/Store", "http://neuclear.org:8080/neudistframework/Signer", "http://neuclear.org:8080/neudistframework/Logger", "");//TODO Fix these values
// id.addTarget(new TargetReference(id,,"store"));
System.out.println("NEUDIST: Signing");
***************
*** 146,150 ****
ns.sendObject();
} catch (InvalidNameSpaceException e) {
! System.out.println("NEUDIST: NameSpace Error: "+e.getLocalizedMessage());
}
}
--- 150,154 ----
ns.sendObject();
} catch (InvalidNameSpaceException e) {
! System.out.println("NEUDIST: NameSpace Error: " + e.getLocalizedMessage());
}
}
***************
*** 156,167 ****
} catch (GeneralSecurityException e) {
e.printStackTrace(System.out);
! } catch (IOException e) {
! e.printStackTrace(System.out);
! } catch (NeudistException e) {
! e.printStackTrace(System.out);
! }
}
! protected static org.neuclear.signers.SignerStore getKeyStore(File keyStoreFile, Object kspassword) throws GeneralSecurityException, IOException, NeudistException {
return new SimpleSignerStore(keyStoreFile);
}
--- 160,171 ----
} catch (GeneralSecurityException e) {
e.printStackTrace(System.out);
! } catch (IOException e) {
! e.printStackTrace(System.out);
! } catch (NeudistException e) {
! e.printStackTrace(System.out);
! }
}
! protected static SignerStore getKeyStore(File keyStoreFile, Object kspassword) throws GeneralSecurityException, IOException, NeudistException {
return new SimpleSignerStore(keyStoreFile);
}
Index: SigningServlet.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/signers/servlet/SigningServlet.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** SigningServlet.java 19 Sep 2003 14:41:40 -0000 1.1.1.1
--- SigningServlet.java 22 Sep 2003 19:24:02 -0000 1.2
***************
*** 2,5 ****
--- 2,8 ----
* $Id$
* $Log$
+ * 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:40 pelle
* First import into the neuclear project. This was originally under the SF neudist
***************
*** 122,135 ****
import org.neuclear.id.signrequest.SignatureRequest;
import org.neuclear.receiver.ReceiverServlet;
! import org.neuclear.signers.InvalidPassphraseException;
! import org.neuclear.signers.JCESignerStore;
! import org.neuclear.signers.NonExistingSignerException;
! import org.neuclear.signers.SignerStore;
! import org.neuclear.utils.NeudistException;
! import org.neuclear.utils.ServletTools;
! import org.neuclear.utils.Utility;
! import org.neuclear.xml.soap.SOAPException;
! import org.neuclear.xml.xmlsec.XMLSecTools;
! import org.neuclear.xml.xmlsec.XMLSecurityException;
import javax.servlet.ServletConfig;
--- 125,138 ----
import org.neuclear.id.signrequest.SignatureRequest;
import org.neuclear.receiver.ReceiverServlet;
! import org.neudist.crypto.signerstores.InvalidPassphraseException;
! import org.neudist.crypto.signerstores.JCESignerStore;
! import org.neudist.crypto.signerstores.NonExistingSignerException;
! import org.neudist.crypto.signerstores.SignerStore;
! import org.neudist.utils.NeudistException;
! import org.neudist.utils.ServletTools;
! import org.neudist.utils.Utility;
! import org.neudist.xml.soap.SOAPException;
! import org.neudist.xml.xmlsec.XMLSecTools;
! import org.neudist.xml.xmlsec.XMLSecurityException;
import javax.servlet.ServletConfig;
***************
*** 145,158 ****
import java.security.PrivateKey;
! public class SigningServlet extends ReceiverServlet {
! public void init(ServletConfig config) throws ServletException {
! System.out.println("NEUDIST: Initialising SigningServlet");
! super.init(config);
! context=config.getServletContext();
! try {
! System.out.println("NEUDIST: Initialising SigningServlet");
! title=Utility.denullString(config.getInitParameter("title").toString(),"NeuDist Signing Service");
! File keyStoreFile=new File(config.getServletContext().getRealPath(Utility.denullString(config.getInitParameter("keystore"),System.getProperty("user.home")+"/.neuclear/signers.ks")));
! System.out.println("NEUDIST: Using KeyStore: "+keyStoreFile.getAbsolutePath());
// ks=KeyStore.getInstance("JKS");
// char password[]=Utility.denullString(config.getInitParameter("keystore.passphrase"),"SuperDuper").toCharArray();
--- 148,161 ----
import java.security.PrivateKey;
! public class SigningServlet extends ReceiverServlet {
! public void init(ServletConfig config) throws ServletException {
! System.out.println("NEUDIST: Initialising SigningServlet");
! super.init(config);
! context = config.getServletContext();
! try {
! System.out.println("NEUDIST: Initialising SigningServlet");
! title = Utility.denullString(config.getInitParameter("title").toString(), "NeuDist Signing Service");
! File keyStoreFile = new File(config.getServletContext().getRealPath(Utility.denullString(config.getInitParameter("keystore"), System.getProperty("user.home") + "/.neuclear/signers.ks")));
! System.out.println("NEUDIST: Using KeyStore: " + keyStoreFile.getAbsolutePath());
// ks=KeyStore.getInstance("JKS");
// char password[]=Utility.denullString(config.getInitParameter("keystore.passphrase"),"SuperDuper").toCharArray();
***************
*** 160,166 ****
// System.out.println("NEUDIST: Creating KeyStore ");
// ks.load(null,password);
! if (ks==null) {
! ks=getKeyStore(keyStoreFile,config.getInitParameter("keystore.password"));
! }
// if (keyStoreFile.getParent()!=null)
// keyStoreFile.getParentFile().mkdirs();
--- 163,169 ----
// System.out.println("NEUDIST: Creating KeyStore ");
// ks.load(null,password);
! if (ks == null) {
! ks = getKeyStore(keyStoreFile, config.getInitParameter("keystore.password"));
! }
// if (keyStoreFile.getParent()!=null)
// keyStoreFile.getParentFile().mkdirs();
***************
*** 170,187 ****
// ks.load(new FileInputStream(keyStoreFile),password);
// }
! System.out.println("NEUDIST: Finished SigningServlet Init ");
! } catch (GeneralSecurityException e) {
! e.printStackTrace(System.out);
! } catch (IOException e) {
! e.printStackTrace(System.out);
! } catch (NeudistException e) {
! e.printStackTrace(System.out);
! }
! }
! protected static SignerStore getKeyStore(File keyStoreFile,String kspassword) throws GeneralSecurityException,IOException,NeudistException{
return new JCESignerStore(keyStoreFile, kspassword.toCharArray());
}
--- 173,190 ----
// ks.load(new FileInputStream(keyStoreFile),password);
// }
! System.out.println("NEUDIST: Finished SigningServlet Init ");
! } catch (GeneralSecurityException e) {
! e.printStackTrace(System.out);
! } catch (IOException e) {
! e.printStackTrace(System.out);
! } catch (NeudistException e) {
! e.printStackTrace(System.out);
! }
! }
! protected static SignerStore getKeyStore(File keyStoreFile, String kspassword) throws GeneralSecurityException, IOException, NeudistException {
return new JCESignerStore(keyStoreFile, kspassword.toCharArray());
}
***************
*** 191,238 ****
return ks;
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("NEUDIST: doPost()");
! if (request.getContentType().equals("text/xml")){
System.out.println("NEUDIST: call SOAP Servlet");
super.doPost(request, response);
return;
}
! response.setHeader("Pragma","no-cache");
! response.setDateHeader("Expires",0);
response.setContentType("text/html");
! PrintWriter out=response.getWriter();
! ServletTools.printHeader(out,request,title);
! String b64xml=request.getParameter("base64xml");
! String xml=request.getParameter("xml");
! String endpoint=request.getParameter("endpoint");
! String passphrase=request.getParameter("passphrase");
SignatureRequest sigreq;
NamedObject named;
! boolean isSigned=false;
! Element elem=null;
try {
if (!Utility.isEmpty(xml)) {
! elem=DocumentHelper.parseText(xml).getRootElement();
! } else if (!Utility.isEmpty(b64xml)) {
! elem=XMLSecTools.decodeElementBase64(b64xml);
! }
! sigreq=new SignatureRequest(elem);
! named=sigreq.getPayload();
! if (!Utility.isEmpty(passphrase)&&!Utility.isEmpty(request.getParameter("sign"))) {
out.println("Signing ...");
out.flush();
try {
! signObject(named,passphrase.toCharArray());
! isSigned=true;
out.println("<br>Done<br>");
} catch (InvalidNameSpaceException e) {
out.println("<br><font color=\"red\"><b>ERROR: Invalid NameSpace</b></font><br>");
! isSigned=false;
} catch (InvalidPassphraseException e) {
out.println("<br><font color=\"red\"><b>ERROR: Wrong Passphrase</b></font><br>");
! isSigned=false;
} catch (NonExistingSignerException e) {
out.println("<br><font color=\"red\"><b>ERROR: We Aren't Able to Sign for that NameSpace</b></font><br>");
! isSigned=false;
}
--- 194,242 ----
return ks;
}
+
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("NEUDIST: doPost()");
! if (request.getContentType().equals("text/xml")) {
System.out.println("NEUDIST: call SOAP Servlet");
super.doPost(request, response);
return;
}
! response.setHeader("Pragma", "no-cache");
! response.setDateHeader("Expires", 0);
response.setContentType("text/html");
! PrintWriter out = response.getWriter();
! ServletTools.printHeader(out, request, title);
! String b64xml = request.getParameter("base64xml");
! String xml = request.getParameter("xml");
! String endpoint = request.getParameter("endpoint");
! String passphrase = request.getParameter("passphrase");
SignatureRequest sigreq;
NamedObject named;
! boolean isSigned = false;
! Element elem = null;
try {
if (!Utility.isEmpty(xml)) {
! elem = DocumentHelper.parseText(xml).getRootElement();
! } else if (!Utility.isEmpty(b64xml)) {
! elem = XMLSecTools.decodeElementBase64(b64xml);
! }
! sigreq = new SignatureRequest(elem);
! named = sigreq.getPayload();
! if (!Utility.isEmpty(passphrase) && !Utility.isEmpty(request.getParameter("sign"))) {
out.println("Signing ...");
out.flush();
try {
! signObject(named, passphrase.toCharArray());
! isSigned = true;
out.println("<br>Done<br>");
} catch (InvalidNameSpaceException e) {
out.println("<br><font color=\"red\"><b>ERROR: Invalid NameSpace</b></font><br>");
! isSigned = false;
} catch (InvalidPassphraseException e) {
out.println("<br><font color=\"red\"><b>ERROR: Wrong Passphrase</b></font><br>");
! isSigned = false;
} catch (NonExistingSignerException e) {
out.println("<br><font color=\"red\"><b>ERROR: We Aren't Able to Sign for that NameSpace</b></font><br>");
! isSigned = false;
}
***************
*** 247,258 ****
// explwriter.write(((Explainable)named).explain());
out.print("<pre>");
! StringWriter sw=new StringWriter();
OutputFormat format = OutputFormat.createPrettyPrint();
! XMLWriter writer = new XMLWriter( sw, format );
! writer.write( elem );
out.write(sw.toString());
out.println("</pre></td></tr></table>");
! if(!isSigned) {
! out.println("<table bgcolor=\"#D0FFD0\"><tr><td bgcolor=\"#026A32\"><h4 style=\"color: white\">Do you wish to sign this?</h4></td></tr>");
out.println("<tr><td><form action=\"Signer\" method=\"POST\"><input name=\"base64xml\" value=\"");
out.println(XMLSecTools.encodeElementBase64(elem));
--- 251,262 ----
// explwriter.write(((Explainable)named).explain());
out.print("<pre>");
! StringWriter sw = new StringWriter();
OutputFormat format = OutputFormat.createPrettyPrint();
! XMLWriter writer = new XMLWriter(sw, format);
! writer.write(elem);
out.write(sw.toString());
out.println("</pre></td></tr></table>");
! if (!isSigned) {
! out.println("<table bgcolor=\"#D0FFD0\"><tr><td bgcolor=\"#026A32\"><h4 style=\"color: white\">Do you wish to sign this?</h4></td></tr>");
out.println("<tr><td><form action=\"Signer\" method=\"POST\"><input name=\"base64xml\" value=\"");
out.println(XMLSecTools.encodeElementBase64(elem));
***************
*** 260,265 ****
out.println(endpoint);
out.println("\" type=\"hidden\"/>\nPassphrase: <input name=\"passphrase\" type=\"password\" size=\"40\">");
! out.println(" <input type=\"submit\" name=\"sign\" value=\"Sign\"></form></td></tr></table>");
! } else if (!Utility.isEmpty(endpoint)) {
out.println("<h3><a href=\"");
out.println(endpoint);
--- 264,269 ----
out.println(endpoint);
out.println("\" type=\"hidden\"/>\nPassphrase: <input name=\"passphrase\" type=\"password\" size=\"40\">");
! out.println(" <input type=\"submit\" name=\"sign\" value=\"Sign\"></form></td></tr></table>");
! } else if (!Utility.isEmpty(endpoint)) {
out.println("<h3><a href=\"");
out.println(endpoint);
***************
*** 271,292 ****
} catch (DocumentException e) {
out.println("<br><font color=\"red\"><pre>");
! e.printStackTrace(out);
! out.println("</pre></font>");
} catch (NeudistException e) {
out.println("<br><font color=\"red\"><pre>");
! e.printStackTrace(out);
! out.println("</pre></font>");
! }
out.println("<p align\"left\"><img src=\"images/neubia40x40.png\"><br><a href=\"http://www.neubia.com\"><i>© 2002 Antilles Software Ventures SA</i></a></body></html>");
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
! response.setHeader("Pragma","no-cache");
! response.setDateHeader("Expires",0);
response.setContentType("text/html");
! System.out.println("NEUDIST: doGet()");
! PrintWriter out=response.getWriter();
! ServletTools.printHeader(out,request,title);
out.println("<form method=\"POST\" action=\"Signer\"><textarea name=\"xml\" cols=\"80\"rows=\"30\"></textarea><br><input type=\"submit\" name=\"submit\" value=\"Confirm\"></form>");
out.println("</body></html>");
--- 275,296 ----
} catch (DocumentException e) {
out.println("<br><font color=\"red\"><pre>");
! e.printStackTrace(out);
! out.println("</pre></font>");
} catch (NeudistException e) {
out.println("<br><font color=\"red\"><pre>");
! e.printStackTrace(out);
! out.println("</pre></font>");
! }
out.println("<p align\"left\"><img src=\"images/neubia40x40.png\"><br><a href=\"http://www.neubia.com\"><i>© 2002 Antilles Software Ventures SA</i></a></body></html>");
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
! response.setHeader("Pragma", "no-cache");
! response.setDateHeader("Expires", 0);
response.setContentType("text/html");
! System.out.println("NEUDIST: doGet()");
! PrintWriter out = response.getWriter();
! ServletTools.printHeader(out, request, title);
out.println("<form method=\"POST\" action=\"Signer\"><textarea name=\"xml\" cols=\"80\"rows=\"30\"></textarea><br><input type=\"submit\" name=\"submit\" value=\"Confirm\"></form>");
out.println("</body></html>");
***************
*** 296,306 ****
public Element receiveNamedObject(NamedObject obj, String soapAction) throws SOAPException {
try {
! signObject(obj,"hello".toCharArray());// TODO How do we get the passphrase here? Popup request?
return obj.getElement();
} catch (InvalidNameSpaceException e) {
! throw new SOAPException(e);
! } catch (InvalidPassphraseException e) {
! throw new SOAPException(e);
! } catch (NonExistingSignerException e) {
throw new SOAPException(e);
} catch (NeudistException e) {
--- 300,310 ----
public Element receiveNamedObject(NamedObject obj, String soapAction) throws SOAPException {
try {
! signObject(obj, "hello".toCharArray());// TODO How do we get the passphrase here? Popup request?
return obj.getElement();
} catch (InvalidNameSpaceException e) {
! throw new SOAPException(e);
! } catch (InvalidPassphraseException e) {
! throw new SOAPException(e);
! } catch (NonExistingSignerException e) {
throw new SOAPException(e);
} catch (NeudistException e) {
***************
*** 309,319 ****
}
! protected static void signObject(NamedObject obj, char passphrase[]) throws NeudistException, InvalidNameSpaceException, InvalidPassphraseException,NonExistingSignerException {
if (!obj.isSigned()) {
try {
! String parentName=NSTools.getParentNSURI(obj.getName());
! PrivateKey pk=ks.getKey(parentName,passphrase);
! if (pk==null)
! throw new NonExistingSignerException("Signing Service doesn't contain Signing keys for: "+parentName);
obj.sign(pk);
// obj.store();
--- 313,323 ----
}
! protected static void signObject(NamedObject obj, char passphrase[]) throws NeudistException, InvalidNameSpaceException, InvalidPassphraseException, NonExistingSignerException {
if (!obj.isSigned()) {
try {
! String parentName = NSTools.getParentNSURI(obj.getName());
! PrivateKey pk = ks.getKey(parentName, passphrase);
! if (pk == null)
! throw new NonExistingSignerException("Signing Service doesn't contain Signing keys for: " + parentName);
obj.sign(pk);
// obj.store();
***************
*** 328,331 ****
--- 332,336 ----
}
+
protected javax.servlet.ServletContext context;
private static SignerStore ks;
|
|
From: <pe...@us...> - 2003-09-22 19:24:13
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/senders
In directory sc8-pr-cvs1:/tmp/cvs-serv4908/src/java/org/neuclear/senders
Modified Files:
LogSender.java SmtpSender.java SoapSender.java
Added Files:
Sender.java
Log Message:
More fixes throughout to problems caused by renaming.
--- NEW FILE: Sender.java ---
package org.neuclear.senders;
import org.neuclear.id.NamedObject;
import org.neudist.utils.NeudistException;
/*
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
*/
/**
*
* User: pelleb
* Date: Sep 22, 2003
* Time: 1:28:39 PM
*/
public abstract class Sender {
public abstract void send(String endpoint, NamedObject obj) throws NeudistException;
public static void quickSend(String receiver, NamedObject obj) {
}
}
Index: LogSender.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/senders/LogSender.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** LogSender.java 19 Sep 2003 14:41:29 -0000 1.1.1.1
--- LogSender.java 22 Sep 2003 19:24:02 -0000 1.2
***************
*** 1,10 ****
package org.neuclear.senders;
- import org.neuclear.crypto.Base64;
import org.neuclear.id.NamedObject;
import org.neuclear.id.NamedObjectFactory;
import org.neuclear.time.TimeTools;
! import org.neuclear.utils.NeudistException;
! import org.neuclear.utils.Utility;
import java.io.BufferedReader;
--- 1,10 ----
package org.neuclear.senders;
import org.neuclear.id.NamedObject;
import org.neuclear.id.NamedObjectFactory;
import org.neuclear.time.TimeTools;
! import org.neudist.crypto.Base64;
! import org.neudist.utils.NeudistException;
! import org.neudist.utils.Utility;
import java.io.BufferedReader;
***************
*** 23,26 ****
--- 23,29 ----
* $Id$
* $Log$
+ * 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:29 pelle
* First import into the neuclear project. This was originally under the SF neudist
***************
*** 47,53 ****
public void send(String endpoint, NamedObject obj) throws NeudistException {
try {
! String digest=URLEncoder.encode(Base64.encode(obj.getDigest()));
! String name=URLEncoder.encode(obj.getName());
! URL url=new URL(Utility.denullString(endpoint,LOGGER)+"?nohtml=1&name="+name+"&digest="+digest);
url.openStream();
--- 50,56 ----
public void send(String endpoint, NamedObject obj) throws NeudistException {
try {
! String digest = URLEncoder.encode(Base64.encode(obj.getDigest()));
! String name = URLEncoder.encode(obj.getName());
! URL url = new URL(Utility.denullString(endpoint, LOGGER) + "?nohtml=1&name=" + name + "&digest=" + digest);
url.openStream();
***************
*** 56,91 ****
// if (!line.substring(0,2).equals("OK")) // TODO We need to be able to sense if there is a real error
// System.err.println("Error logging: "+line);
! //throw new NeudistException("Object wasn't logged");
} catch (MalformedURLException e) {
Utility.rethrowException(e);
} catch (IOException e) {
! Utility.rethrowException(e);
}
}
! public static void main (String args[]){
try {
logObject("neu://free");
logObject("neu://free/pelle");
logObject("neu://pelle");
! System.out.println("Object neu://free/pelle was logged at: "+getTimeStamp(NamedObjectFactory.fetchNamedObject("neu://free/pelle")));
} catch (NeudistException e) {
e.printStackTrace(); //To change body of catch statement use Options | File Templates.
}
}
! public static Timestamp getTimeStamp(String endpoint,byte rdigest[]) throws NeudistException {
try {
! String digest=Base64.encode(rdigest);
// System.out.println(digest);
! String encdigest=URLEncoder.encode(digest);
! URL url=null;
! url = new URL(LOGGER+"?mode=Query&nohtml=1&digest="+encdigest);
! BufferedReader reader=new BufferedReader(new InputStreamReader(url.openStream()));
! String line=reader.readLine();
// System.out.println(line);
! int pos=line.indexOf('\t');
! if (pos>=0) {
! String stamp=line.substring(0,pos);
return TimeTools.parseTimeStamp(stamp);
}
--- 59,95 ----
// if (!line.substring(0,2).equals("OK")) // TODO We need to be able to sense if there is a real error
// System.err.println("Error logging: "+line);
! //throw new NeudistException("Object wasn't logged");
} catch (MalformedURLException e) {
Utility.rethrowException(e);
} catch (IOException e) {
! Utility.rethrowException(e);
}
}
! public static void main(String args[]) {
try {
logObject("neu://free");
logObject("neu://free/pelle");
logObject("neu://pelle");
! System.out.println("Object neu://free/pelle was logged at: " + getTimeStamp(NamedObjectFactory.fetchNamedObject("neu://free/pelle")));
} catch (NeudistException e) {
e.printStackTrace(); //To change body of catch statement use Options | File Templates.
}
}
!
! public static Timestamp getTimeStamp(String endpoint, byte rdigest[]) throws NeudistException {
try {
! String digest = Base64.encode(rdigest);
// System.out.println(digest);
! String encdigest = URLEncoder.encode(digest);
! URL url = null;
! url = new URL(LOGGER + "?mode=Query&nohtml=1&digest=" + encdigest);
! BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
! String line = reader.readLine();
// System.out.println(line);
! int pos = line.indexOf('\t');
! if (pos >= 0) {
! String stamp = line.substring(0, pos);
return TimeTools.parseTimeStamp(stamp);
}
***************
*** 98,103 ****
return null;
}
public static Timestamp getTimeStamp(NamedObject obj) throws NeudistException {
! return getTimeStamp(Utility.denullString(obj.getParent().getLogger(),LOGGER),obj.getDigest());
}
--- 102,108 ----
return null;
}
+
public static Timestamp getTimeStamp(NamedObject obj) throws NeudistException {
! return getTimeStamp(Utility.denullString(obj.getParent().getLogger(), LOGGER), obj.getDigest());
}
***************
*** 105,115 ****
private static void logObject(String name) throws NeudistException {
System.out.print("Fetching...");
! NamedObject obj=NamedObjectFactory.fetchNamedObject(name);
! System.out.println("Got "+obj.getName());
! Sender log=new LogSender();
System.out.print("Logging...");
! log.send(LOGGER,obj);
System.out.println("Done");
}
! public static final String LOGGER="http://logger.neuclear.org/log.cgi";
}
--- 110,121 ----
private static void logObject(String name) throws NeudistException {
System.out.print("Fetching...");
! NamedObject obj = NamedObjectFactory.fetchNamedObject(name);
! System.out.println("Got " + obj.getName());
! Sender log = new LogSender();
System.out.print("Logging...");
! log.send(LOGGER, obj);
System.out.println("Done");
}
!
! public static final String LOGGER = "http://logger.neuclear.org/log.cgi";
}
Index: SmtpSender.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/senders/SmtpSender.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** SmtpSender.java 19 Sep 2003 14:41:29 -0000 1.1.1.1
--- SmtpSender.java 22 Sep 2003 19:24:02 -0000 1.2
***************
*** 8,11 ****
--- 8,14 ----
* $Id$
* $Log$
+ * 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:29 pelle
* First import into the neuclear project. This was originally under the SF neudist
***************
*** 27,32 ****
import org.neuclear.id.NamedObject;
! import org.neuclear.utils.NeudistException;
! import org.neuclear.utils.Utility;
import javax.mail.*;
--- 30,35 ----
import org.neuclear.id.NamedObject;
! import org.neudist.utils.NeudistException;
! import org.neudist.utils.Utility;
import javax.mail.*;
***************
*** 42,46 ****
Properties props = System.getProperties();
if (endpoint.startsWith("mailto:"))
! endpoint=endpoint.substring(7);
// -- Attaching to default Session, or we could start a new one --
--- 45,49 ----
Properties props = System.getProperties();
if (endpoint.startsWith("mailto:"))
! endpoint = endpoint.substring(7);
// -- Attaching to default Session, or we could start a new one --
***************
*** 55,59 ****
msg.setFrom(new InternetAddress("pe...@ne..."));// TODO Remove this hardcoded email
msg.setRecipients(Message.RecipientType.TO,
! InternetAddress.parse(endpoint, false));
// -- We could include CC recipients too --
--- 58,62 ----
msg.setFrom(new InternetAddress("pe...@ne..."));// TODO Remove this hardcoded email
msg.setRecipients(Message.RecipientType.TO,
! InternetAddress.parse(endpoint, false));
// -- We could include CC recipients too --
***************
*** 63,75 ****
// -- Set the subject and body text --
! msg.setSubject("You have received a New Named Object: "+obj.getName());
! BodyPart body=new MimeBodyPart();
body.setText("This message contains a signed named object. Please see http://neuclear.org for more info.");
! Multipart multi=new MimeMultipart();
multi.addBodyPart(body);
! BodyPart objpart=new MimeBodyPart();
objpart.setText(obj.asXML());
! objpart.setHeader("Content-type","application/nsdl");
multi.addBodyPart(objpart);
msg.setContent(multi);
--- 66,78 ----
// -- Set the subject and body text --
! msg.setSubject("You have received a New Named Object: " + obj.getName());
! BodyPart body = new MimeBodyPart();
body.setText("This message contains a signed named object. Please see http://neuclear.org for more info.");
! Multipart multi = new MimeMultipart();
multi.addBodyPart(body);
! BodyPart objpart = new MimeBodyPart();
objpart.setText(obj.asXML());
! objpart.setHeader("Content-type", "application/nsdl");
multi.addBodyPart(objpart);
msg.setContent(multi);
Index: SoapSender.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/senders/SoapSender.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** SoapSender.java 19 Sep 2003 14:41:29 -0000 1.1.1.1
--- SoapSender.java 22 Sep 2003 19:24:02 -0000 1.2
***************
*** 1,4 ****
package org.neuclear.senders;
! /**
* (C) 2003 Antilles Software Ventures SA
* User: pelleb
--- 1,5 ----
package org.neuclear.senders;
!
! /**
* (C) 2003 Antilles Software Ventures SA
* User: pelleb
***************
*** 7,10 ****
--- 8,14 ----
* $Id$
* $Log$
+ * 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:29 pelle
* First import into the neuclear project. This was originally under the SF neudist
***************
*** 26,36 ****
import org.neuclear.id.NamedObject;
! import org.neuclear.utils.NeudistException;
! import org.neuclear.xml.soap.SOAPTools;
public class SoapSender extends Sender {
public void send(String endpoint, NamedObject obj) throws NeudistException {
! SOAPTools.soapRequest(endpoint,obj.getElement(),"/receive");
}
}
--- 30,40 ----
import org.neuclear.id.NamedObject;
! import org.neudist.utils.NeudistException;
! import org.neudist.xml.soap.SOAPTools;
public class SoapSender extends Sender {
public void send(String endpoint, NamedObject obj) throws NeudistException {
! SOAPTools.soapRequest(endpoint, obj.getElement(), "/receive");
}
}
|
|
From: <pe...@us...> - 2003-09-22 19:24:13
|
Update of /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/signers
In directory sc8-pr-cvs1:/tmp/cvs-serv4908/src/test/org/neuclear/signers
Modified Files:
SimpleSignerStoreTest.java
Log Message:
More fixes throughout to problems caused by renaming.
Index: SimpleSignerStoreTest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/signers/SimpleSignerStoreTest.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** SimpleSignerStoreTest.java 19 Sep 2003 14:42:03 -0000 1.1.1.1
--- SimpleSignerStoreTest.java 22 Sep 2003 19:24:03 -0000 1.2
***************
*** 1,4 ****
--- 1,7 ----
/* $Id$
* $Log$
+ * Revision 1.2 2003/09/22 19:24:03 pelle
+ * More fixes throughout to problems caused by renaming.
+ *
* Revision 1.1.1.1 2003/09/19 14:42:03 pelle
* First import into the neuclear project. This was originally under the SF neudist
***************
*** 51,56 ****
import junit.framework.TestCase;
! import org.neuclear.utils.NeudistException;
! import org.neuclear.crypto.signerstores.SimpleSignerStore;
import java.io.File;
--- 54,59 ----
import junit.framework.TestCase;
! import org.neudist.crypto.signerstores.SimpleSignerStore;
! import org.neudist.utils.NeudistException;
import java.io.File;
***************
*** 63,129 ****
* @version $Revision$
**/
! public class SimpleSignerStoreTest extends TestCase {
! public SimpleSignerStoreTest(String name) throws GeneralSecurityException,NeudistException {
! super(name);
setUp();
}
/**
*/
! public static SimpleSignerStore getSignerStoreInstance() throws NeudistException, GeneralSecurityException{
return new SimpleSignerStore(new File("target/tests/keystores"));
}
! protected void setUp() throws NeudistException,GeneralSecurityException{
! store=getSignerStoreInstance();
generateKeys();
}
protected static synchronized void generateKeys() throws GeneralSecurityException {
! if (kg==null) {
System.out.println("Generating Test Keys");
! kg=KeyPairGenerator.getInstance("RSA");
! kg.initialize(1048,new SecureRandom("Bear it all with NeuDist".getBytes()));
! // kp=kg.generateKeyPair();
! root=kg.generateKeyPair();
! bob=kg.generateKeyPair();
}
}
protected void tearDown() {
! store=null;
}
! public void testAddKey() throws NeudistException,GeneralSecurityException,IOException {
! boolean success=false;
! try {
! store.addKey("root","root".toCharArray(),root.getPrivate());
! success=true;
! } catch (GeneralSecurityException e) {
e.printStackTrace();
! } catch (IOException e) {
! e.printStackTrace();
! }
! assertTrue("Managed to add a key",success);
! }
! public void testGetKey() throws NeudistException,GeneralSecurityException,IOException {
! boolean success=false;
! PrivateKey key=null;
! try {
! store.addKey("bob","bob".toCharArray(),bob.getPrivate());
! key=store.getKey("bob","bob".toCharArray());
! success=true;
! } catch (GeneralSecurityException e) {
e.printStackTrace();
! } catch (IOException e) {
! e.printStackTrace();
! }
! assertTrue("Managed to add and Fetch a key",success);
! assertNotNull("Key wasn't null",key);
! assertEquals("Gotten Key was the same as Stored Key",bob.getPrivate(),key);
! }
! public static void main (String[] args) {
try {
! SimpleSignerStoreTest test=new SimpleSignerStoreTest("SimpleSignerStoreTest");
test.setUp();
test.testGetKey();
--- 66,136 ----
* @version $Revision$
**/
! public class SimpleSignerStoreTest extends TestCase {
! public SimpleSignerStoreTest(String name) throws GeneralSecurityException, NeudistException {
! super(name);
setUp();
}
+
/**
*/
! public static SimpleSignerStore getSignerStoreInstance() throws NeudistException, GeneralSecurityException {
return new SimpleSignerStore(new File("target/tests/keystores"));
}
! protected void setUp() throws NeudistException, GeneralSecurityException {
! store = getSignerStoreInstance();
generateKeys();
}
+
protected static synchronized void generateKeys() throws GeneralSecurityException {
! if (kg == null) {
System.out.println("Generating Test Keys");
! kg = KeyPairGenerator.getInstance("RSA");
! kg.initialize(1048, new SecureRandom("Bear it all with NeuDist".getBytes()));
! // kp=kg.generateKeyPair();
! root = kg.generateKeyPair();
! bob = kg.generateKeyPair();
}
}
protected void tearDown() {
! store = null;
! }
!
! public void testAddKey() throws NeudistException, GeneralSecurityException, IOException {
! boolean success = false;
! try {
! store.addKey("root", "root".toCharArray(), root.getPrivate());
! success = true;
! } catch (GeneralSecurityException e) {
! e.printStackTrace();
! } catch (IOException e) {
! e.printStackTrace();
}
+ assertTrue("Managed to add a key", success);
+ }
! public void testGetKey() throws NeudistException, GeneralSecurityException, IOException {
! boolean success = false;
! PrivateKey key = null;
! try {
! store.addKey("bob", "bob".toCharArray(), bob.getPrivate());
! key = store.getKey("bob", "bob".toCharArray());
! success = true;
! } catch (GeneralSecurityException e) {
e.printStackTrace();
! } catch (IOException e) {
e.printStackTrace();
! }
! assertTrue("Managed to add and Fetch a key", success);
! assertNotNull("Key wasn't null", key);
! assertEquals("Gotten Key was the same as Stored Key", bob.getPrivate(), key);
! }
!
! public static void main(String[] args) {
try {
! SimpleSignerStoreTest test = new SimpleSignerStoreTest("SimpleSignerStoreTest");
test.setUp();
test.testGetKey();
***************
*** 132,141 ****
// ((NeudistException)e).getParcel().printStackTrace();
// } else
! e.printStackTrace();
}
// junit.textui.TestRunner.run (suite());
! }
private SimpleSignerStore store;
--- 139,148 ----
// ((NeudistException)e).getParcel().printStackTrace();
// } else
! e.printStackTrace();
}
// junit.textui.TestRunner.run (suite());
! }
private SimpleSignerStore store;
|
|
From: <pe...@us...> - 2003-09-22 19:24:13
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/time
In directory sc8-pr-cvs1:/tmp/cvs-serv4908/src/java/org/neuclear/time
Modified Files:
TimeTools.java
Log Message:
More fixes throughout to problems caused by renaming.
Index: TimeTools.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/time/TimeTools.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** TimeTools.java 19 Sep 2003 14:41:15 -0000 1.1.1.1
--- TimeTools.java 22 Sep 2003 19:24:02 -0000 1.2
***************
*** 2,5 ****
--- 2,8 ----
* $Id$
* $Log$
+ * 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:15 pelle
* First import into the neuclear project. This was originally under the SF neudist
***************
*** 30,34 ****
*/
package org.neuclear.time;
! import org.neuclear.utils.NeudistException;
import java.sql.Timestamp;
--- 33,38 ----
*/
package org.neuclear.time;
!
! import org.neudist.utils.NeudistException;
import java.sql.Timestamp;
***************
*** 48,53 ****
! public static java.util.Date addDaysToDate(java.util.Date d, int iDays)
! {
//create Calendar
Calendar cal = Calendar.getInstance();
--- 52,56 ----
! public static java.util.Date addDaysToDate(java.util.Date d, int iDays) {
//create Calendar
Calendar cal = Calendar.getInstance();
***************
*** 61,66 ****
}
! public static java.util.Date addMonthsToDate(java.util.Date d, int iMonths)
! {
//create Calendar
Calendar cal = Calendar.getInstance();
--- 64,68 ----
}
! public static java.util.Date addMonthsToDate(java.util.Date d, int iMonths) {
//create Calendar
Calendar cal = Calendar.getInstance();
***************
*** 80,88 ****
public static Timestamp convertDateToTimestamp(Date date) {
if (date instanceof Timestamp)
! return (Timestamp)date;
return new Timestamp(date.getTime());
}
! public static Timestamp parseTimeStamp(String ts) throws NeudistException{
try {
return convertDateToTimestamp(getDateFormatter().parse(ts));
--- 82,90 ----
public static Timestamp convertDateToTimestamp(Date date) {
if (date instanceof Timestamp)
! return (Timestamp) date;
return new Timestamp(date.getTime());
}
! public static Timestamp parseTimeStamp(String ts) throws NeudistException {
try {
return convertDateToTimestamp(getDateFormatter().parse(ts));
***************
*** 106,110 ****
*/
private static final String ISO_EXPANDED_DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss,SSSzzz";
! private static final SimpleDateFormat DF=new SimpleDateFormat(ISO_EXPANDED_DATE_TIME_FORMAT);
{
DF.setTimeZone(TimeZone.getTimeZone("GMT"));
--- 108,113 ----
*/
private static final String ISO_EXPANDED_DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss,SSSzzz";
! private static final SimpleDateFormat DF = new SimpleDateFormat(ISO_EXPANDED_DATE_TIME_FORMAT);
!
{
DF.setTimeZone(TimeZone.getTimeZone("GMT"));
|
|
From: <pe...@us...> - 2003-09-22 19:24:13
|
Update of /cvsroot/neuclear/neuclear-id/src/webapp
In directory sc8-pr-cvs1:/tmp/cvs-serv4908/src/webapp
Modified Files:
index.jsp login.jsp
Log Message:
More fixes throughout to problems caused by renaming.
Index: index.jsp
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/webapp/index.jsp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** index.jsp 19 Sep 2003 14:42:59 -0000 1.1.1.1
--- index.jsp 22 Sep 2003 19:24:03 -0000 1.2
***************
*** 1,3 ****
! <%@ page import="org.neuclear.utils.Utility,
com.opensymphony.util.TextUtils,
org.neuclear.receiver.ReceiverServlet,
--- 1,3 ----
! <%@ page import="org.neudist.utils.Utility,
com.opensymphony.util.TextUtils,
org.neuclear.receiver.ReceiverServlet,
***************
*** 5,9 ****
org.neuclear.contracts.nsauth.AuthenticationTicket,
org.neuclear.id.NSTools,
! org.neuclear.utils.ServletTools,
org.neuclear.id.NamedObjectFactory"%>
<%
--- 5,9 ----
org.neuclear.contracts.nsauth.AuthenticationTicket,
org.neuclear.id.NSTools,
! org.neudist.utils.ServletTools,
org.neuclear.id.NamedObjectFactory"%>
<%
Index: login.jsp
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/webapp/login.jsp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** login.jsp 19 Sep 2003 14:42:57 -0000 1.1.1.1
--- login.jsp 22 Sep 2003 19:24:03 -0000 1.2
***************
*** 1,12 ****
! <%@page import="org.neuclear.utils.Utility,
com.opensymphony.util.TextUtils,
org.neuclear.contracts.nsauth.AuthenticationTicket,
java.util.Date,
! org.neuclear.xml.xmlsec.XMLSecTools,
org.neuclear.id.targets.TargetReference,
! org.neuclear.utils.ServletTools,
org.neuclear.id.NameSpace,
org.neuclear.id.NamedObjectFactory,
! org.neuclear.utils.NeudistException,
org.neuclear.id.signrequest.SignatureRequest"%>
<%
--- 1,12 ----
! <%@page import="org.neudist.utils.Utility,
com.opensymphony.util.TextUtils,
org.neuclear.contracts.nsauth.AuthenticationTicket,
java.util.Date,
! org.neudist.xml.xmlsec.XMLSecTools,
org.neuclear.id.targets.TargetReference,
! org.neudist.utils.ServletTools,
org.neuclear.id.NameSpace,
org.neuclear.id.NamedObjectFactory,
! org.neudist.utils.NeudistException,
org.neuclear.id.signrequest.SignatureRequest"%>
<%
|
|
From: <pe...@us...> - 2003-09-22 19:24:13
|
Update of /cvsroot/neuclear/neuclear-id
In directory sc8-pr-cvs1:/tmp/cvs-serv4908
Modified Files:
project.xml
Log Message:
More fixes throughout to problems caused by renaming.
Index: project.xml
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/project.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** project.xml 19 Sep 2003 14:54:43 -0000 1.2
--- project.xml 22 Sep 2003 19:24:03 -0000 1.3
***************
*** 4,8 ****
<name>NeuClear Identity Framework</name>
<id>neuclear-id</id>
! <currentVersion>0.7</currentVersion>
<inceptionYear>2002</inceptionYear>
<package>org.neuclear.id</package>
--- 4,8 ----
<name>NeuClear Identity Framework</name>
<id>neuclear-id</id>
! <currentVersion>0.7-SNAPSHOT</currentVersion>
<inceptionYear>2002</inceptionYear>
<package>org.neuclear.id</package>
***************
*** 64,68 ****
<id>neudist-xmlsig</id>
<name>neudist-xmlsig</name>
! <version>0.8</version>
<properties>
<war.bundle.jar>true</war.bundle.jar>
--- 64,68 ----
<id>neudist-xmlsig</id>
<name>neudist-xmlsig</name>
! <version>0.9-SNAPSHOT</version>
<properties>
<war.bundle.jar>true</war.bundle.jar>
***************
*** 124,128 ****
</properties>
</dependency>
! <dependency>
<id>javamail</id>
<version>1.3</version>
--- 124,128 ----
</properties>
</dependency>
! <!-- <dependency>
<id>javamail</id>
<version>1.3</version>
***************
*** 135,139 ****
<jar>activation.jar</jar>
<url>http://java.sun.com/products/javabeans/glasgow/jaf.html</url>
! </dependency>
</dependencies>
<build>
--- 135,139 ----
<jar>activation.jar</jar>
<url>http://java.sun.com/products/javabeans/glasgow/jaf.html</url>
! </dependency>-->
</dependencies>
<build>
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id
In directory sc8-pr-cvs1:/tmp/cvs-serv4908/src/java/org/neuclear/id
Modified Files:
GenericNamedObject.java InvalidNameSpaceException.java
NSTools.java NameSpace.java NamedObject.java
NamedObjectFactory.java
Log Message:
More fixes throughout to problems caused by renaming.
Index: GenericNamedObject.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/GenericNamedObject.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** GenericNamedObject.java 19 Sep 2003 14:41:03 -0000 1.1.1.1
--- GenericNamedObject.java 22 Sep 2003 19:24:01 -0000 1.2
***************
*** 2,5 ****
--- 2,8 ----
* $Id$
* $Log$
+ * Revision 1.2 2003/09/22 19:24:01 pelle
+ * More fixes throughout to problems caused by renaming.
+ *
* Revision 1.1.1.1 2003/09/19 14:41:03 pelle
* First import into the neuclear project. This was originally under the SF neudist
***************
*** 28,32 ****
import org.dom4j.Element;
import org.dom4j.Namespace;
! import org.neuclear.utils.NeudistException;
public class GenericNamedObject extends NamedObject {
--- 31,35 ----
import org.dom4j.Element;
import org.dom4j.Namespace;
! import org.neudist.utils.NeudistException;
public class GenericNamedObject extends NamedObject {
***************
*** 36,40 ****
public Namespace getNS() {
! return getElement().getQName().getNamespace();
}
--- 39,43 ----
public Namespace getNS() {
! return getElement().getQName().getNamespace();
}
Index: InvalidNameSpaceException.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/InvalidNameSpaceException.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** InvalidNameSpaceException.java 19 Sep 2003 14:40:55 -0000 1.1.1.1
--- InvalidNameSpaceException.java 22 Sep 2003 19:24:01 -0000 1.2
***************
*** 2,5 ****
--- 2,8 ----
* $Id$
* $Log$
+ * Revision 1.2 2003/09/22 19:24:01 pelle
+ * More fixes throughout to problems caused by renaming.
+ *
* Revision 1.1.1.1 2003/09/19 14:40:55 pelle
* First import into the neuclear project. This was originally under the SF neudist
***************
*** 56,60 ****
package org.neuclear.id;
! import org.neuclear.utils.NeudistException;
public class InvalidNameSpaceException extends NeudistException {
--- 59,63 ----
package org.neuclear.id;
! import org.neudist.utils.NeudistException;
public class InvalidNameSpaceException extends NeudistException {
Index: NSTools.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/NSTools.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** NSTools.java 19 Sep 2003 14:40:58 -0000 1.1.1.1
--- NSTools.java 22 Sep 2003 19:24:01 -0000 1.2
***************
*** 2,5 ****
--- 2,8 ----
* $Id$
* $Log$
+ * Revision 1.2 2003/09/22 19:24:01 pelle
+ * More fixes throughout to problems caused by renaming.
+ *
* Revision 1.1.1.1 2003/09/19 14:40:58 pelle
* First import into the neuclear project. This was originally under the SF neudist
***************
*** 85,96 ****
import org.apache.regexp.RE;
import org.apache.regexp.RESyntaxException;
! import org.neuclear.crypto.CryptoTools;
! import org.neuclear.utils.NeudistException;
! import org.neuclear.utils.Utility;
import java.util.Random;
public final class NSTools {
! private NSTools(){};
/**
--- 88,100 ----
import org.apache.regexp.RE;
import org.apache.regexp.RESyntaxException;
! import org.neudist.crypto.CryptoTools;
! import org.neudist.utils.NeudistException;
! import org.neudist.utils.Utility;
import java.util.Random;
public final class NSTools {
! private NSTools() {
! };
/**
***************
*** 100,110 ****
* @throws NeudistException If name isn't a valid NEU Name
*/
! public static String normalizeNameURI(String name) throws NeudistException{
! if (!isValidName(name))
! throw new NeudistException("Name: '"+name+"' is not valid");
! if (!name.startsWith("neu://"))
! return "neu:/"+name;
! return name;
}
/**
* Name must follow the follwing rules:<br>
--- 104,115 ----
* @throws NeudistException If name isn't a valid NEU Name
*/
! public static String normalizeNameURI(String name) throws NeudistException {
! if (!isValidName(name))
! throw new NeudistException("Name: '" + name + "' is not valid");
! if (!name.startsWith("neu://"))
! return "neu:/" + name;
! return name;
}
+
/**
* Name must follow the follwing rules:<br>
***************
*** 120,125 ****
if (Utility.isEmpty(name))
return false;
! RE re=new RE("^(neu:\\/)?((\\/)|(\\/[a-zA-Z0-9_\\-\\.]+)*)$");
! return(re.match(name));
} catch (RESyntaxException e) {
e.printStackTrace();
--- 125,130 ----
if (Utility.isEmpty(name))
return false;
! RE re = new RE("^(neu:\\/)?((\\/)|(\\/[a-zA-Z0-9_\\-\\.]+)*)$");
! return (re.match(name));
} catch (RESyntaxException e) {
e.printStackTrace();
***************
*** 136,164 ****
*/
public static String getParentNSURI(String name) throws NeudistException {
! String uri=normalizeNameURI(name);
! int slash=uri.lastIndexOf('/');
! 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(String nameSpace,String reqNameSpace) {
// Yeah, yeah there are better ways to do this
! String ms=new Long(System.currentTimeMillis()+new Random().nextLong()).toString(); //TODO seed the Random number generator
! 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());
! 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)'.';
}
/*
--- 141,169 ----
*/
public static String getParentNSURI(String name) throws NeudistException {
! String uri = normalizeNameURI(name);
! int slash = uri.lastIndexOf('/');
! 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(String nameSpace, String reqNameSpace) {
// Yeah, yeah there are better ways to do this
! String ms = new Long(System.currentTimeMillis() + new Random().nextLong()).toString(); //TODO seed the Random number generator
! 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());
! 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) '.';
}
/*
***************
*** 168,196 ****
System.arraycopy(ticket,0,ticketName,userNameSpace.length()+1,ticket.length);
*/
! return nameSpace+'/'+new String(ticketsrc,offset,ticketsrc.length-offset)+'.'+ticket;
}
public static String url2path(String name) {
! if (!Utility.isEmpty(name)){
! 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 "/";
}
! public static void main(String args[]){
try {
! NamedObject obj=NamedObjectFactory.fetchNamedObject("neu://free/pelle");
! System.out.println("Got: "+obj.getName());
! obj=NamedObjectFactory.fetchNamedObject("neu://pelle");
! System.out.println("Got: "+obj.getName());
! obj=NamedObjectFactory.fetchNamedObject("neu://free");
! System.out.println("Got: "+obj.getName());
! obj=NamedObjectFactory.fetchNamedObject("neu://free/pelle");
! System.out.println("Got: "+obj.getName());
// obj=NamedObjectFactory.fetchNamedObject("neu://free/trix");
// System.out.println("Got: "+obj.getName());
--- 173,202 ----
System.arraycopy(ticket,0,ticketName,userNameSpace.length()+1,ticket.length);
*/
! return nameSpace + '/' + new String(ticketsrc, offset, ticketsrc.length - offset) + '.' + ticket;
}
public static String url2path(String name) {
! if (!Utility.isEmpty(name)) {
! 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 "/";
}
!
! public static void main(String args[]) {
try {
! NamedObject obj = NamedObjectFactory.fetchNamedObject("neu://free/pelle");
! System.out.println("Got: " + obj.getName());
! obj = NamedObjectFactory.fetchNamedObject("neu://pelle");
! System.out.println("Got: " + obj.getName());
! obj = NamedObjectFactory.fetchNamedObject("neu://free");
! System.out.println("Got: " + obj.getName());
! obj = NamedObjectFactory.fetchNamedObject("neu://free/pelle");
! System.out.println("Got: " + obj.getName());
// obj=NamedObjectFactory.fetchNamedObject("neu://free/trix");
// System.out.println("Got: "+obj.getName());
Index: NameSpace.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/NameSpace.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** NameSpace.java 19 Sep 2003 14:41:08 -0000 1.1.1.1
--- NameSpace.java 22 Sep 2003 19:24:01 -0000 1.2
***************
*** 2,5 ****
--- 2,8 ----
* $Id$
* $Log$
+ * Revision 1.2 2003/09/22 19:24:01 pelle
+ * More fixes throughout to problems caused by renaming.
+ *
* Revision 1.1.1.1 2003/09/19 14:41:08 pelle
* First import into the neuclear project. This was originally under the SF neudist
***************
*** 142,149 ****
import org.neuclear.senders.LogSender;
import org.neuclear.senders.Sender;
! import org.neuclear.utils.NeudistException;
! import org.neuclear.utils.Utility;
! import org.neuclear.xml.xmlsec.KeyInfo;
! import org.neuclear.xml.xmlsec.XMLSecTools;
import java.security.PublicKey;
--- 145,152 ----
import org.neuclear.senders.LogSender;
import org.neuclear.senders.Sender;
! import org.neudist.utils.NeudistException;
! import org.neudist.utils.Utility;
! import org.neudist.xml.xmlsec.KeyInfo;
! import org.neudist.xml.xmlsec.XMLSecTools;
import java.security.PublicKey;
***************
*** 151,200 ****
import java.util.List;
! public final class NameSpace extends NamedObject {
! /**
! * This constructor should be used by subclasses of NameSpace. It creates a Standard NameSpace document, but doesn't sign it.
! * The signing should be done as the last step of the constructor of the subclass.
! * @param name The Name of NameSpace
! * @param allow PublicKey allowed to sign in here
! * @param repository URL of Default Store for NameSpace. (Note. A NameSpace object is stored in the default repository of it's parent namespace)
! * @param signer URL of default interactive signing service for namespace. If null it doesnt allow interactive signing
! * @param receiver URL of default receiver for namespace
! * @throws NeudistException
! */
! public NameSpace(String name,PublicKey allow,String repository,String signer,String logger,String receiver) throws NeudistException {
! super(name,"NameSpace");
! Element root=getElement();
! // We have meaningful defaults for the following two
! this.repository=Utility.denullString(repository,NSResolver.NSROOTSTORE);
! this.logger=Utility.denullString(repository,LogSender.LOGGER);
! this.signer=signer;
! this.receiver=receiver;
! root.addAttribute(DocumentHelper.createQName("repository",NamedObject.NS_NSDL),this.repository);
! root.addAttribute(DocumentHelper.createQName("logger",NamedObject.NS_NSDL),receiver);
! if (!Utility.isEmpty(signer))
! root.addAttribute(DocumentHelper.createQName("signer",NamedObject.NS_NSDL),signer);
! if (!Utility.isEmpty(receiver))
! root.addAttribute(DocumentHelper.createQName("receiver",NamedObject.NS_NSDL),receiver);
! if (allow!=null) {
! QName allowName=DocumentHelper.createQName("allow",NamedObject.NS_NSDL);
! Element pub=root.addElement(allowName);
! pubs=new PublicKey[1];
! pubs[0]=allow;
! pub.add(XMLSecTools.createKeyInfo(allow));
! }
}
! public NameSpace(String name,PublicKey allow,String repository) throws NeudistException {
! this(name,allow,repository,null,null,null);
}
- public NameSpace(String name,PublicKey allow) throws NeudistException {
- this(name,allow,null);
- }
/**
--- 154,204 ----
import java.util.List;
! public final class NameSpace extends NamedObject {
! /**
! * This constructor should be used by subclasses of NameSpace. It creates a Standard NameSpace document, but doesn't sign it.
! * The signing should be done as the last step of the constructor of the subclass.
! * @param name The Name of NameSpace
! * @param allow PublicKey allowed to sign in here
! * @param repository URL of Default Store for NameSpace. (Note. A NameSpace object is stored in the default repository of it's parent namespace)
! * @param signer URL of default interactive signing service for namespace. If null it doesnt allow interactive signing
! * @param receiver URL of default receiver for namespace
! * @throws NeudistException
! */
! public NameSpace(String name, PublicKey allow, String repository, String signer, String logger, String receiver) throws NeudistException {
! super(name, "NameSpace");
! Element root = getElement();
! // We have meaningful defaults for the following two
! this.repository = Utility.denullString(repository, NSResolver.NSROOTSTORE);
! this.logger = Utility.denullString(repository, LogSender.LOGGER);
! this.signer = signer;
! this.receiver = receiver;
! root.addAttribute(DocumentHelper.createQName("repository", NamedObject.NS_NSDL), this.repository);
! root.addAttribute(DocumentHelper.createQName("logger", NamedObject.NS_NSDL), receiver);
! if (!Utility.isEmpty(signer))
! root.addAttribute(DocumentHelper.createQName("signer", NamedObject.NS_NSDL), signer);
! if (!Utility.isEmpty(receiver))
! root.addAttribute(DocumentHelper.createQName("receiver", NamedObject.NS_NSDL), receiver);
! if (allow != null) {
! QName allowName = DocumentHelper.createQName("allow", NamedObject.NS_NSDL);
! Element pub = root.addElement(allowName);
! pubs = new PublicKey[1];
! pubs[0] = allow;
! pub.add(XMLSecTools.createKeyInfo(allow));
}
+ }
! public NameSpace(String name, PublicKey allow, String repository) throws NeudistException {
! this(name, allow, repository, null, null, null);
! }
!
! public NameSpace(String name, PublicKey allow) throws NeudistException {
! this(name, allow, null);
}
/**
***************
*** 214,230 ****
super(nsElem);
try {
! Element ns =getElement();
! repository=ns.attributeValue(DocumentHelper.createQName("store",NamedObject.NS_NSDL));
! signer=ns.attributeValue(DocumentHelper.createQName("signer",NamedObject.NS_NSDL));
! logger=ns.attributeValue(DocumentHelper.createQName("logger",NamedObject.NS_NSDL));
! receiver=ns.attributeValue(DocumentHelper.createQName("receiver",NamedObject.NS_NSDL));
! Element allowElement=ns.element(DocumentHelper.createQName("allow",NamedObject.NS_NSDL));
! List keys=allowElement.elements(XMLSecTools.createQName("KeyInfo"));
! pubs=new PublicKey[keys.size()];
! int i=0;
! for (Iterator iter=keys.iterator();iter.hasNext();i++) {
! KeyInfo ki=new KeyInfo((Element)iter.next());
! pubs[i]=ki.getPublicKey();
}
} catch (Exception e) {
--- 218,234 ----
super(nsElem);
try {
! Element ns = getElement();
! repository = ns.attributeValue(DocumentHelper.createQName("store", NamedObject.NS_NSDL));
! signer = ns.attributeValue(DocumentHelper.createQName("signer", NamedObject.NS_NSDL));
! logger = ns.attributeValue(DocumentHelper.createQName("logger", NamedObject.NS_NSDL));
! receiver = ns.attributeValue(DocumentHelper.createQName("receiver", NamedObject.NS_NSDL));
! Element allowElement = ns.element(DocumentHelper.createQName("allow", NamedObject.NS_NSDL));
! List keys = allowElement.elements(XMLSecTools.createQName("KeyInfo"));
! pubs = new PublicKey[keys.size()];
! int i = 0;
! for (Iterator iter = keys.iterator(); iter.hasNext(); i++) {
! KeyInfo ki = new KeyInfo((Element) iter.next());
! pubs[i] = ki.getPublicKey();
}
} catch (Exception e) {
***************
*** 238,247 ****
*/
public PublicKey getAllowed() {
! if (pubs!=null&&pubs.length>0)
return pubs[0];
else
return null;
}
! public boolean postAllowed(NamedObject obj) throws NeudistException{
try {
for (int i = 0; i < pubs.length; i++) {
--- 242,252 ----
*/
public PublicKey getAllowed() {
! if (pubs != null && pubs.length > 0)
return pubs[0];
else
return null;
}
!
! public boolean postAllowed(NamedObject obj) throws NeudistException {
try {
for (int i = 0; i < pubs.length; i++) {
***************
*** 269,284 ****
public final void send(NamedObject obj) throws NeudistException {
if (!Utility.isEmpty(receiver))
! Sender.quickSend(receiver,obj);
else
! throw new NeudistException("Cant send object, "+getName()+" doesnt have a registered Receiver");
}
void log(NamedObject obj) throws NeudistException {
if (!Utility.isEmpty(logger))
! Sender.quickSend(logger,obj);
}
public String getTagName() {
return "NameSpace";
}
private String repository;
private String signer;
--- 274,291 ----
public final void send(NamedObject obj) throws NeudistException {
if (!Utility.isEmpty(receiver))
! Sender.quickSend(receiver, obj);
else
! throw new NeudistException("Cant send object, " + getName() + " doesnt have a registered Receiver");
}
void log(NamedObject obj) throws NeudistException {
if (!Utility.isEmpty(logger))
! Sender.quickSend(logger, obj);
}
+
public String getTagName() {
return "NameSpace";
}
+
private String repository;
private String signer;
Index: NamedObject.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/NamedObject.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** NamedObject.java 19 Sep 2003 14:41:03 -0000 1.1.1.1
--- NamedObject.java 22 Sep 2003 19:24:01 -0000 1.2
***************
*** 2,5 ****
--- 2,8 ----
* $Id$
* $Log$
+ * Revision 1.2 2003/09/22 19:24:01 pelle
+ * More fixes throughout to problems caused by renaming.
+ *
* Revision 1.1.1.1 2003/09/19 14:41:03 pelle
* First import into the neuclear project. This was originally under the SF neudist
***************
*** 129,139 ****
import org.neuclear.id.targets.TargetReference;
import org.neuclear.time.TimeTools;
! import org.neuclear.utils.NeudistException;
! import org.neuclear.utils.Utility;
! import org.neuclear.xml.AbstractElementProxy;
! import org.neuclear.xml.XMLException;
! import org.neuclear.xml.xmlsec.SignedElement;
! import org.neuclear.xml.xmlsec.XMLSecTools;
! import org.neuclear.xml.xmlsec.XMLSecurityException;
import java.sql.Timestamp;
--- 132,142 ----
import org.neuclear.id.targets.TargetReference;
import org.neuclear.time.TimeTools;
! import org.neudist.utils.NeudistException;
! import org.neudist.utils.Utility;
! import org.neudist.xml.AbstractElementProxy;
! import org.neudist.xml.XMLException;
! import org.neudist.xml.xmlsec.SignedElement;
! import org.neudist.xml.xmlsec.XMLSecTools;
! import org.neudist.xml.xmlsec.XMLSecurityException;
import java.sql.Timestamp;
***************
*** 141,149 ****
import java.util.LinkedList;
import java.util.List;
/**
* This simple wrapper takes most of the contents of a NamedObject and puts it into a Serializable form that can be signed.
*/
public abstract class NamedObject extends SignedElement {
! protected NamedObject(String name,String tagName, String prefix, String nsURI) {
super(tagName, prefix, nsURI);
createDocument();
--- 144,153 ----
import java.util.LinkedList;
import java.util.List;
+
/**
* This simple wrapper takes most of the contents of a NamedObject and puts it into a Serializable form that can be signed.
*/
public abstract class NamedObject extends SignedElement {
! protected NamedObject(String name, String tagName, String prefix, String nsURI) {
super(tagName, prefix, nsURI);
createDocument();
***************
*** 151,166 ****
}
! protected NamedObject(String name,String tagName, Namespace ns) {
super(tagName, ns);
createDocument();
setName(name);
}
! protected NamedObject(String name,String tagName) {
! super(tagName,NamedObject.NS_NSDL);
createDocument();
setName(name);
}
! protected NamedObject(String name,QName qname) {
super(qname);
createDocument();
--- 155,171 ----
}
! protected NamedObject(String name, String tagName, Namespace ns) {
super(tagName, ns);
createDocument();
setName(name);
}
!
! protected NamedObject(String name, String tagName) {
! super(tagName, NamedObject.NS_NSDL);
createDocument();
setName(name);
}
! protected NamedObject(String name, QName qname) {
super(qname);
createDocument();
***************
*** 171,178 ****
super(elem);
createDocument();
! String name=getName();
processTargetElements();
if (Utility.isEmpty(name))
! throw new NeudistException("Element: "+elem.getQualifiedName()+" doesnt contain a valid name attribute");
}
--- 176,183 ----
super(elem);
createDocument();
! String name = getName();
processTargetElements();
if (Utility.isEmpty(name))
! throw new NeudistException("Element: " + elem.getQualifiedName() + " doesnt contain a valid name attribute");
}
***************
*** 181,185 ****
* @return String containing the fully qualified URI of an object
*/
! public String getName() throws NeudistException{
return NSTools.normalizeNameURI(getElement().attributeValue(getNameAttrQName()));
}
--- 186,190 ----
* @return String containing the fully qualified URI of an object
*/
! public String getName() throws NeudistException {
return NSTools.normalizeNameURI(getElement().attributeValue(getNameAttrQName()));
}
***************
*** 189,212 ****
* @return Parent Name
*/
! public String getLocalName() throws NeudistException{
! String fullName=getName();
! int i=fullName.lastIndexOf('/');
! return fullName.substring(i+1);
}
private void setName(String name) {
! getElement().addAttribute(getNameAttrQName(),name);
}
private static QName getNameAttrQName() {
! return DocumentHelper.createQName("name",NamedObject.NS_NSDL);
}
private void createDocument() {
! Element elem=getElement();
! if(elem.getDocument()==null) {
! Document doc=DocumentHelper.createDocument(elem);
}
}
/**
* @return the URI of the object. In this case the same as getName();
--- 194,219 ----
* @return Parent Name
*/
! public String getLocalName() throws NeudistException {
! String fullName = getName();
! int i = fullName.lastIndexOf('/');
! return fullName.substring(i + 1);
}
private void setName(String name) {
! getElement().addAttribute(getNameAttrQName(), name);
}
private static QName getNameAttrQName() {
! return DocumentHelper.createQName("name", NamedObject.NS_NSDL);
}
+
private void createDocument() {
! Element elem = getElement();
! if (elem.getDocument() == null) {
! Document doc = DocumentHelper.createDocument(elem);
}
}
+
/**
* @return the URI of the object. In this case the same as getName();
***************
*** 245,255 ****
super.addElement(child);
}
protected void addElement(NamedObject child) throws XMLException {
! addElement((AbstractElementProxy)child);
}
protected void isModifiable() throws NeudistException {
if (isSigned())
! throw new NeudistException("NamedObject: "+getName()+" is signed and cant be modified");
}
--- 252,263 ----
super.addElement(child);
}
+
protected void addElement(NamedObject child) throws XMLException {
! addElement((AbstractElementProxy) child);
}
protected void isModifiable() throws NeudistException {
if (isSigned())
! throw new NeudistException("NamedObject: " + getName() + " is signed and cant be modified");
}
***************
*** 257,264 ****
* Sign NamedObject using given PrivateKey. This also adds a timestamp to the root element prior to signing
*/
! protected final void preSign() throws XMLSecurityException{
// We need to timestamp it before we sign it
! getElement().addAttribute(DocumentHelper.createQName("timestamp",NamedObject.NS_NSDL),TimeTools.createTimeStamp());
! }
/**
--- 265,272 ----
* Sign NamedObject using given PrivateKey. This also adds a timestamp to the root element prior to signing
*/
! protected final void preSign() throws XMLSecurityException {
// We need to timestamp it before we sign it
! getElement().addAttribute(DocumentHelper.createQName("timestamp", NamedObject.NS_NSDL), TimeTools.createTimeStamp());
! }
/**
***************
*** 281,319 ****
public void addTarget(TargetReference target) throws NeudistException {
isModifiable();
! if (target==null)
return;
! QName targetsQN=DocumentHelper.createQName("Targets",NamedObject.NS_NSDL);
! Element targetsElem=getElement().element(targetsQN);
! if (targetsElem==null){
! targetsElem=DocumentHelper.createElement(targetsQN);
getElement().add(targetsElem);
}
! targetsElem.add(target.getElement());
! targetList().add(target);
}
/**
! */
! private void processTargetElements() throws NeudistException {
! //System.out.println("NEUDIST: registering targets for "+getName());
! QName targetsQN=DocumentHelper.createQName("Targets",NamedObject.NS_NSDL);
! Element targetsElem=getElement().element(targetsQN);
! if (targetsElem!=null){
! Iterator iter=targetsElem.elementIterator(DocumentHelper.createQName("TargetReference",NamedObject.NS_NSDL));
! while (iter.hasNext()) {
! Element o = (Element) iter.next();
! TargetReference target=new TargetReference(this,o);
! System.out.println("NEUDIST: Registring target: "+target.getHref());
! targetList().add(target);
! }
! }
! }
private synchronized List targetList() {
! if (targets==null)
! targets=new LinkedList();
return targets;
}
/**
* Lists the targets within an object
--- 289,329 ----
public void addTarget(TargetReference target) throws NeudistException {
isModifiable();
! if (target == null)
return;
! QName targetsQN = DocumentHelper.createQName("Targets", NamedObject.NS_NSDL);
! Element targetsElem = getElement().element(targetsQN);
! if (targetsElem == null) {
! targetsElem = DocumentHelper.createElement(targetsQN);
getElement().add(targetsElem);
}
! targetsElem.add(target.getElement());
! targetList().add(target);
}
+
/**
! */
! private void processTargetElements() throws NeudistException {
! //System.out.println("NEUDIST: registering targets for "+getName());
! QName targetsQN = DocumentHelper.createQName("Targets", NamedObject.NS_NSDL);
! Element targetsElem = getElement().element(targetsQN);
! if (targetsElem != null) {
! Iterator iter = targetsElem.elementIterator(DocumentHelper.createQName("TargetReference", NamedObject.NS_NSDL));
! while (iter.hasNext()) {
! Element o = (Element) iter.next();
! TargetReference target = new TargetReference(this, o);
! System.out.println("NEUDIST: Registring target: " + target.getHref());
! targetList().add(target);
! }
! }
! }
private synchronized List targetList() {
! if (targets == null)
! targets = new LinkedList();
return targets;
}
+
/**
* Lists the targets within an object
***************
*** 327,339 ****
* Sends copy of object to all targets within
*/
! public void sendObject() throws NeudistException{
! System.out.println("NEUDIST: Sending Object "+getName());
if (this.isSigned()) {
! Iterator iter=listTargets();
! while(iter.hasNext()) {
! TargetReference tg=((TargetReference)iter.next());
tg.send();
! System.out.println("NEUDIST: Sent to "+tg.getHref());
}
--- 337,349 ----
* Sends copy of object to all targets within
*/
! public void sendObject() throws NeudistException {
! System.out.println("NEUDIST: Sending Object " + getName());
if (this.isSigned()) {
! Iterator iter = listTargets();
! while (iter.hasNext()) {
! TargetReference tg = ((TargetReference) iter.next());
tg.send();
! System.out.println("NEUDIST: Sent to " + tg.getHref());
}
***************
*** 343,348 ****
public Timestamp getTimeStamp() throws NeudistException {
! String timeString=getElement().attributeValue(DocumentHelper.createQName("timestamp",NamedObject.NS_NSDL));
! if (isSigned()&&!Utility.isEmpty(timeString)){
try {
return TimeTools.parseTimeStamp(timeString);
--- 353,358 ----
public Timestamp getTimeStamp() throws NeudistException {
! String timeString = getElement().attributeValue(DocumentHelper.createQName("timestamp", NamedObject.NS_NSDL));
! if (isSigned() && !Utility.isEmpty(timeString)) {
try {
return TimeTools.parseTimeStamp(timeString);
***************
*** 356,359 ****
--- 366,370 ----
}
+
public final void log() throws NeudistException {
NameSpace ns = getParent();
***************
*** 362,366 ****
public NameSpace getParent() throws NeudistException {
! NameSpace ns=NSResolver.resolveNameSpace(NSTools.getParentNSURI(getName()));
return ns;
}
--- 373,377 ----
public NameSpace getParent() throws NeudistException {
! NameSpace ns = NSResolver.resolveNameSpace(NSTools.getParentNSURI(getName()));
return ns;
}
***************
*** 368,375 ****
private List targets;
! public static final String NSDL_NAMESPACE="http://neuclear.org/neu/nsdl";
! public static final Namespace NS_NSDL=DocumentHelper.createNamespace("nsdl",NamedObject.NSDL_NAMESPACE);
! public static final String NSDL_PREFIX="nsdl:";
}
--- 379,386 ----
private List targets;
! public static final String NSDL_NAMESPACE = "http://neuclear.org/neu/nsdl";
! public static final Namespace NS_NSDL = DocumentHelper.createNamespace("nsdl", NamedObject.NSDL_NAMESPACE);
! public static final String NSDL_PREFIX = "nsdl:";
}
Index: NamedObjectFactory.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/NamedObjectFactory.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** NamedObjectFactory.java 19 Sep 2003 14:40:53 -0000 1.1.1.1
--- NamedObjectFactory.java 22 Sep 2003 19:24:01 -0000 1.2
***************
*** 2,5 ****
--- 2,8 ----
* $Id$
* $Log$
+ * Revision 1.2 2003/09/22 19:24:01 pelle
+ * More fixes throughout to problems caused by renaming.
+ *
* Revision 1.1.1.1 2003/09/19 14:40:53 pelle
* First import into the neuclear project. This was originally under the SF neudist
***************
*** 118,122 ****
import org.neuclear.id.verifier.NSVerifier;
import org.neuclear.source.Source;
! import org.neuclear.utils.NeudistException;
public class NamedObjectFactory {
--- 121,125 ----
import org.neuclear.id.verifier.NSVerifier;
import org.neuclear.source.Source;
! import org.neudist.utils.NeudistException;
public class NamedObjectFactory {
***************
*** 140,147 ****
*/
public static NamedObject createNamedObject(Element elem) throws NeudistException {
! QName rootName=elem.getQName();
! if (rootName.getName().equals("NameSpace")&&rootName.getNamespaceURI().equals(NamedObject.NSDL_NAMESPACE))
return new NameSpace(elem);
! else if(rootName.getName().equals("AuthenticationTicket")&&rootName.getNamespaceURI().equals(AuthenticationTicket.URI_NSAUTH))
return new AuthenticationTicket(elem);
else
--- 143,150 ----
*/
public static NamedObject createNamedObject(Element elem) throws NeudistException {
! QName rootName = elem.getQName();
! if (rootName.getName().equals("NameSpace") && rootName.getNamespaceURI().equals(NamedObject.NSDL_NAMESPACE))
return new NameSpace(elem);
! else if (rootName.getName().equals("AuthenticationTicket") && rootName.getNamespaceURI().equals(AuthenticationTicket.URI_NSAUTH))
return new AuthenticationTicket(elem);
else
***************
*** 150,164 ****
}
! public static NamedObject fetchNamedObject(String name) throws NeudistException{
! String parentName=NSTools.getParentNSURI(name);
if (!parentName.equals("neu://")) {
! NameSpace parent=NSResolver.resolveNameSpace(parentName);
! if (parent==null)
return null;
}
! NamedObject nobj= Source.getInstance().fetch(NSResolver.NSROOTSTORE,name);
if (!NSVerifier.isNameValid(nobj))
! throw new InvalidNameSpaceException(nobj.getName()+" is not valid");
return nobj;
}
--- 153,167 ----
}
! public static NamedObject fetchNamedObject(String name) throws NeudistException {
! String parentName = NSTools.getParentNSURI(name);
if (!parentName.equals("neu://")) {
! NameSpace parent = NSResolver.resolveNameSpace(parentName);
! if (parent == null)
return null;
}
! NamedObject nobj = Source.getInstance().fetch(NSResolver.NSROOTSTORE, name);
if (!NSVerifier.isNameValid(nobj))
! throw new InvalidNameSpaceException(nobj.getName() + " is not valid");
return nobj;
}
|
|
From: <pe...@us...> - 2003-09-22 19:24:13
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/source
In directory sc8-pr-cvs1:/tmp/cvs-serv4908/src/java/org/neuclear/source
Modified Files:
CachedSource.java HttpSource.java Source.java
Log Message:
More fixes throughout to problems caused by renaming.
Index: CachedSource.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/source/CachedSource.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** CachedSource.java 19 Sep 2003 14:41:44 -0000 1.1.1.1
--- CachedSource.java 22 Sep 2003 19:24:02 -0000 1.2
***************
*** 3,6 ****
--- 3,9 ----
* $Id$
* $Log$
+ * 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:44 pelle
* First import into the neuclear project. This was originally under the SF neudist
***************
*** 29,33 ****
import org.neuclear.id.NSTools;
import org.neuclear.id.NamedObject;
! import org.neuclear.utils.NeudistException;
import java.util.Map;
--- 32,36 ----
import org.neuclear.id.NSTools;
import org.neuclear.id.NamedObject;
! import org.neudist.utils.NeudistException;
import java.util.Map;
***************
*** 39,55 ****
public final class CachedSource extends Source {
public CachedSource(Source src) {
! this.src=src;
! cache=new LRUMap(CACHE_SIZE);
}
public NamedObject fetch(String endpoint, String name) throws NeudistException {
! name=NSTools.normalizeNameURI(name);
! NamedObject candidate=(NamedObject)cache.get(name);
! if (candidate!=null)
return candidate;
! candidate=src.fetch(endpoint, name);
! if (candidate!=null)
storeInCache(candidate);
return candidate;
--- 42,58 ----
public final class CachedSource extends Source {
public CachedSource(Source src) {
! this.src = src;
! cache = new LRUMap(CACHE_SIZE);
}
public NamedObject fetch(String endpoint, String name) throws NeudistException {
! name = NSTools.normalizeNameURI(name);
! NamedObject candidate = (NamedObject) cache.get(name);
! if (candidate != null)
return candidate;
! candidate = src.fetch(endpoint, name);
! if (candidate != null)
storeInCache(candidate);
return candidate;
***************
*** 57,62 ****
}
! private void storeInCache(NamedObject obj) throws NeudistException{
! cache.put(obj.getName(),obj);
}
--- 60,65 ----
}
! private void storeInCache(NamedObject obj) throws NeudistException {
! cache.put(obj.getName(), obj);
}
***************
*** 64,68 ****
private final Source src;
! public static final int CACHE_SIZE=10000;
--- 67,71 ----
private final Source src;
! public static final int CACHE_SIZE = 10000;
Index: HttpSource.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/source/HttpSource.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** HttpSource.java 19 Sep 2003 14:41:49 -0000 1.1.1.1
--- HttpSource.java 22 Sep 2003 19:24:02 -0000 1.2
***************
*** 7,11 ****
import org.neuclear.id.NamedObject;
import org.neuclear.id.NamedObjectFactory;
! import org.neuclear.utils.NeudistException;
import java.net.MalformedURLException;
--- 7,11 ----
import org.neuclear.id.NamedObject;
import org.neuclear.id.NamedObjectFactory;
! import org.neudist.utils.NeudistException;
import java.net.MalformedURLException;
***************
*** 19,22 ****
--- 19,25 ----
* $Id$
* $Log$
+ * 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 neudist
***************
*** 42,56 ****
public class HttpSource extends Source {
public HttpSource() {
! reader=new SAXReader();
}
public NamedObject fetch(String endpoint, String name) throws NeudistException {
try {
! String urlstring = endpoint+NSTools.url2path(name);
! URL url=new URL(urlstring);
! Document doc=reader.read(url);
return NamedObjectFactory.createNamedObject(doc);
} catch (DocumentException e) {
! throw new NeudistException(name+ " not found");
} catch (MalformedURLException e) {
throw new NeudistException(e);
--- 45,59 ----
public class HttpSource extends Source {
public HttpSource() {
! reader = new SAXReader();
}
public NamedObject fetch(String endpoint, String name) throws NeudistException {
try {
! String urlstring = endpoint + NSTools.url2path(name);
! URL url = new URL(urlstring);
! Document doc = reader.read(url);
return NamedObjectFactory.createNamedObject(doc);
} catch (DocumentException e) {
! throw new NeudistException(name + " not found");
} catch (MalformedURLException e) {
throw new NeudistException(e);
***************
*** 58,66 ****
}
! public static void main(String args[]){
! Source source=new HttpSource();
try {
! NamedObject obj=source.fetch("http://repository.neuclear.org","/pelle");
! System.out.println("Got: "+obj.getName());
System.out.println(obj.getElement().asXML());
} catch (NeudistException e) {
--- 61,69 ----
}
! public static void main(String args[]) {
! Source source = new HttpSource();
try {
! NamedObject obj = source.fetch("http://repository.neuclear.org", "/pelle");
! System.out.println("Got: " + obj.getName());
System.out.println(obj.getElement().asXML());
} catch (NeudistException e) {
***************
*** 68,71 ****
--- 71,75 ----
}
}
+
private SAXReader reader;
}
Index: Source.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/source/Source.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** Source.java 19 Sep 2003 14:41:49 -0000 1.1.1.1
--- Source.java 22 Sep 2003 19:24:02 -0000 1.2
***************
*** 2,7 ****
import org.neuclear.id.NamedObject;
! import org.neuclear.utils.NeudistException;
! import org.neuclear.utils.Utility;
/**
--- 2,7 ----
import org.neuclear.id.NamedObject;
! import org.neudist.utils.NeudistException;
! import org.neudist.utils.Utility;
/**
***************
*** 12,15 ****
--- 12,18 ----
* $Id$
* $Log$
+ * 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 neudist
***************
*** 42,64 ****
public static synchronized Source getInstance() {
! if (instance==null) {
! Source mainSource=null;
! String name=System.getProperty("org.neuclear.source");
! if (Utility.isEmpty(name)) {
! name=DEFAULT;
! }
try {
! mainSource=(Source)Class.forName(name).newInstance();
! } catch (Exception e) {
! e.printStackTrace(); //To change body of catch statement use Options | File Templates.
! try {
! mainSource=(Source)Class.forName(DEFAULT).newInstance();
! } catch (Exception e1) {
! e1.printStackTrace(); //To change body of catch statement use Options | File Templates.
! System.err.println("Real big problems");
! }
}
- instance=new CachedSource(mainSource);
}
return instance;
--- 45,67 ----
public static synchronized Source getInstance() {
! if (instance == null) {
! Source mainSource = null;
! String name = System.getProperty("org.neuclear.source");
! if (Utility.isEmpty(name)) {
! name = DEFAULT;
! }
! try {
! mainSource = (Source) Class.forName(name).newInstance();
! } catch (Exception e) {
! e.printStackTrace(); //To change body of catch statement use Options | File Templates.
try {
! mainSource = (Source) Class.forName(DEFAULT).newInstance();
! } catch (Exception e1) {
! e1.printStackTrace(); //To change body of catch statement use Options | File Templates.
! System.err.println("Real big problems");
}
}
+ instance = new CachedSource(mainSource);
+ }
return instance;
***************
*** 67,70 ****
private static Source instance;
! private final static String DEFAULT="org.neuclear.source.HttpSource";
}
--- 70,73 ----
private static Source instance;
! private final static String DEFAULT = "org.neuclear.source.HttpSource";
}
|
|
From: <pe...@us...> - 2003-09-22 19:24:13
|
Update of /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/store
In directory sc8-pr-cvs1:/tmp/cvs-serv4908/src/test/org/neuclear/store
Modified Files:
AbstractStoreTest.java
Removed Files:
CachedStoreTest.java MemoryStoreTest.java
Log Message:
More fixes throughout to problems caused by renaming.
Index: AbstractStoreTest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/store/AbstractStoreTest.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** AbstractStoreTest.java 19 Sep 2003 14:42:03 -0000 1.1.1.1
--- AbstractStoreTest.java 22 Sep 2003 19:24:03 -0000 1.2
***************
*** 2,5 ****
--- 2,8 ----
$Id$
$Log$
+ Revision 1.2 2003/09/22 19:24:03 pelle
+ More fixes throughout to problems caused by renaming.
+
Revision 1.1.1.1 2003/09/19 14:42:03 pelle
First import into the neuclear project. This was originally under the SF neudist
***************
*** 81,87 ****
package org.neuclear.store;
import junit.framework.TestCase;
import org.neuclear.id.InvalidNameSpaceException;
! import org.neuclear.utils.NeudistException;
import java.security.GeneralSecurityException;
--- 84,91 ----
package org.neuclear.store;
+
import junit.framework.TestCase;
import org.neuclear.id.InvalidNameSpaceException;
! import org.neudist.utils.NeudistException;
import java.security.GeneralSecurityException;
***************
*** 94,131 ****
* @author Pelle Braendgaard
*/
! public abstract class AbstractStoreTest extends TestCase {
public AbstractStoreTest(String name) throws GeneralSecurityException {
! super(name);
setUp();
}
/**
*/
public abstract Store getStoreInstance();
! protected void setUp() throws GeneralSecurityException{
! store=getStoreInstance();
generateKeys();
}
protected static synchronized void generateKeys() throws GeneralSecurityException {
! if (kg==null) {
System.out.println("Generating Test Keys");
! kg=KeyPairGenerator.getInstance("RSA");
! kg.initialize(2048,new SecureRandom("Bear it all with NeuDist".getBytes()));
! // kp=kg.generateKeyPair();
! root=kg.generateKeyPair();
! bob=kg.generateKeyPair();
! alice=kg.generateKeyPair();
! eve=kg.generateKeyPair();
}
}
protected void tearDown() {
! store=null;
! }
! public void testStore() throws NeudistException,InvalidNameSpaceException {
! System.out.println("\nTesting "+this.getClass().getName());
// System.out.println("Storing "+rootName);
// store.receive(new NameSpace(rootName,root,root.getPublic()));
--- 98,137 ----
* @author Pelle Braendgaard
*/
! public abstract class AbstractStoreTest extends TestCase {
public AbstractStoreTest(String name) throws GeneralSecurityException {
! super(name);
setUp();
}
+
/**
*/
public abstract Store getStoreInstance();
! protected void setUp() throws GeneralSecurityException {
! store = getStoreInstance();
generateKeys();
}
+
protected static synchronized void generateKeys() throws GeneralSecurityException {
! if (kg == null) {
System.out.println("Generating Test Keys");
! kg = KeyPairGenerator.getInstance("RSA");
! kg.initialize(2048, new SecureRandom("Bear it all with NeuDist".getBytes()));
! // kp=kg.generateKeyPair();
! root = kg.generateKeyPair();
! bob = kg.generateKeyPair();
! alice = kg.generateKeyPair();
! eve = kg.generateKeyPair();
}
}
protected void tearDown() {
! store = null;
! }
! public void testStore() throws NeudistException, InvalidNameSpaceException {
! System.out.println("\nTesting " + this.getClass().getName());
// System.out.println("Storing "+rootName);
// store.receive(new NameSpace(rootName,root,root.getPublic()));
***************
*** 150,154 ****
// NamedObject nobj4=store.fetch(eveName);
// assertEquals(NSTools.normalizeNameURI(eveName),nobj4.getName());
! }
// KeyPair root;
--- 156,160 ----
// NamedObject nobj4=store.fetch(eveName);
// assertEquals(NSTools.normalizeNameURI(eveName),nobj4.getName());
! }
// KeyPair root;
***************
*** 156,163 ****
// PrivateKey bobSigner;
Store store;
! protected static final String rootName="/";
! protected static final String bobName="/bob";
! protected static final String bobAliceName="/bob/alice";
! protected static final String eveName="/eve";
protected static KeyPairGenerator kg;
--- 162,169 ----
// PrivateKey bobSigner;
Store store;
! protected static final String rootName = "/";
! protected static final String bobName = "/bob";
! protected static final String bobAliceName = "/bob/alice";
! protected static final String eveName = "/eve";
protected static KeyPairGenerator kg;
--- CachedStoreTest.java DELETED ---
--- MemoryStoreTest.java DELETED ---
|
|
From: <pe...@us...> - 2003-09-22 19:24:13
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/store/servlet
In directory sc8-pr-cvs1:/tmp/cvs-serv4908/src/java/org/neuclear/store/servlet
Modified Files:
StorageServlet.java
Log Message:
More fixes throughout to problems caused by renaming.
Index: StorageServlet.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/store/servlet/StorageServlet.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** StorageServlet.java 19 Sep 2003 14:41:29 -0000 1.1.1.1
--- StorageServlet.java 22 Sep 2003 19:24:02 -0000 1.2
***************
*** 12,16 ****
import org.neuclear.store.FileStore;
import org.neuclear.store.Store;
! import org.neuclear.utils.Utility;
import javax.servlet.ServletConfig;
--- 12,16 ----
import org.neuclear.store.FileStore;
import org.neuclear.store.Store;
! import org.neudist.utils.Utility;
import javax.servlet.ServletConfig;
***************
*** 21,27 ****
System.out.println("NEUDIST: Initialising StorageServlet");
super.init(config);
! String storePath=config.getServletContext().getRealPath(Utility.denullString(config.getInitParameter("basedir"),"/WEB-INF/store"));
! System.out.println("NEUDIST: Setting up store at: "+storePath);
! store=new FileStore(storePath);
setReceiver(store);
}
--- 21,27 ----
System.out.println("NEUDIST: Initialising StorageServlet");
super.init(config);
! String storePath = config.getServletContext().getRealPath(Utility.denullString(config.getInitParameter("basedir"), "/WEB-INF/store"));
! System.out.println("NEUDIST: Setting up store at: " + storePath);
! store = new FileStore(storePath);
setReceiver(store);
}
***************
*** 31,34 ****
--- 31,35 ----
return store;
}
+
private Store store;
|
|
From: <pe...@us...> - 2003-09-22 19:24:13
|
Update of /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id
In directory sc8-pr-cvs1:/tmp/cvs-serv4908/src/test/org/neuclear/id
Modified Files:
NSToolsTest.java
Log Message:
More fixes throughout to problems caused by renaming.
Index: NSToolsTest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id/NSToolsTest.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** NSToolsTest.java 19 Sep 2003 14:41:54 -0000 1.1.1.1
--- NSToolsTest.java 22 Sep 2003 19:24:03 -0000 1.2
***************
*** 2,5 ****
--- 2,8 ----
$Id$
$Log$
+ Revision 1.2 2003/09/22 19:24:03 pelle
+ More fixes throughout to problems caused by renaming.
+
Revision 1.1.1.1 2003/09/19 14:41:54 pelle
First import into the neuclear project. This was originally under the SF neudist
***************
*** 60,67 ****
package org.neuclear.id;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
! import org.neuclear.utils.NeudistException;
--- 63,71 ----
package org.neuclear.id;
+
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
! import org.neudist.utils.NeudistException;
***************
*** 70,81 ****
* @author Pelle Braendgaard
*/
! public class NSToolsTest extends TestCase {
public NSToolsTest() {
! super("NSToolsTest");
setUp();
}
public NSToolsTest(String name) {
! super(name);
! }
/**
*/
--- 74,87 ----
* @author Pelle Braendgaard
*/
! public class NSToolsTest extends TestCase {
public NSToolsTest() {
! super("NSToolsTest");
setUp();
}
+
public NSToolsTest(String name) {
! super(name);
! }
!
/**
*/
***************
*** 84,101 ****
protected void tearDown() {
! }
! public static Test suite() {
! return new TestSuite(NSToolsTest.class);
! }
! private static void assertValidName(String name) throws NeudistException{
! assertTrue("Should be valid='"+name+"'",NSTools.isValidName(name));
}
! private static void assertInvalidName(String name) throws NeudistException{
! assertTrue("Should be invalid='"+name+"'",!NSTools.isValidName(name));
}
! public void testValidName() throws NeudistException{
assertValidName("/");
assertValidName("neu://");
--- 90,108 ----
protected void tearDown() {
! }
! public static Test suite() {
! return new TestSuite(NSToolsTest.class);
! }
! private static void assertValidName(String name) throws NeudistException {
! assertTrue("Should be valid='" + name + "'", NSTools.isValidName(name));
}
!
! private static void assertInvalidName(String name) throws NeudistException {
! assertTrue("Should be invalid='" + name + "'", !NSTools.isValidName(name));
}
! public void testValidName() throws NeudistException {
assertValidName("/");
assertValidName("neu://");
***************
*** 110,127 ****
assertInvalidName("/help/abcd_efg.-232Avc/");
}
public static void testNormalize() throws NeudistException {
! assertEquals("neu://hello",NSTools.normalizeNameURI("/hello"));
! assertEquals("neu://hello",NSTools.normalizeNameURI("neu://hello"));
}
public static void testFindParent() throws NeudistException {
! assertEquals("neu://hello",NSTools.getParentNSURI("neu://hello/one") );
! 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("/"));
}
-
--- 117,135 ----
assertInvalidName("/help/abcd_efg.-232Avc/");
}
+
public static void testNormalize() throws NeudistException {
! assertEquals("neu://hello", NSTools.normalizeNameURI("/hello"));
! assertEquals("neu://hello", NSTools.normalizeNameURI("neu://hello"));
}
+
public static void testFindParent() throws NeudistException {
! assertEquals("neu://hello", NSTools.getParentNSURI("neu://hello/one"));
! 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("/"));
}
|
|
From: <pe...@us...> - 2003-09-22 19:24:13
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/signers/commandline In directory sc8-pr-cvs1:/tmp/cvs-serv4908/src/java/org/neuclear/signers/commandline Modified Files: CommandLineSigner.java Log Message: More fixes throughout to problems caused by renaming. Index: CommandLineSigner.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/signers/commandline/CommandLineSigner.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** CommandLineSigner.java 19 Sep 2003 14:41:31 -0000 1.1.1.1 --- CommandLineSigner.java 22 Sep 2003 19:24:02 -0000 1.2 *************** *** 1,4 **** --- 1,7 ---- /* $Id$ * $Log$ + * 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:31 pelle * First import into the neuclear project. This was originally under the SF neudist *************** *** 101,105 **** import org.apache.commons.cli.*; import org.dom4j.Document; - import org.neuclear.crypto.CryptoTools; import org.neuclear.id.NSTools; import org.neuclear.id.NameSpace; --- 104,107 ---- *************** *** 108,114 **** import org.neuclear.id.resolver.NSResolver; import org.neuclear.senders.LogSender; ! import org.neuclear.utils.NeudistException; ! import org.neuclear.utils.Utility; ! import org.neuclear.xml.XMLTools; import java.io.*; --- 110,117 ---- import org.neuclear.id.resolver.NSResolver; import org.neuclear.senders.LogSender; ! import org.neudist.crypto.CryptoTools; ! import org.neudist.utils.NeudistException; ! import org.neudist.utils.Utility; ! import org.neudist.xml.XMLTools; import java.io.*; *************** *** 125,233 **** public class CommandLineSigner { ! public static void main(String args[]){ ! CryptoTools.ensureProvider(); ! String keystore=System.getProperty("user.home")+"/.keystore"; try { ! //System.setProperty("org.apache.commons.cli.parser","org.apache.commons.cli.PosixParser"); ! Options options=createOptions(); ! CommandLineParser clparser=CommandLineParserFactory.newParser(); ! CommandLine cmd = clparser.parse(options,args); ! boolean doSign=(cmd.hasOption("a")); ! boolean doCreate=(cmd.hasOption("n")&&cmd.hasOption("b")); ! if ( ! !(doSign || ! doCreate) ! ) { ! HelpFormatter help=new HelpFormatter(); ! help.printHelp("java org.neuclear.signer.commandline.CommandLineSigner --keystorepassword kspassword [--alias alias --password password] [--name neu://neu/one --allow neuone]",options); ! System.exit(1); ! } ! String ksf=cmd.getOptionValue("s"); ! String kstype=cmd.getOptionValue("t"); ! String kspassword=cmd.getOptionValue("j"); ! String sf=cmd.getOptionValue("i"); ! String password=Utility.denullString(cmd.getOptionValue("p"),kspassword); // If we dont specify a password it defaults to ks password ! String namespace=cmd.getOptionValue("n"); ! String alias=Utility.denullString(cmd.getOptionValue("a"),NSTools.getParentNSURI(namespace)); ! String allow=Utility.denullString(cmd.getOptionValue("w"),namespace); ! String of=Utility.denullString(cmd.getOptionValue("o"),"."+NSTools.url2path(namespace)+"/root.id"); ! doSign=!Utility.isEmpty(alias); ! String defaultstore=Utility.denullString(cmd.getOptionValue("r"),NSResolver.NSROOTSTORE); ! String defaultsigner=Utility.denullString(cmd.getOptionValue("i"),"http://localhost:11870/signer"); ! String defaultlogger=Utility.denullString(cmd.getOptionValue("l"),LogSender.LOGGER); ! String defaultreceiver=cmd.getOptionValue("b"); ! File keystoreFile=new File(Utility.denullString(ksf,keystore)); ! KeyStore ks=KeyStore.getInstance(Utility.denullString(kstype,KeyStore.getDefaultType())); ! ks.load(new FileInputStream(keystoreFile),Utility.denullString(kspassword).toCharArray()); ! KeyPair kp=CryptoTools.getKeyPair(ks,alias,password.toCharArray()); ! if (doSign) { ! if (kp==null) { ! System.err.println("Key with alias: "+alias+" doesnt exist"); ! System.exit(1); ! } ! } ! NamedObject subject; ! if (!doCreate) { ! subject = loadNamedObject(sf); ! } else { ! PublicKey newkid; ! if (!Utility.isEmpty(allow)) { ! Certificate cert=ks.getCertificate(allow); ! if (cert==null){ ! System.err.println("PublicKey: "+allow+" doesnt exist in key store"); ! System.exit(1); ! } ! newkid=cert.getPublicKey(); ! } else ! newkid=ks.getCertificate(alias).getPublicKey(); //Self Sign ! subject=new NameSpace(namespace,newkid,defaultstore,defaultsigner,defaultlogger,defaultreceiver); ! } ! if (doSign){ ! PrivateKey key=kp.getPrivate(); ! System.err.println("Signing by "+alias+" ..."); ! subject.sign(key); ! System.err.print("Verifying..."); ! if (subject.verifySignature(kp.getPublic())) ! System.err.println("ok"); ! else ! System.err.println("FAIL"); ! } ! OutputStream dest=System.out; ! if (!Utility.isEmpty(of)) { ! File outFile=new File(of); ! if (outFile.getParentFile()!=null) ! outFile.getParentFile().mkdirs(); ! dest=new FileOutputStream(of); ! System.err.println("Outputting to: "+of); ! } ! XMLTools.writeFile(dest,subject.getElement()); ! } catch (Exception e) { ! System.err.println(e.getMessage()); ! e.printStackTrace(System.err); ! } ! } private static NamedObject loadNamedObject(String sf) throws FileNotFoundException, NeudistException { NamedObject subject; ! InputStream source=System.in; if (!Utility.isEmpty(sf)) { ! source=new FileInputStream(sf); } ! Document doc=XMLTools.loadDocument(source); ! subject=NamedObjectFactory.createNamedObject(doc); return subject; } --- 128,236 ---- public class CommandLineSigner { ! public static void main(String args[]) { ! CryptoTools.ensureProvider(); ! String keystore = System.getProperty("user.home") + "/.keystore"; try { ! //System.setProperty("org.apache.commons.cli.parser","org.apache.commons.cli.PosixParser"); ! Options options = createOptions(); ! CommandLineParser clparser = CommandLineParserFactory.newParser(); ! CommandLine cmd = clparser.parse(options, args); ! boolean doSign = (cmd.hasOption("a")); ! boolean doCreate = (cmd.hasOption("n") && cmd.hasOption("b")); ! if ( ! !(doSign || ! doCreate) ! ) { ! HelpFormatter help = new HelpFormatter(); ! help.printHelp("java org.neuclear.signer.commandline.CommandLineSigner --keystorepassword kspassword [--alias alias --password password] [--name neu://neu/one --allow neuone]", options); ! System.exit(1); ! } ! String ksf = cmd.getOptionValue("s"); ! String kstype = cmd.getOptionValue("t"); ! String kspassword = cmd.getOptionValue("j"); ! String sf = cmd.getOptionValue("i"); ! String password = Utility.denullString(cmd.getOptionValue("p"), kspassword); // If we dont specify a password it defaults to ks password ! String namespace = cmd.getOptionValue("n"); ! String alias = Utility.denullString(cmd.getOptionValue("a"), NSTools.getParentNSURI(namespace)); ! String allow = Utility.denullString(cmd.getOptionValue("w"), namespace); ! String of = Utility.denullString(cmd.getOptionValue("o"), "." + NSTools.url2path(namespace) + "/root.id"); ! doSign = !Utility.isEmpty(alias); ! String defaultstore = Utility.denullString(cmd.getOptionValue("r"), NSResolver.NSROOTSTORE); ! String defaultsigner = Utility.denullString(cmd.getOptionValue("i"), "http://localhost:11870/signer"); ! String defaultlogger = Utility.denullString(cmd.getOptionValue("l"), LogSender.LOGGER); ! String defaultreceiver = cmd.getOptionValue("b"); ! File keystoreFile = new File(Utility.denullString(ksf, keystore)); ! KeyStore ks = KeyStore.getInstance(Utility.denullString(kstype, KeyStore.getDefaultType())); ! ks.load(new FileInputStream(keystoreFile), Utility.denullString(kspassword).toCharArray()); ! KeyPair kp = CryptoTools.getKeyPair(ks, alias, password.toCharArray()); ! if (doSign) { ! if (kp == null) { ! System.err.println("Key with alias: " + alias + " doesnt exist"); ! System.exit(1); ! } ! } ! NamedObject subject; ! if (!doCreate) { ! subject = loadNamedObject(sf); ! } else { ! PublicKey newkid; ! if (!Utility.isEmpty(allow)) { ! Certificate cert = ks.getCertificate(allow); ! if (cert == null) { ! System.err.println("PublicKey: " + allow + " doesnt exist in key store"); ! System.exit(1); ! } ! newkid = cert.getPublicKey(); ! } else ! newkid = ks.getCertificate(alias).getPublicKey(); //Self Sign ! subject = new NameSpace(namespace, newkid, defaultstore, defaultsigner, defaultlogger, defaultreceiver); ! } ! if (doSign) { ! PrivateKey key = kp.getPrivate(); ! System.err.println("Signing by " + alias + " ..."); ! subject.sign(key); ! System.err.print("Verifying..."); ! if (subject.verifySignature(kp.getPublic())) ! System.err.println("ok"); ! else ! System.err.println("FAIL"); ! } ! OutputStream dest = System.out; ! if (!Utility.isEmpty(of)) { ! File outFile = new File(of); ! if (outFile.getParentFile() != null) ! outFile.getParentFile().mkdirs(); ! dest = new FileOutputStream(of); ! System.err.println("Outputting to: " + of); ! } ! XMLTools.writeFile(dest, subject.getElement()); ! } catch (Exception e) { ! System.err.println(e.getMessage()); ! e.printStackTrace(System.err); ! } ! } private static NamedObject loadNamedObject(String sf) throws FileNotFoundException, NeudistException { NamedObject subject; ! InputStream source = System.in; if (!Utility.isEmpty(sf)) { ! source = new FileInputStream(sf); } ! Document doc = XMLTools.loadDocument(source); ! subject = NamedObjectFactory.createNamedObject(doc); return subject; } *************** *** 238,255 **** // add t option ! options.addOption("s","keystore", true , "specify KeyStore"); ! options.addOption("t","keystoretype", true , "specify KeyStore Type"); ! options.addOption("j","keystorepassword", true , "specify KeyStore Password"); ! options.addOption("a","alias", true , "specify Key Alias in KeyStore"); ! options.addOption("p","password", true , "specify Alias Password"); ! options.addOption("i","inputfile", true , "specify Input File"); ! options.addOption("o", "outputfile",true , "specify Output File"); ! options.addOption("n","name", true , "specify name of new object"); ! options.addOption("w","allow", true , "specify alias of owner of new namespace"); ! options.addOption("r","defaultrepository", true , "NameSpace's default Repository"); ! options.addOption("i","defaultsigner", true , "NameSpace's default Interactive Signer"); ! options.addOption("l","defaultlogger", true , "NameSpace's default Logging Service"); ! options.addOption("b","defaultreceiver", true , "NameSpace's default Receiver"); ! --- 241,257 ---- // add t option ! options.addOption("s", "keystore", true, "specify KeyStore"); ! options.addOption("t", "keystoretype", true, "specify KeyStore Type"); ! options.addOption("j", "keystorepassword", true, "specify KeyStore Password"); ! options.addOption("a", "alias", true, "specify Key Alias in KeyStore"); ! options.addOption("p", "password", true, "specify Alias Password"); ! options.addOption("i", "inputfile", true, "specify Input File"); ! options.addOption("o", "outputfile", true, "specify Output File"); ! options.addOption("n", "name", true, "specify name of new object"); ! options.addOption("w", "allow", true, "specify alias of owner of new namespace"); ! options.addOption("r", "defaultrepository", true, "NameSpace's default Repository"); ! options.addOption("i", "defaultsigner", true, "NameSpace's default Interactive Signer"); ! options.addOption("l", "defaultlogger", true, "NameSpace's default Logging Service"); ! options.addOption("b", "defaultreceiver", true, "NameSpace's default Receiver"); |
|
From: <pe...@us...> - 2003-09-22 19:24:13
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/verifier
In directory sc8-pr-cvs1:/tmp/cvs-serv4908/src/java/org/neuclear/id/verifier
Modified Files:
NSVerifier.java
Log Message:
More fixes throughout to problems caused by renaming.
Index: NSVerifier.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/verifier/NSVerifier.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** NSVerifier.java 19 Sep 2003 14:41:12 -0000 1.1.1.1
--- NSVerifier.java 22 Sep 2003 19:24:01 -0000 1.2
***************
*** 1,5 ****
package org.neuclear.id.verifier;
- import org.neuclear.crypto.CryptoTools;
import org.neuclear.id.InvalidNameSpaceException;
import org.neuclear.id.NSTools;
--- 1,4 ----
***************
*** 7,12 ****
import org.neuclear.id.NamedObject;
import org.neuclear.id.resolver.NSResolver;
! import org.neuclear.utils.NeudistException;
! import org.neuclear.xml.xmlsec.XMLSecurityException;
import java.security.PublicKey;
--- 6,12 ----
import org.neuclear.id.NamedObject;
import org.neuclear.id.resolver.NSResolver;
! import org.neudist.crypto.CryptoTools;
! import org.neudist.utils.NeudistException;
! import org.neudist.xml.xmlsec.XMLSecurityException;
import java.security.PublicKey;
***************
*** 16,21 ****
*/
public final class NSVerifier {
! private static final String NSROOTPKMOD="AKbv1DrfQCj7fbcc/9U8mLHi9LzFGVw8ac9z26BN1+yeq9VG3wvW+OXjvUpQ9cD+dpwpFXeai9Hz DkFeJcT9Coi9A8Aj4nffWAlxJ/AVOIRCi1d4A/d9InhQ7UYYA5O7XBcwKneopYVa9zRDUoy0ZpVy t9Kj5i0Zw6oZsflAu4S4pIU+niYwwWrYmCuBEq9kecf7nSGiU0rHp1QNs7NYdhXCl2BMcSaz0AZt AF8YLlZYasviJkoxUFBB/Vjqa98xi7V7XIGsMbXWqUvJ8MW2N/CUdBz5aDlpBUwul8rqyq+03A0q 84AFJiUcudqVL7KhURXB8ZYy/hZb+YkEvE3IigU=";
! private static final String NSROOTPKEXP="AQAB";
private static PublicKey nsrootpk;
--- 16,21 ----
*/
public final class NSVerifier {
! private static final String NSROOTPKMOD = "AKbv1DrfQCj7fbcc/9U8mLHi9LzFGVw8ac9z26BN1+yeq9VG3wvW+OXjvUpQ9cD+dpwpFXeai9Hz DkFeJcT9Coi9A8Aj4nffWAlxJ/AVOIRCi1d4A/d9InhQ7UYYA5O7XBcwKneopYVa9zRDUoy0ZpVy t9Kj5i0Zw6oZsflAu4S4pIU+niYwwWrYmCuBEq9kecf7nSGiU0rHp1QNs7NYdhXCl2BMcSaz0AZt AF8YLlZYasviJkoxUFBB/Vjqa98xi7V7XIGsMbXWqUvJ8MW2N/CUdBz5aDlpBUwul8rqyq+03A0q 84AFJiUcudqVL7KhURXB8ZYy/hZb+YkEvE3IigU=";
! private static final String NSROOTPKEXP = "AQAB";
private static PublicKey nsrootpk;
***************
*** 27,38 ****
* We check if this object is allowed within the parents namespace
*/
! public final static boolean isNameValid(NamedObject obj) throws NeudistException {
if (!NSTools.isValidName(obj.getName()))
return false;
! String parentName=NSTools.getParentNSURI(obj.getName());
if (parentName.equals("neu://")) {
! boolean valid= obj.verifySignature(getRootPK());
// if (valid && obj instanceof NameSpace)
// NSResolver.NSCACHE.cache((NameSpace)obj);
--- 27,38 ----
* We check if this object is allowed within the parents namespace
*/
! public final static boolean isNameValid(NamedObject obj) throws NeudistException {
if (!NSTools.isValidName(obj.getName()))
return false;
! String parentName = NSTools.getParentNSURI(obj.getName());
if (parentName.equals("neu://")) {
! boolean valid = obj.verifySignature(getRootPK());
// if (valid && obj instanceof NameSpace)
// NSResolver.NSCACHE.cache((NameSpace)obj);
***************
*** 41,45 ****
// Allright we need to do this the hard way
! NameSpace parent=null;
try {
parent = NSResolver.resolveNameSpace(parentName);
--- 41,45 ----
// Allright we need to do this the hard way
! NameSpace parent = null;
try {
parent = NSResolver.resolveNameSpace(parentName);
***************
*** 51,55 ****
//if (parent==null&&getName().equals("neu://")) return true;
! boolean valid= (parent!=null&&parent.postAllowed(obj));
// if (valid && obj instanceof NameSpace)
// NSResolver.NSCACHE.cache((NameSpace)obj);
--- 51,55 ----
//if (parent==null&&getName().equals("neu://")) return true;
! boolean valid = (parent != null && parent.postAllowed(obj));
// if (valid && obj instanceof NameSpace)
// NSResolver.NSCACHE.cache((NameSpace)obj);
***************
*** 61,66 ****
*/
public final static PublicKey getRootPK() throws XMLSecurityException {
! if (nsrootpk==null)
! nsrootpk=CryptoTools.createPK(NSROOTPKMOD,NSROOTPKEXP);
return nsrootpk;
}
--- 61,66 ----
*/
public final static PublicKey getRootPK() throws XMLSecurityException {
! if (nsrootpk == null)
! nsrootpk = CryptoTools.createPK(NSROOTPKMOD, NSROOTPKEXP);
return nsrootpk;
}
|
|
From: <pe...@us...> - 2003-09-22 19:24:13
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/receiver
In directory sc8-pr-cvs1:/tmp/cvs-serv4908/src/java/org/neuclear/receiver
Modified Files:
Receiver.java ReceiverServlet.java
Log Message:
More fixes throughout to problems caused by renaming.
Index: Receiver.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/receiver/Receiver.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** Receiver.java 19 Sep 2003 14:41:49 -0000 1.1.1.1
--- Receiver.java 22 Sep 2003 19:24:02 -0000 1.2
***************
*** 1,3 ****
--- 1,4 ----
package org.neuclear.receiver;
+
/**
* Created by IntelliJ IDEA.
***************
*** 8,11 ****
--- 9,15 ----
* $Id$
* $Log$
+ * 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 neudist
***************
*** 27,31 ****
import org.neuclear.id.InvalidNameSpaceException;
import org.neuclear.id.NamedObject;
! import org.neuclear.utils.NeudistException;
/**
* <p>The Receiver interface is the base interface for almost all applications based on the NeuDist Framework.
--- 31,36 ----
import org.neuclear.id.InvalidNameSpaceException;
import org.neuclear.id.NamedObject;
! import org.neudist.utils.NeudistException;
!
/**
* <p>The Receiver interface is the base interface for almost all applications based on the NeuDist Framework.
Index: ReceiverServlet.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/receiver/ReceiverServlet.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** ReceiverServlet.java 19 Sep 2003 14:41:49 -0000 1.1.1.1
--- ReceiverServlet.java 22 Sep 2003 19:24:02 -0000 1.2
***************
*** 2,5 ****
--- 2,8 ----
* $Id$
* $Log$
+ * 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 neudist
***************
*** 54,60 ****
import org.neuclear.id.NamedObject;
import org.neuclear.id.NamedObjectFactory;
! import org.neuclear.utils.NeudistException;
! import org.neuclear.xml.soap.SOAPException;
! import org.neuclear.xml.soap.SOAPServlet;
import javax.servlet.ServletConfig;
--- 57,63 ----
import org.neuclear.id.NamedObject;
import org.neuclear.id.NamedObjectFactory;
! import org.neudist.utils.NeudistException;
! import org.neudist.xml.soap.SOAPException;
! import org.neudist.xml.soap.SOAPServlet;
import javax.servlet.ServletConfig;
***************
*** 62,74 ****
public abstract class ReceiverServlet extends SOAPServlet {
! public void init(ServletConfig config) throws ServletException {
! super.init(config);
}
! protected Element handleSOAPRequest(Element request, String soapAction) throws SOAPException {
try {
! System.out.println("NEUDIST: Got Storage Request "+soapAction);
System.out.println(request.asXML());
! NamedObject named=NamedObjectFactory.createNamedObject(request);
receiver.receive(named);
return OK;
--- 65,77 ----
public abstract class ReceiverServlet extends SOAPServlet {
! public void init(ServletConfig config) throws ServletException {
! super.init(config);
}
! protected Element handleSOAPRequest(Element request, String soapAction) throws SOAPException {
try {
! System.out.println("NEUDIST: Got Storage Request " + soapAction);
System.out.println(request.asXML());
! NamedObject named = NamedObjectFactory.createNamedObject(request);
receiver.receive(named);
return OK;
***************
*** 78,83 ****
}
}
protected void setReceiver(Receiver receiver) {
! this.receiver=receiver;
}
--- 81,87 ----
}
}
+
protected void setReceiver(Receiver receiver) {
! this.receiver = receiver;
}
***************
*** 87,91 ****
private Receiver receiver;
! private static final Element OK=DocumentHelper.createElement("Status");
{
OK.setText("OK");
--- 91,96 ----
private Receiver receiver;
! private static final Element OK = DocumentHelper.createElement("Status");
!
{
OK.setText("OK");
|
|
From: <bug...@ve...> - 2003-09-22 19:10:15
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://devone.veraxpay.com:9090/secure/ViewIssue.jspa?key=NEU-4 Here is an overview of the issue: --------------------------------------------------------------------- Key: NEU-4 Summary: Change NameSpace to Identity Type: Improvement Status: Assigned Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Identity Fix Fors: 0.7 Versions: 0.7 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Mon, 22 Sep 2003 2:09 PM Updated: Mon, 22 Sep 2003 2:09 PM Description: To make it simpler to understand I suggest changing the naming convensions used here. The word NameSpace is used by too many existing concepts that it causes confusion. --------------------------------------------------------------------- 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...> - 2003-09-22 17:05:11
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://devone.veraxpay.com:9090/secure/ViewIssue.jspa?key=NEU-3 Here is an overview of the issue: --------------------------------------------------------------------- Key: NEU-3 Summary: Implement XML Pull based verifier. Type: New Feature Status: Assigned Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Identity Fix Fors: 0.8 Versions: 0.7 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Mon, 22 Sep 2003 12:03 PM Updated: Mon, 22 Sep 2003 12:03 PM 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...> - 2003-09-22 17:01:16
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://devone.veraxpay.com:9090/secure/ViewIssue.jspa?key=NEU-2 Here is an overview of the issue: --------------------------------------------------------------------- Key: NEU-2 Summary: Refactor out the dom4j dependency Type: New Feature Status: Assigned Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Identity Fix Fors: 0.7 Versions: 0.7 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Mon, 22 Sep 2003 11:59 AM Updated: Mon, 22 Sep 2003 11:59 AM Description: The ID library at the moment is way to reliant on dom4j. We should really be able to use some other kind of method for actually verifying the items. --------------------------------------------------------------------- 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...> - 2003-09-19 20:53:56
|
Message: Work on this issue has been started by Pelle Braendgaard (mailto:pe...@ve...) --------------------------------------------------------------------- View the issue: http://devone.veraxpay.com:9090/secure/ViewIssue.jspa?key=GL-8 Here is an overview of the issue: --------------------------------------------------------------------- Key: GL-8 Summary: Update Documentation. Type: Task Status: In Progress Priority: Minor Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Ledger Fix Fors: r_0_3 Versions: r_0_3 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Mon, 21 Jul 2003 2:48 PM Updated: Fri, 19 Sep 2003 3:51 PM Description: We need to update the documentation to deal with the SQL Ledger and various other new features. --------------------------------------------------------------------- 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...> - 2003-09-19 20:22:58
|
Message: The following issue has been closed. --------------------------------------------------------------------- View the issue: http://devone.veraxpay.com:9090/secure/ViewIssue.jspa?key=BET-8 Here is an overview of the issue: --------------------------------------------------------------------- Key: BET-8 Summary: Create BetProcessor Test Cases Type: Test Case Status: Closed Priority: Major Resolution: FIXED Original Estimate: 2 days Time Spent: Unknown Remaining: 2 days Project: NeuClear Bet Fix Fors: 0.1 Versions: 0.1 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Sat, 23 Aug 2003 4:32 PM Updated: Fri, 19 Sep 2003 1:39 PM Description: Create testcases to verify the functionality of the BetProcessor. --------------------------------------------------------------------- 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...> - 2003-09-19 20:07:38
|
Update of /cvsroot/neuclear/neuclear-id/xdocs/images In directory sc8-pr-cvs1:/tmp/cvs-serv30649/xdocs/images Modified Files: logo.gif Log Message: Bumped version to 0.7 Changed the logo to the neuclear logo And commented out various tests that no longer make sense. Index: logo.gif =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/xdocs/images/logo.gif,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 Binary files /tmp/cvsABiUwR and /tmp/cvsikredB differ |
|
From: <pe...@us...> - 2003-09-19 20:07:38
|
Update of /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id
In directory sc8-pr-cvs1:/tmp/cvs-serv30649/src/test/org/neuclear/id
Modified Files:
NameSpaceTest.java
Log Message:
Bumped version to 0.7
Changed the logo to the neuclear logo
And commented out various tests that no longer make sense.
Index: NameSpaceTest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id/NameSpaceTest.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** NameSpaceTest.java 19 Sep 2003 14:41:53 -0000 1.1.1.1
--- NameSpaceTest.java 19 Sep 2003 14:54:43 -0000 1.2
***************
*** 2,5 ****
--- 2,10 ----
$Id$
$Log$
+ Revision 1.2 2003/09/19 14:54:43 pelle
+ Bumped version to 0.7
+ Changed the logo to the neuclear logo
+ And commented out various tests that no longer make sense.
+
Revision 1.1.1.1 2003/09/19 14:41:53 pelle
First import into the neuclear project. This was originally under the SF neudist
***************
*** 110,117 ****
import junit.framework.TestCase;
import junit.framework.TestSuite;
- import org.neuclear.store.MemoryStore;
import org.neuclear.store.Store;
! import org.neuclear.utils.NeudistException;
! import org.neuclear.utils.Utility;
import java.io.FileInputStream;
--- 115,121 ----
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.neuclear.store.Store;
! import org.neudist.utils.NeudistException;
! import org.neudist.utils.Utility;
import java.io.FileInputStream;
***************
*** 232,235 ****
--- 236,240 ----
}
*/
+ /*
public void testCreateChild() throws NeudistException, InvalidNameSpaceException{
***************
*** 268,271 ****
--- 273,277 ----
}
}
+ */
// KeyPair root;
|