|
From: <pe...@us...> - 2003-11-21 04:44:34
|
Update of /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/transforms In directory sc8-pr-cvs1:/tmp/cvs-serv10728/src/java/org/neuclear/xml/transforms Modified Files: ClearTransform.java DropSignatureTransform.java OpaqueTransform.java Transform.java TransformerFactory.java XMLTransformNotFoundException.java XPathTransform.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: ClearTransform.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/transforms/ClearTransform.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ClearTransform.java 11 Nov 2003 16:33:24 -0000 1.1.1.1 --- ClearTransform.java 21 Nov 2003 04:44:30 -0000 1.2 *************** *** 7,10 **** --- 7,16 ---- * $Id$ * $Log$ + * Revision 1.2 2003/11/21 04:44:30 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.1.1.1 2003/11/11 16:33:24 pelle * Moved over from neudist.org *************** *** 31,36 **** import org.neuclear.xml.xmlsec.XMLSecurityException; ! public class ClearTransform extends Transform { ! public Object transformNode(Object in) { return in; } --- 37,42 ---- import org.neuclear.xml.xmlsec.XMLSecurityException; ! public final class ClearTransform extends Transform { ! public final Object transformNode(final Object in) { return in; } *************** *** 40,44 **** } ! public ClearTransform(Element elem) throws XMLSecurityException { super(elem); } --- 46,50 ---- } ! public ClearTransform(final Element elem) throws XMLSecurityException { super(elem); } Index: DropSignatureTransform.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/transforms/DropSignatureTransform.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** DropSignatureTransform.java 11 Nov 2003 16:33:24 -0000 1.1.1.1 --- DropSignatureTransform.java 21 Nov 2003 04:44:30 -0000 1.2 *************** *** 7,10 **** --- 7,16 ---- * $Id$ * $Log$ + * Revision 1.2 2003/11/21 04:44:30 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.1.1.1 2003/11/11 16:33:24 pelle * Moved over from neudist.org *************** *** 35,55 **** import java.util.ListIterator; ! public class DropSignatureTransform extends Transform{ public DropSignatureTransform() { super(ALGORITHM); } ! public DropSignatureTransform(Element elem) throws XMLSecurityException { super(elem); } ! public Object transformNode(Object in) { if (in instanceof Document){ transformNode(((Document)in).getRootElement()); } else if (in instanceof Element){ ! ListIterator iter=((Branch)in).content().listIterator(); while(iter.hasNext()) { ! Node node=(Node)iter.next(); if ((node instanceof Element)&&(((Element)node).getQName().equals(subject)) ) iter.remove(); --- 41,61 ---- import java.util.ListIterator; ! public final class DropSignatureTransform extends Transform{ public DropSignatureTransform() { super(ALGORITHM); } ! public DropSignatureTransform(final Element elem) throws XMLSecurityException { super(elem); } ! public final Object transformNode(final Object in) { if (in instanceof Document){ transformNode(((Document)in).getRootElement()); } else if (in instanceof Element){ ! final ListIterator iter=((Branch)in).content().listIterator(); while(iter.hasNext()) { ! final Node node=(Node)iter.next(); if ((node instanceof Element)&&(((Element)node).getQName().equals(subject)) ) iter.remove(); Index: OpaqueTransform.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/transforms/OpaqueTransform.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** OpaqueTransform.java 11 Nov 2003 16:33:24 -0000 1.1.1.1 --- OpaqueTransform.java 21 Nov 2003 04:44:30 -0000 1.2 *************** *** 7,10 **** --- 7,16 ---- * $Id$ * $Log$ + * Revision 1.2 2003/11/21 04:44:30 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.1.1.1 2003/11/11 16:33:24 pelle * Moved over from neudist.org *************** *** 31,36 **** import org.neuclear.xml.xmlsec.XMLSecurityException; ! public class OpaqueTransform extends Transform { ! public Object transformNode(Object in) { return null; } --- 37,42 ---- import org.neuclear.xml.xmlsec.XMLSecurityException; ! public final class OpaqueTransform extends Transform { ! public final Object transformNode(final Object in) { return null; } *************** *** 40,44 **** } ! public OpaqueTransform(Element elem) throws XMLSecurityException { super(elem); } --- 46,50 ---- } ! public OpaqueTransform(final Element elem) throws XMLSecurityException { super(elem); } Index: Transform.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/transforms/Transform.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Transform.java 11 Nov 2003 16:33:24 -0000 1.1.1.1 --- Transform.java 21 Nov 2003 04:44:30 -0000 1.2 *************** *** 14,23 **** */ public abstract class Transform extends AbstractXMLSigElement { ! public Transform(String algorithm) { super(TAG_NAME); getElement().addAttribute("Algorithm",algorithm); } ! public Transform(Element elem) throws XMLSecurityException { super(elem); } --- 14,23 ---- */ public abstract class Transform extends AbstractXMLSigElement { ! public Transform(final String algorithm) { super(TAG_NAME); getElement().addAttribute("Algorithm",algorithm); } ! public Transform(final Element elem) throws XMLSecurityException { super(elem); } *************** *** 26,33 **** public abstract Object transformNode(Object in); ! public String getTagName() { return TAG_NAME; } ! private static String TAG_NAME="Transform"; } --- 26,33 ---- public abstract Object transformNode(Object in); ! public final String getTagName() { return TAG_NAME; } ! private static final String TAG_NAME="Transform"; } Index: TransformerFactory.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/transforms/TransformerFactory.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** TransformerFactory.java 11 Nov 2003 16:33:23 -0000 1.1.1.1 --- TransformerFactory.java 21 Nov 2003 04:44:30 -0000 1.2 *************** *** 18,31 **** public final class TransformerFactory { ! public static final Transform make(Element elem) throws XMLTransformNotFoundException{ if (elem==null) throw new XMLTransformNotFoundException("The Transform element was emtpy"); ! String name=elem.attributeValue("Algorithm"); ! Class imp=(Class)instance().implementations.get(name); if (imp==null) throw new XMLTransformNotFoundException("The Transform: "+name+" wasnt found"); ! Class params[]= new Class[] { Element.class}; try { ! Constructor constructor=imp.getConstructor(params); return (Transform)constructor.newInstance(new Element[] {elem}); } catch (NoSuchMethodException e) { --- 18,31 ---- public final class TransformerFactory { ! public static final Transform make(final Element elem) throws XMLTransformNotFoundException{ if (elem==null) throw new XMLTransformNotFoundException("The Transform element was emtpy"); ! final String name=elem.attributeValue("Algorithm"); ! final Class imp=(Class)instance().implementations.get(name); if (imp==null) throw new XMLTransformNotFoundException("The Transform: "+name+" wasnt found"); ! final Class[] params= new Class[] { Element.class}; try { ! final Constructor constructor=imp.getConstructor(params); return (Transform)constructor.newInstance(new Element[] {elem}); } catch (NoSuchMethodException e) { *************** *** 43,48 **** return null; } ! public static final Transform make(String algorithm) throws XMLTransformNotFoundException { ! Class imp=(Class)instance().implementations.get(algorithm); if (imp==null) { --- 43,48 ---- return null; } ! public static final Transform make(final String algorithm) throws XMLTransformNotFoundException { ! final Class imp=(Class)instance().implementations.get(algorithm); if (imp==null) { *************** *** 64,68 **** } ! public static final void registerTransformer(String algorithm, Class implementation) { instance().implementations.put(algorithm,implementation); } --- 64,68 ---- } ! public static final void registerTransformer(final String algorithm, final Class implementation) { instance().implementations.put(algorithm,implementation); } *************** *** 83,92 **** return singleton; } ! private HashMap implementations; private static TransformerFactory singleton; // This is just to make sure that they register themselves ! private static Class touch=DropSignatureTransform.class; ! { touch=Canonicalizer.class; touch=CanonicalizerWithComments.class; --- 83,92 ---- return singleton; } ! private final HashMap implementations; private static TransformerFactory singleton; // This is just to make sure that they register themselves ! static { ! Class touch=DropSignatureTransform.class; touch=Canonicalizer.class; touch=CanonicalizerWithComments.class; Index: XMLTransformNotFoundException.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/transforms/XMLTransformNotFoundException.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** XMLTransformNotFoundException.java 11 Nov 2003 16:33:24 -0000 1.1.1.1 --- XMLTransformNotFoundException.java 21 Nov 2003 04:44:30 -0000 1.2 *************** *** 9,12 **** --- 9,18 ---- * $Id$ * $Log$ + * Revision 1.2 2003/11/21 04:44:30 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.1.1.1 2003/11/11 16:33:24 pelle * Moved over from neudist.org *************** *** 22,35 **** import org.neuclear.xml.xmlsec.XMLSecurityException; ! public class XMLTransformNotFoundException extends XMLSecurityException { ! public XMLTransformNotFoundException(String message) { super(message); } ! public XMLTransformNotFoundException(String message, Throwable t) { super(message, t); } ! public XMLTransformNotFoundException(Throwable t) { super(t); } --- 28,41 ---- import org.neuclear.xml.xmlsec.XMLSecurityException; ! public final class XMLTransformNotFoundException extends XMLSecurityException { ! public XMLTransformNotFoundException(final String message) { super(message); } ! public XMLTransformNotFoundException(final String message, final Throwable t) { super(message, t); } ! public XMLTransformNotFoundException(final Throwable t) { super(t); } Index: XPathTransform.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/transforms/XPathTransform.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** XPathTransform.java 11 Nov 2003 16:33:24 -0000 1.1.1.1 --- XPathTransform.java 21 Nov 2003 04:44:30 -0000 1.2 *************** *** 21,34 **** super(ALGORITHM); } ! public XPathTransform(String xpath) { super(ALGORITHM); // this.xpath=xpath; setXPath(xpath); ! Element xpElem=getElement().addElement("XPath"); xpElem.setText(xpath); xpElem.addAttribute("xmlns:dsig","&dsig;"); } ! private void setXPath(String xpath) { // XPathFilter=DocumentHelper.createXPath(xpath); xpathFilter=DocumentHelper.createXPath(xpath); --- 21,34 ---- super(ALGORITHM); } ! public XPathTransform(final String xpath) { super(ALGORITHM); // this.xpath=xpath; setXPath(xpath); ! final Element xpElem=getElement().addElement("XPath"); xpElem.setText(xpath); xpElem.addAttribute("xmlns:dsig","&dsig;"); } ! private void setXPath(final String xpath) { // XPathFilter=DocumentHelper.createXPath(xpath); xpathFilter=DocumentHelper.createXPath(xpath); *************** *** 43,56 **** } ! public XPathTransform(Element elem) throws XMLSecurityException { super(elem); ! Element xpElement=elem.element("XPath"); if (xpElement==null) throw new XMLSecurityException("XPath Element not found in Tranform"); ! String xpath=xpElement.getTextTrim(); setXPath(xpath); } ! public Object transformNode(Object in) { // XPath needs a document. So if element doesnt have one we add it. if (in instanceof Element){ --- 43,56 ---- } ! public XPathTransform(final Element elem) throws XMLSecurityException { super(elem); ! final Element xpElement=elem.element("XPath"); if (xpElement==null) throw new XMLSecurityException("XPath Element not found in Tranform"); ! final String xpath=xpElement.getTextTrim(); setXPath(xpath); } ! public final Object transformNode(final Object in) { // XPath needs a document. So if element doesnt have one we add it. if (in instanceof Element){ *************** *** 70,74 **** if (iter!=null) { while (iter.hasNext()) { ! Node node = (Node) iter.next(); if (transformNode(node)==null) iter.remove(); --- 70,74 ---- if (iter!=null) { while (iter.hasNext()) { ! final Node node = (Node) iter.next(); if (transformNode(node)==null) iter.remove(); *************** *** 77,81 **** return in; } ! public boolean matches(Node node){ return xpathFilter.matches(node); } --- 77,81 ---- return in; } ! public final boolean matches(final Node node){ return xpathFilter.matches(node); } |