Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id
In directory sc8-pr-cvs1:/tmp/cvs-serv12836/src/java/org/neuclear/id
Modified Files:
Identity.java NamedObjectReader.java SignatureRequest.java
SignedNamedObject.java SignedObject.java
Log Message:
Signers now can generatekeys via the generateKey() method.
Refactored the relationship between SignedNamedObject and NamedObjectBuilder a bit.
SignedNamedObject now contains the full xml which is returned with getEncoded()
This means that it is now possible to further send on or process a SignedNamedObject, leaving
NamedObjectBuilder for its original purposes of purely generating new Contracts.
NamedObjectBuilder.sign() now returns a SignedNamedObject which is the prefered way of processing it.
Updated all major interfaces that used the old model to use the new model.
Index: Identity.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/Identity.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** Identity.java 18 Nov 2003 15:07:36 -0000 1.18
--- Identity.java 19 Nov 2003 23:33:59 -0000 1.19
***************
*** 2,5 ****
--- 2,14 ----
* $Id$
* $Log$
+ * Revision 1.19 2003/11/19 23:33:59 pelle
+ * Signers now can generatekeys via the generateKey() method.
+ * Refactored the relationship between SignedNamedObject and NamedObjectBuilder a bit.
+ * SignedNamedObject now contains the full xml which is returned with getEncoded()
+ * This means that it is now possible to further send on or process a SignedNamedObject, leaving
+ * NamedObjectBuilder for its original purposes of purely generating new Contracts.
+ * NamedObjectBuilder.sign() now returns a SignedNamedObject which is the prefered way of processing it.
+ * Updated all major interfaces that used the old model to use the new model.
+ *
* Revision 1.18 2003/11/18 15:07:36 pelle
* Changes to JCE Implementation
***************
*** 241,245 ****
import org.neuclear.commons.crypto.CryptoException;
import org.neuclear.commons.crypto.CryptoTools;
- import org.neuclear.id.builders.NamedObjectBuilder;
import org.neuclear.id.resolver.NSResolver;
import org.neuclear.senders.Sender;
--- 250,253 ----
***************
*** 289,294 ****
*/
! protected Identity(String name, Identity signatory, Timestamp timestamp, String digest, String repository, String signer, String logger, String receiver, PublicKey pub) throws NeuClearException {
! super(name, signatory, timestamp, digest);
this.repository = repository;
this.logger = logger;
--- 297,302 ----
*/
! protected Identity(String name, Identity signatory, Timestamp timestamp, String encoded, String repository, String signer, String logger, String receiver, PublicKey pub) throws NeuClearException {
! super(name, signatory, timestamp, encoded);
this.repository = repository;
this.logger = logger;
***************
*** 311,315 ****
}
! public SignedNamedObject send(NamedObjectBuilder obj) throws NeuClearException {
if (!Utility.isEmpty(receiver))
return Sender.quickSend(receiver, obj);
--- 319,323 ----
}
! public SignedNamedObject send(SignedNamedObject obj) throws NeuClearException {
if (!Utility.isEmpty(receiver))
return Sender.quickSend(receiver, obj);
***************
*** 318,322 ****
}
! void log(NamedObjectBuilder obj) throws NeuClearException {
if (!Utility.isEmpty(logger))
Sender.quickSend(logger, obj);
--- 326,330 ----
}
! void log(SignedNamedObject obj) throws NeuClearException {
if (!Utility.isEmpty(logger))
Sender.quickSend(logger, obj);
***************
*** 356,369 ****
public static final Identity NEUROOT = createRootIdentity();
! public final Certificate[] getCertificateChain(){
! ArrayList certs=new ArrayList(3);
! Identity id=this;
! while(id!=null ||id.getName().equals("neu://")) {
certs.add(id.getCertificate());
! id=id.getSignatory();
}
certs.add(NEUROOT);
certs.trimToSize();
! return (Certificate[])certs.toArray();
}
--- 364,377 ----
public static final Identity NEUROOT = createRootIdentity();
! public final Certificate[] getCertificateChain() {
! ArrayList certs = new ArrayList(3);
! Identity id = this;
! while (id != null || id.getName().equals("neu://")) {
certs.add(id.getCertificate());
! id = id.getSignatory();
}
certs.add(NEUROOT);
certs.trimToSize();
! return (Certificate[]) certs.toArray();
}
***************
*** 391,395 ****
*/
public byte[] getEncoded() throws CertificateEncodingException {
! return getName().getBytes();
}
--- 399,403 ----
*/
public byte[] getEncoded() throws CertificateEncodingException {
! return getEncoded();
}
***************
*** 433,437 ****
* @return
*/
! public SignedNamedObject read(Element elem, String name, Identity signatory, String digest, Timestamp timestamp) throws XMLSecurityException, NeuClearException {
String repository = elem.attributeValue(DocumentHelper.createQName("repository", NSTools.NS_NEUID));
String signer = elem.attributeValue(DocumentHelper.createQName("signer", NSTools.NS_NEUID));
--- 441,445 ----
* @return
*/
! public SignedNamedObject read(Element elem, String name, Identity signatory, String encoded, Timestamp timestamp) throws XMLSecurityException, NeuClearException {
String repository = elem.attributeValue(DocumentHelper.createQName("repository", NSTools.NS_NEUID));
String signer = elem.attributeValue(DocumentHelper.createQName("signer", NSTools.NS_NEUID));
***************
*** 442,446 ****
KeyInfo ki = new KeyInfo(allowElement.element(XMLSecTools.createQName("KeyInfo")));
PublicKey pub = ki.getPublicKey();
! return new Identity(name, signatory, timestamp, digest, repository, signer, logger, receiver, pub);
}
--- 450,454 ----
KeyInfo ki = new KeyInfo(allowElement.element(XMLSecTools.createQName("KeyInfo")));
PublicKey pub = ki.getPublicKey();
! return new Identity(name, signatory, timestamp, encoded, repository, signer, logger, receiver, pub);
}
Index: NamedObjectReader.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/NamedObjectReader.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** NamedObjectReader.java 11 Nov 2003 21:18:43 -0000 1.3
--- NamedObjectReader.java 19 Nov 2003 23:33:59 -0000 1.4
***************
*** 27,30 ****
--- 27,39 ----
$Id$
$Log$
+ Revision 1.4 2003/11/19 23:33:59 pelle
+ Signers now can generatekeys via the generateKey() method.
+ Refactored the relationship between SignedNamedObject and NamedObjectBuilder a bit.
+ SignedNamedObject now contains the full xml which is returned with getEncoded()
+ This means that it is now possible to further send on or process a SignedNamedObject, leaving
+ NamedObjectBuilder for its original purposes of purely generating new Contracts.
+ NamedObjectBuilder.sign() now returns a SignedNamedObject which is the prefered way of processing it.
+ Updated all major interfaces that used the old model to use the new model.
+
Revision 1.3 2003/11/11 21:18:43 pelle
Further vital reshuffling.
***************
*** 50,54 ****
/**
- *
* User: pelleb
* Date: Sep 23, 2003
--- 59,62 ----
***************
*** 59,65 ****
/**
* Read object from Element and fill in its details
! * @param elem
! * @return
*/
! public SignedNamedObject read(Element elem,String name,Identity signatory,String digest,Timestamp timestamp) throws NeuClearException, XMLSecurityException;
}
--- 67,74 ----
/**
* Read object from Element and fill in its details
! *
! * @param elem
! * @return
*/
! public SignedNamedObject read(Element elem, String name, Identity signatory, String encoded, Timestamp timestamp) throws NeuClearException, XMLSecurityException;
}
Index: SignatureRequest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/SignatureRequest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** SignatureRequest.java 18 Nov 2003 00:01:55 -0000 1.3
--- SignatureRequest.java 19 Nov 2003 23:33:59 -0000 1.4
***************
*** 30,33 ****
--- 30,42 ----
$Id$
$Log$
+ Revision 1.4 2003/11/19 23:33:59 pelle
+ Signers now can generatekeys via the generateKey() method.
+ Refactored the relationship between SignedNamedObject and NamedObjectBuilder a bit.
+ SignedNamedObject now contains the full xml which is returned with getEncoded()
+ This means that it is now possible to further send on or process a SignedNamedObject, leaving
+ NamedObjectBuilder for its original purposes of purely generating new Contracts.
+ NamedObjectBuilder.sign() now returns a SignedNamedObject which is the prefered way of processing it.
+ Updated all major interfaces that used the old model to use the new model.
+
Revision 1.3 2003/11/18 00:01:55 pelle
The sample signing web application for logging in and out is now working.
***************
*** 55,60 ****
*/
public class SignatureRequest extends SignedNamedObject {
! private SignatureRequest(String name, Identity signer, Timestamp timestamp, String digest, String userid, NamedObjectBuilder unsigned, String description) throws NeuClearException {
! super(name, signer, timestamp, digest);
this.userid = userid;
this.unsigned = unsigned;
--- 64,69 ----
*/
public class SignatureRequest extends SignedNamedObject {
! private SignatureRequest(String name, Identity signer, Timestamp timestamp, String encoded, String userid, NamedObjectBuilder unsigned, String description) throws NeuClearException {
! super(name, signer, timestamp, encoded);
this.userid = userid;
this.unsigned = unsigned;
Index: SignedNamedObject.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/SignedNamedObject.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** SignedNamedObject.java 11 Nov 2003 21:18:43 -0000 1.9
--- SignedNamedObject.java 19 Nov 2003 23:33:59 -0000 1.10
***************
*** 2,5 ****
--- 2,14 ----
* $Id$
* $Log$
+ * Revision 1.10 2003/11/19 23:33:59 pelle
+ * Signers now can generatekeys via the generateKey() method.
+ * Refactored the relationship between SignedNamedObject and NamedObjectBuilder a bit.
+ * SignedNamedObject now contains the full xml which is returned with getEncoded()
+ * This means that it is now possible to further send on or process a SignedNamedObject, leaving
+ * NamedObjectBuilder for its original purposes of purely generating new Contracts.
+ * NamedObjectBuilder.sign() now returns a SignedNamedObject which is the prefered way of processing it.
+ * Updated all major interfaces that used the old model to use the new model.
+ *
* Revision 1.9 2003/11/11 21:18:43 pelle
* Further vital reshuffling.
***************
*** 179,182 ****
--- 188,192 ----
import org.dom4j.Element;
import org.neuclear.commons.NeuClearException;
+ import org.neuclear.commons.crypto.CryptoTools;
import java.sql.Timestamp;
***************
*** 195,199 ****
* SignedNamedObject should have a corresponding subclass of NamedObjectBuilder.<p>
* These NamedObjectBuilder objects should be signed using your Signer, before being sent on to a web service.
! *
* @see NamedObjectReader
* @see org.neuclear.id.builders.NamedObjectBuilder
--- 205,209 ----
* SignedNamedObject should have a corresponding subclass of NamedObjectBuilder.<p>
* These NamedObjectBuilder objects should be signed using your Signer, before being sent on to a web service.
! *
* @see NamedObjectReader
* @see org.neuclear.id.builders.NamedObjectBuilder
***************
*** 205,213 ****
public class SignedNamedObject implements SignedObject, Named {
! protected SignedNamedObject(String name, Identity signer, Timestamp timestamp, String digest) throws NeuClearException {
this.name = NSTools.normalizeNameURI(name);
this.signer = signer;
this.timestamp = timestamp;
! this.digest = digest;
}
--- 215,223 ----
public class SignedNamedObject implements SignedObject, Named {
! protected SignedNamedObject(String name, Identity signer, Timestamp timestamp, String encoded) throws NeuClearException {
this.name = NSTools.normalizeNameURI(name);
this.signer = signer;
this.timestamp = timestamp;
! this.encoded = encoded;
}
***************
*** 223,232 ****
/**
* The Name of an object within it's parent Identity
! * <p>
* eg.:<pre>
* getName() = "neu://test/hello"
* getLocalName() = "hello":
* </pre>
! * @return Name
*/
public String getLocalName() {
--- 233,243 ----
/**
* The Name of an object within it's parent Identity
! * <p/>
* eg.:<pre>
* getName() = "neu://test/hello"
* getLocalName() = "hello":
* </pre>
! *
! * @return Name
*/
public String getLocalName() {
***************
*** 239,243 ****
/**
* The time the object was signed
! * @return
*/
public Timestamp getTimeStamp() {
--- 250,255 ----
/**
* The time the object was signed
! *
! * @return
*/
public Timestamp getTimeStamp() {
***************
*** 257,266 ****
/**
! * The SHA1 Digest of the original xml signed document
*
* @return
*/
! public String getDigest() {
! return digest;
}
--- 269,282 ----
/**
! * The original xml document
*
* @return
*/
! public final String getEncoded() {
! return encoded;
! }
!
! public final byte[] getDigest() {
! return CryptoTools.digest(encoded.getBytes());
}
***************
*** 268,272 ****
private final Identity signer;
private final Timestamp timestamp;
! private final String digest;
final public static class Reader implements NamedObjectReader {
--- 284,288 ----
private final Identity signer;
private final Timestamp timestamp;
! private final String encoded;
final public static class Reader implements NamedObjectReader {
***************
*** 277,283 ****
* @return
*/
! public SignedNamedObject read(Element elem, String name, Identity signatory, String digest, Timestamp timestamp) throws NeuClearException {
! return new SignedNamedObject(name, signatory, timestamp, digest);
}
--- 293,299 ----
* @return
*/
! public SignedNamedObject read(Element elem, String name, Identity signatory, String encoded, Timestamp timestamp) throws NeuClearException {
! return new SignedNamedObject(name, signatory, timestamp, encoded);
}
Index: SignedObject.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/SignedObject.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SignedObject.java 21 Oct 2003 22:31:13 -0000 1.2
--- SignedObject.java 19 Nov 2003 23:33:59 -0000 1.3
***************
*** 1,4 ****
--- 1,13 ----
/* $Id$
* $Log$
+ * Revision 1.3 2003/11/19 23:33:59 pelle
+ * Signers now can generatekeys via the generateKey() method.
+ * Refactored the relationship between SignedNamedObject and NamedObjectBuilder a bit.
+ * SignedNamedObject now contains the full xml which is returned with getEncoded()
+ * This means that it is now possible to further send on or process a SignedNamedObject, leaving
+ * NamedObjectBuilder for its original purposes of purely generating new Contracts.
+ * NamedObjectBuilder.sign() now returns a SignedNamedObject which is the prefered way of processing it.
+ * Updated all major interfaces that used the old model to use the new model.
+ *
* Revision 1.2 2003/10/21 22:31:13 pelle
* Renamed NeudistException to NeuClearException and moved it to org.neuclear.commons where it makes more sense.
***************
*** 18,22 ****
* The AbstractElementProxy has a new final method .asXML()
* which is similar to DOM4J's but it outputs the xml in the compact format and not the pretty format, thus not causing problems with Canonicalization.
! * You can now also easily get the digest of a SignedElement with the new .getDigest() value.
*
* Revision 1.2 2003/02/08 18:48:37 pelle
--- 27,31 ----
* The AbstractElementProxy has a new final method .asXML()
* which is similar to DOM4J's but it outputs the xml in the compact format and not the pretty format, thus not causing problems with Canonicalization.
! * You can now also easily get the digest of a SignedElement with the new .getEncoded() value.
*
* Revision 1.2 2003/02/08 18:48:37 pelle
***************
*** 80,91 ****
*/
- import org.neuclear.commons.NeuClearException;
-
! public interface SignedObject {
Identity getSignatory();
! String getDigest();
}
--- 89,98 ----
*/
! public interface SignedObject {
Identity getSignatory();
! String getEncoded();
}
|