|
From: <pe...@us...> - 2003-12-18 17:40:35
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders
In directory sc8-pr-cvs1:/tmp/cvs-serv29659/src/java/org/neuclear/id/builders
Modified Files:
IdentityBuilder.java NamedObjectBuilder.java
Log Message:
You can now create keys that get stored with a X509 certificate in the keystore. These can be saved as well.
IdentityCreator has been modified to allow creation of keys.
Note The actual Creation of Certificates still have a problem that will be resolved later today.
Index: IdentityBuilder.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders/IdentityBuilder.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** IdentityBuilder.java 16 Dec 2003 15:04:59 -0000 1.14
--- IdentityBuilder.java 18 Dec 2003 17:40:19 -0000 1.15
***************
*** 2,5 ****
--- 2,10 ----
* $Id$
* $Log$
+ * Revision 1.15 2003/12/18 17:40:19 pelle
+ * You can now create keys that get stored with a X509 certificate in the keystore. These can be saved as well.
+ * IdentityCreator has been modified to allow creation of keys.
+ * Note The actual Creation of Certificates still have a problem that will be resolved later today.
+ *
* Revision 1.14 2003/12/16 15:04:59 pelle
* Added SignedMessage contract for signing simple textual contracts.
***************
*** 203,214 ****
import org.neuclear.commons.NeuClearException;
import org.neuclear.commons.Utility;
import org.neuclear.id.NSTools;
import org.neuclear.xml.xmlsec.XMLSecTools;
import org.neuclear.xml.xmlsec.XMLSecurityException;
import java.security.PublicKey;
public class IdentityBuilder extends NamedObjectBuilder {
-
/**
* It creates a Standard Identity document, but doesn't sign it.
--- 208,223 ----
import org.neuclear.commons.NeuClearException;
import org.neuclear.commons.Utility;
+ import org.neuclear.commons.crypto.signers.Signer;
+ import org.neuclear.commons.crypto.CryptoException;
import org.neuclear.id.NSTools;
+ import org.neuclear.id.Identity;
import org.neuclear.xml.xmlsec.XMLSecTools;
import org.neuclear.xml.xmlsec.XMLSecurityException;
+ import org.neuclear.xml.XMLException;
import java.security.PublicKey;
+ import java.security.cert.Certificate;
public class IdentityBuilder extends NamedObjectBuilder {
/**
* It creates a Standard Identity document, but doesn't sign it.
***************
*** 223,227 ****
public IdentityBuilder(final String name, final PublicKey allow, final String repository, final String signer, final String logger, final String receiver) throws NeuClearException {
this(createNEUIDQName(TAGNAME), name, allow, repository, signer, logger, receiver);
-
}
--- 232,235 ----
***************
*** 250,261 ****
createNEUIDAttribute("receiver", receiver);
! if (allow != null) {
! final QName allowName = DocumentHelper.createQName("allow", NSTools.NS_NEUID);
! final Element pub = root.addElement(allowName);
! pub.addText("\n");
! pub.add(XMLSecTools.createKeyInfo(allow));
! }
}
public IdentityBuilder(final String name, final PublicKey allow, final String repository) throws XMLSecurityException, NeuClearException {
this(name, allow, repository, null, null, null);
--- 258,265 ----
createNEUIDAttribute("receiver", receiver);
! setPublicKey(allow);
}
+
public IdentityBuilder(final String name, final PublicKey allow, final String repository) throws XMLSecurityException, NeuClearException {
this(name, allow, repository, null, null, null);
***************
*** 265,271 ****
--- 269,288 ----
this(name, allow, null);
}
+ private void setPublicKey(final PublicKey allow) {
+ if (allow != null) {
+ final QName allowName = DocumentHelper.createQName("allow", NSTools.NS_NEUID);
+ Element pub=getElement().element(allowName);
+ if (pub==null)
+ pub = getElement().addElement(allowName);
+ else
+ pub.clearContent();
+ pub.addText("\n");
+ pub.add(XMLSecTools.createKeyInfo(allow));
+ }
+ }
private static final String TAGNAME = "Identity";
+
Index: NamedObjectBuilder.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders/NamedObjectBuilder.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** NamedObjectBuilder.java 11 Dec 2003 23:57:29 -0000 1.18
--- NamedObjectBuilder.java 18 Dec 2003 17:40:19 -0000 1.19
***************
*** 2,5 ****
--- 2,10 ----
* $Id$
* $Log$
+ * Revision 1.19 2003/12/18 17:40:19 pelle
+ * You can now create keys that get stored with a X509 certificate in the keystore. These can be saved as well.
+ * IdentityCreator has been modified to allow creation of keys.
+ * Note The actual Creation of Certificates still have a problem that will be resolved later today.
+ *
* Revision 1.18 2003/12/11 23:57:29 pelle
* Trying to test the ReceiverServlet with cactus. Still no luck. Need to return a ElementProxy of some sort.
***************
*** 263,267 ****
}
! private SignedNamedObject convert() throws NeuClearException, XMLException {
return VerifyingReader.getInstance().read(getElement());
--- 268,272 ----
}
! final public SignedNamedObject convert() throws NeuClearException, XMLException {
return VerifyingReader.getInstance().read(getElement());
|