Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders
In directory sc8-pr-cvs1:/tmp/cvs-serv10855/src/java/org/neuclear/id/builders
Modified Files:
AuthenticationTicketBuilder.java IdentityBuilder.java
NamedObjectBuilder.java SignatureRequestBuilder.java
TargetReference.java
Log Message:
EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
Otherwise You will Finaliate.
Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
This should hopefully make everything more stable (and secure).
Index: AuthenticationTicketBuilder.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders/AuthenticationTicketBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AuthenticationTicketBuilder.java 11 Nov 2003 21:18:42 -0000 1.2
--- AuthenticationTicketBuilder.java 21 Nov 2003 04:45:10 -0000 1.3
***************
*** 31,34 ****
--- 31,40 ----
$Id$
$Log$
+ Revision 1.3 2003/11/21 04:45:10 pelle
+ EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
+ Otherwise You will Finaliate.
+ Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
+ This should hopefully make everything more stable (and secure).
+
Revision 1.2 2003/11/11 21:18:42 pelle
Further vital reshuffling.
***************
*** 48,57 ****
* Time: 11:59:58 AM
*/
! public class AuthenticationTicketBuilder extends NamedObjectBuilder {
! public AuthenticationTicketBuilder(String user, String requester, String site) throws NeuClearException {
this(user, requester, new Timestamp(new Date().getTime() + 1800000), site);
}
! public AuthenticationTicketBuilder(String user, String requester, Date validto, String site) throws NeuClearException {
super(NSTools.createUniqueNamedID(user, requester), AuthenticationTicket.TAG_NAME, AuthenticationTicket.NS_NSAUTH);
getElement().addAttribute(createQName("requester"), NSTools.normalizeNameURI(requester));
--- 54,63 ----
* Time: 11:59:58 AM
*/
! public final class AuthenticationTicketBuilder extends NamedObjectBuilder {
! public AuthenticationTicketBuilder(final String user, final String requester, final String site) throws NeuClearException {
this(user, requester, new Timestamp(new Date().getTime() + 1800000), site);
}
! public AuthenticationTicketBuilder(final String user, final String requester, final Date validto, final String site) throws NeuClearException {
super(NSTools.createUniqueNamedID(user, requester), AuthenticationTicket.TAG_NAME, AuthenticationTicket.NS_NSAUTH);
getElement().addAttribute(createQName("requester"), NSTools.normalizeNameURI(requester));
***************
*** 60,68 ****
}
! private static QName createQName(String name) {
return DocumentHelper.createQName(name, AuthenticationTicket.NS_NSAUTH);
}
! public String getTagName() {
return AuthenticationTicket.TAG_NAME;
}
--- 66,74 ----
}
! private static QName createQName(final String name) {
return DocumentHelper.createQName(name, AuthenticationTicket.NS_NSAUTH);
}
! public final String getTagName() {
return AuthenticationTicket.TAG_NAME;
}
Index: IdentityBuilder.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders/IdentityBuilder.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** IdentityBuilder.java 11 Nov 2003 21:18:42 -0000 1.7
--- IdentityBuilder.java 21 Nov 2003 04:45:10 -0000 1.8
***************
*** 2,5 ****
--- 2,11 ----
* $Id$
* $Log$
+ * Revision 1.8 2003/11/21 04:45:10 pelle
+ * EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
+ * Otherwise You will Finaliate.
+ * Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
+ * This should hopefully make everything more stable (and secure).
+ *
* Revision 1.7 2003/11/11 21:18:42 pelle
* Further vital reshuffling.
***************
*** 168,171 ****
--- 174,178 ----
import org.neuclear.id.NSTools;
import org.neuclear.commons.Utility;
+ import org.neuclear.commons.NeuClearException;
import org.neuclear.xml.XMLException;
import org.neuclear.xml.xmlsec.XMLSecTools;
***************
*** 185,189 ****
*/
! public IdentityBuilder(String name, PublicKey allow, String repository, String signer, String logger, String receiver) {
this(DocumentHelper.createQName("Identity",NSTools.NS_NEUID), name,allow,repository,signer,logger,receiver);
--- 192,196 ----
*/
! public IdentityBuilder(final String name, final PublicKey allow, final String repository, final String signer, final String logger, final String receiver) throws NeuClearException {
this(DocumentHelper.createQName("Identity",NSTools.NS_NEUID), name,allow,repository,signer,logger,receiver);
***************
*** 198,205 ****
* @param receiver URL of default receiver for namespace
*/
! protected IdentityBuilder(QName tag,String name, PublicKey allow, String repository, String signer, String logger, String receiver) {
super(name, tag);
! Element root = getElement();
// We have meaningful defaults for the following two
root.addAttribute(DocumentHelper.createQName("repository", NSTools.NS_NEUID), repository);
--- 205,212 ----
* @param receiver URL of default receiver for namespace
*/
! protected IdentityBuilder(final QName tag,final String name, final PublicKey allow, final String repository, final String signer, final String logger, final String receiver) throws NeuClearException {
super(name, tag);
! final Element root = getElement();
// We have meaningful defaults for the following two
root.addAttribute(DocumentHelper.createQName("repository", NSTools.NS_NEUID), repository);
***************
*** 212,241 ****
if (allow != null) {
! QName allowName = DocumentHelper.createQName("allow", NSTools.NS_NEUID);
! Element pub = root.addElement(allowName);
pub.add(XMLSecTools.createKeyInfo(allow));
}
}
! public IdentityBuilder(String name, PublicKey allow, String repository) throws XMLSecurityException {
this(name, allow, repository, null, null, null);
}
! public IdentityBuilder(String name, PublicKey allow) throws XMLSecurityException {
this(name, allow, null);
}
! public String getTagName() {
return "Identity";
}
! public static void main(String args[]) {
System.out.println("Test Building NeuClear Identities");
try {
! NamedObjectBuilder id = new IdentityBuilder("neu://", Identity.NEUROOT.getPublicKey());
System.out.println(new String(id.canonicalize()));
} catch (XMLException e) {
e.printStackTrace();
}
}
--- 219,250 ----
if (allow != null) {
! final QName allowName = DocumentHelper.createQName("allow", NSTools.NS_NEUID);
! final Element pub = root.addElement(allowName);
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);
}
! public IdentityBuilder(final String name, final PublicKey allow) throws XMLSecurityException, NeuClearException {
this(name, allow, null);
}
! public final String getTagName() {
return "Identity";
}
! public static void main(final String[] args) {
System.out.println("Test Building NeuClear Identities");
try {
! final NamedObjectBuilder id = new IdentityBuilder("neu://", Identity.NEUROOT.getPublicKey());
System.out.println(new String(id.canonicalize()));
} catch (XMLException e) {
e.printStackTrace();
+ } catch (NeuClearException e) {
+ e.printStackTrace(); //TODO Handle exception
}
}
Index: NamedObjectBuilder.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders/NamedObjectBuilder.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** NamedObjectBuilder.java 20 Nov 2003 23:42:24 -0000 1.10
--- NamedObjectBuilder.java 21 Nov 2003 04:45:10 -0000 1.11
***************
*** 2,5 ****
--- 2,11 ----
* $Id$
* $Log$
+ * Revision 1.11 2003/11/21 04:45:10 pelle
+ * EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
+ * Otherwise You will Finaliate.
+ * Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
+ * This should hopefully make everything more stable (and secure).
+ *
* Revision 1.10 2003/11/20 23:42:24 pelle
* Getting all the tests to work in id
***************
*** 192,196 ****
*/
public class NamedObjectBuilder extends SignedElement implements Named {
! public NamedObjectBuilder(String name, String tagName, String prefix, String nsURI) {
super(tagName, prefix, nsURI);
createDocument();
--- 198,202 ----
*/
public class NamedObjectBuilder extends SignedElement implements Named {
! public NamedObjectBuilder(final String name, final String tagName, final String prefix, final String nsURI) throws NeuClearException {
super(tagName, prefix, nsURI);
createDocument();
***************
*** 198,202 ****
}
! public NamedObjectBuilder(String name, String tagName, Namespace ns) {
super(tagName, ns);
createDocument();
--- 204,208 ----
}
! public NamedObjectBuilder(final String name, final String tagName, final Namespace ns) throws NeuClearException {
super(tagName, ns);
createDocument();
***************
*** 204,208 ****
}
! public NamedObjectBuilder(String name, String tagName) {
super(tagName, NSTools.NS_NEUID);
createDocument();
--- 210,214 ----
}
! public NamedObjectBuilder(final String name, final String tagName) throws NeuClearException {
super(tagName, NSTools.NS_NEUID);
createDocument();
***************
*** 210,214 ****
}
! public NamedObjectBuilder(String name, QName qname) {
super(qname);
createDocument();
--- 216,220 ----
}
! public NamedObjectBuilder(final String name, final QName qname) throws NeuClearException {
super(qname);
createDocument();
***************
*** 216,224 ****
}
! public NamedObjectBuilder(Element elem) throws XMLSecurityException {
super(elem);
//TODO Load targets
}
public String getTagName() {
if (getElement() == null)
--- 222,235 ----
}
! public NamedObjectBuilder(final Element elem) throws XMLSecurityException {
super(elem);
//TODO Load targets
}
+
+ public NamedObjectBuilder(final Document doc) throws XMLSecurityException {
+ super(doc.getRootElement());
+ }
+
public String getTagName() {
if (getElement() == null)
***************
*** 227,235 ****
}
! public NamedObjectBuilder(Document doc) throws XMLSecurityException {
! super(doc.getRootElement());
! }
!
! final public SignedNamedObject sign(Signer signer) throws NeuClearException, XMLException {
sign(getParent().getName(), signer);
return VerifyingReader.getInstance().read(getElement());
--- 238,242 ----
}
! final public SignedNamedObject sign(final Signer signer) throws NeuClearException, XMLException {
sign(getParent().getName(), signer);
return VerifyingReader.getInstance().read(getElement());
***************
*** 241,245 ****
* @return String containing the fully qualified URI of an object
*/
! public String getName() {
return getElement().attributeValue(getNameAttrQName());
}
--- 248,252 ----
* @return String containing the fully qualified URI of an object
*/
! public final String getName() {
return getElement().attributeValue(getNameAttrQName());
}
***************
*** 250,261 ****
* @return Parent Name
*/
! public String getLocalName() {
! String fullName = getName();
! int i = fullName.lastIndexOf('/');
return fullName.substring(i + 1);
}
! private void setName(String name) {
! getElement().addAttribute(getNameAttrQName(), name);
}
--- 257,268 ----
* @return Parent Name
*/
! public final String getLocalName() {
! final String fullName = getName();
! final int i = fullName.lastIndexOf('/');
return fullName.substring(i + 1);
}
! private void setName(final String name) throws NeuClearException {
! getElement().addAttribute(getNameAttrQName(), NSTools.normalizeNameURI(name));
}
***************
*** 266,272 ****
private void createDocument() {
! Element elem = getElement();
if (elem.getDocument() == null) {
! Document doc = DocumentHelper.createDocument(elem);
}
}
--- 273,279 ----
private void createDocument() {
! final Element elem = getElement();
if (elem.getDocument() == null) {
! final Document doc = DocumentHelper.createDocument(elem);
}
}
***************
*** 282,290 ****
* @return the XML NameSpace object
*/
! public Namespace getNS() {
return NSTools.NS_NEUID;
}
! protected void addElement(NamedObjectBuilder child) throws XMLException {
addElement((AbstractElementProxy) child);
}
--- 289,297 ----
* @return the XML NameSpace object
*/
! public final Namespace getNS() {
return NSTools.NS_NEUID;
}
! protected final void addElement(final NamedObjectBuilder child) throws XMLException {
addElement((AbstractElementProxy) child);
}
***************
*** 306,313 ****
* @param target object
*/
! public void addTarget(TargetReference target) throws NeuClearException {
if (target == null)
return;
! QName targetsQN = DocumentHelper.createQName("Targets", NSTools.NS_NEUID);
Element targetsElem = getElement().element(targetsQN);
if (targetsElem == null) {
--- 313,320 ----
* @param target object
*/
! public final void addTarget(final TargetReference target) throws NeuClearException {
if (target == null)
return;
! final QName targetsQN = DocumentHelper.createQName("Targets", NSTools.NS_NEUID);
Element targetsElem = getElement().element(targetsQN);
if (targetsElem == null) {
***************
*** 330,334 ****
* @return Iterator of targets
*/
! public Iterator listTargets() throws NeuClearException {
return targetList().iterator();
}
--- 337,341 ----
* @return Iterator of targets
*/
! public final Iterator listTargets() throws NeuClearException {
return targetList().iterator();
}
***************
*** 337,347 ****
* Sends copy of object to all targets within
*/
! public void sendObject() throws NeuClearException {
System.out.println("NEUDIST: Sending Object " + getName());
if (this.isSigned()) {
! Iterator iter = listTargets();
while (iter.hasNext()) {
! TargetReference tg = ((TargetReference) iter.next());
System.out.println("NEUDIST: Sent to " + tg.getHref());
}
--- 344,354 ----
* Sends copy of object to all targets within
*/
! public final void sendObject() throws NeuClearException {
System.out.println("NEUDIST: Sending Object " + getName());
if (this.isSigned()) {
! final Iterator iter = listTargets();
while (iter.hasNext()) {
! final TargetReference tg = ((TargetReference) iter.next());
System.out.println("NEUDIST: Sent to " + tg.getHref());
}
***************
*** 351,356 ****
}
! public Timestamp getTimeStamp() throws NeuClearException {
! String timeString = getElement().attributeValue(DocumentHelper.createQName("timestamp", NSTools.NS_NEUID));
if (isSigned() && !Utility.isEmpty(timeString)) {
try {
--- 358,363 ----
}
! public final Timestamp getTimeStamp() throws NeuClearException {
! final String timeString = getElement().attributeValue(DocumentHelper.createQName("timestamp", NSTools.NS_NEUID));
if (isSigned() && !Utility.isEmpty(timeString)) {
try {
***************
*** 367,371 ****
! public Identity getParent() throws NeuClearException {
return NSResolver.resolveIdentity(NSTools.getParentNSURI(getName()));
}
--- 374,378 ----
! public final Identity getParent() throws NeuClearException {
return NSResolver.resolveIdentity(NSTools.getParentNSURI(getName()));
}
Index: SignatureRequestBuilder.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders/SignatureRequestBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SignatureRequestBuilder.java 11 Nov 2003 21:18:42 -0000 1.2
--- SignatureRequestBuilder.java 21 Nov 2003 04:45:10 -0000 1.3
***************
*** 6,9 ****
--- 6,10 ----
import org.neuclear.id.SignatureRequest;
import org.neuclear.commons.Utility;
+ import org.neuclear.commons.NeuClearException;
/*
***************
*** 27,30 ****
--- 28,37 ----
$Id$
$Log$
+ Revision 1.3 2003/11/21 04:45:10 pelle
+ EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
+ Otherwise You will Finaliate.
+ Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
+ This should hopefully make everything more stable (and secure).
+
Revision 1.2 2003/11/11 21:18:42 pelle
Further vital reshuffling.
***************
*** 44,51 ****
* Time: 12:45:14 PM
*/
! public class SignatureRequestBuilder extends NamedObjectBuilder {
! public SignatureRequestBuilder(String requestor, String userid, NamedObjectBuilder unsigned, String description) {
super(NSTools.createUniqueNamedID(requestor, userid), SignatureRequest.SIGREQUEST_TAG);
! Element unsignedElem = getElement().addElement(DocumentHelper.createQName("Unsigned", NSTools.NS_NEUID));
unsignedElem.add(unsigned.getElement());
getElement().addAttribute(DocumentHelper.createQName("userid", NSTools.NS_NEUID), userid);
--- 51,58 ----
* Time: 12:45:14 PM
*/
! public final class SignatureRequestBuilder extends NamedObjectBuilder {
! public SignatureRequestBuilder(final String requestor, final String userid, final NamedObjectBuilder unsigned, final String description) throws NeuClearException {
super(NSTools.createUniqueNamedID(requestor, userid), SignatureRequest.SIGREQUEST_TAG);
! final Element unsignedElem = getElement().addElement(DocumentHelper.createQName("Unsigned", NSTools.NS_NEUID));
unsignedElem.add(unsigned.getElement());
getElement().addAttribute(DocumentHelper.createQName("userid", NSTools.NS_NEUID), userid);
***************
*** 55,59 ****
}
! public String getTagName() {
return SignatureRequest.SIGREQUEST_TAG;
}
--- 62,66 ----
}
! public final String getTagName() {
return SignatureRequest.SIGREQUEST_TAG;
}
Index: TargetReference.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders/TargetReference.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** TargetReference.java 19 Nov 2003 23:33:59 -0000 1.5
--- TargetReference.java 21 Nov 2003 04:45:10 -0000 1.6
***************
*** 2,5 ****
--- 2,11 ----
* $Id$
* $Log$
+ * Revision 1.6 2003/11/21 04:45:10 pelle
+ * EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
+ * Otherwise You will Finaliate.
+ * Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
+ * This should hopefully make everything more stable (and secure).
+ *
* Revision 1.5 2003/11/19 23:33:59 pelle
* Signers now can generatekeys via the generateKey() method.
***************
*** 72,77 ****
import org.neuclear.xml.AbstractElementProxy;
! public class TargetReference extends AbstractElementProxy {
! public TargetReference(NamedObjectBuilder obj, Element elem) throws NeuClearException {
super(elem);
if (!elem.getName().equals(TAG_NAME))
--- 78,83 ----
import org.neuclear.xml.AbstractElementProxy;
! public final class TargetReference extends AbstractElementProxy {
! public TargetReference(final NamedObjectBuilder obj, final Element elem) throws NeuClearException {
super(elem);
if (!elem.getName().equals(TAG_NAME))
***************
*** 80,84 ****
}
! public TargetReference(NamedObjectBuilder obj, String href, String type) {
super(DocumentHelper.createQName(TAG_NAME, NSTools.NS_NEUID));
if (!Utility.isEmpty(href))
--- 86,90 ----
}
! public TargetReference(final NamedObjectBuilder obj, final String href, final String type) {
super(DocumentHelper.createQName(TAG_NAME, NSTools.NS_NEUID));
if (!Utility.isEmpty(href))
***************
*** 89,97 ****
}
! public String getHref() {
return getElement().attributeValue(DocumentHelper.createQName("href", NSTools.NS_NEUID));
}
! public String getType() {
return getElement().attributeValue(DocumentHelper.createQName("type", NSTools.NS_NEUID));
}
--- 95,103 ----
}
! public final String getHref() {
return getElement().attributeValue(DocumentHelper.createQName("href", NSTools.NS_NEUID));
}
! public final String getType() {
return getElement().attributeValue(DocumentHelper.createQName("type", NSTools.NS_NEUID));
}
***************
*** 99,107 ****
private static final String TAG_NAME = "Target";
! public String getTagName() {
return TAG_NAME;
}
! public Namespace getNS() {
return NSTools.NS_NEUID;
}
--- 105,113 ----
private static final String TAG_NAME = "Target";
! public final String getTagName() {
return TAG_NAME;
}
! public final Namespace getNS() {
return NSTools.NS_NEUID;
}
|