You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2011/01/27 12:11:37 UTC

svn commit: r1064079 [11/12] - in /santuario/xml-security-java/trunk/src: main/java/javax/xml/crypto/ main/java/javax/xml/crypto/dom/ main/java/javax/xml/crypto/dsig/ main/java/javax/xml/crypto/dsig/dom/ main/java/javax/xml/crypto/dsig/keyinfo/ main/ja...

Modified: santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java?rev=1064079&r1=1064078&r2=1064079&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java Thu Jan 27 11:11:33 2011
@@ -61,12 +61,12 @@ public final class DOMSignatureProperty 
     public DOMSignatureProperty(List<XMLStructure> content, String target,
                                 String id)
     {
-	if (target == null) {
-	    throw new NullPointerException("target cannot be null");
-	} else if (content == null) {
-	    throw new NullPointerException("content cannot be null");
-	} else if (content.isEmpty()) {
-	    throw new IllegalArgumentException("content cannot be empty");
+        if (target == null) {
+            throw new NullPointerException("target cannot be null");
+        } else if (content == null) {
+            throw new NullPointerException("content cannot be null");
+        } else if (content.isEmpty()) {
+            throw new IllegalArgumentException("content cannot be empty");
         } else {
             List<XMLStructure> contentCopy =
                 new ArrayList<XMLStructure>(content);
@@ -78,8 +78,8 @@ public final class DOMSignatureProperty 
             }
             this.content = Collections.unmodifiableList(contentCopy);
         }
-	this.target = target;
-	this.id = id;
+        this.target = target;
+        this.id = id;
     }
 
     /**
@@ -88,21 +88,21 @@ public final class DOMSignatureProperty 
      * @param propElem a SignatureProperty element
      */
     public DOMSignatureProperty(Element propElem) throws MarshalException {
-	// unmarshal attributes
+        // unmarshal attributes
         target = DOMUtils.getAttributeValue(propElem, "Target");
-	if (target == null) {
-	    throw new MarshalException("target cannot be null");
-	}
+        if (target == null) {
+            throw new MarshalException("target cannot be null");
+        }
         id = DOMUtils.getAttributeValue(propElem, "Id");
 
-	NodeList nodes = propElem.getChildNodes();
-	int length = nodes.getLength();
-	List<XMLStructure> content = new ArrayList<XMLStructure>(length);
-	for (int i = 0; i < length; i++) {
-	    content.add(new javax.xml.crypto.dom.DOMStructure(nodes.item(i)));
-	}
+        NodeList nodes = propElem.getChildNodes();
+        int length = nodes.getLength();
+        List<XMLStructure> content = new ArrayList<XMLStructure>(length);
+        for (int i = 0; i < length; i++) {
+            content.add(new javax.xml.crypto.dom.DOMStructure(nodes.item(i)));
+        }
         if (content.isEmpty()) {
-	    throw new MarshalException("content cannot be empty");
+            throw new MarshalException("content cannot be empty");
         } else {
             this.content = Collections.unmodifiableList(content);
         }
@@ -121,69 +121,69 @@ public final class DOMSignatureProperty 
     }
 
     public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
-	throws MarshalException
+        throws MarshalException
     {
         Document ownerDoc = DOMUtils.getOwnerDocument(parent);
         Element propElem = DOMUtils.createElement(ownerDoc, "SignatureProperty",
                                                   XMLSignature.XMLNS, dsPrefix);
 
-	// set attributes
-	DOMUtils.setAttributeID(propElem, "Id", id);
+        // set attributes
+        DOMUtils.setAttributeID(propElem, "Id", id);
         DOMUtils.setAttribute(propElem, "Target", target);
 
         // create and append any elements and mixed content
         for (XMLStructure property : content) {
-	    DOMUtils.appendChild(propElem,
+            DOMUtils.appendChild(propElem,
                 ((javax.xml.crypto.dom.DOMStructure)property).getNode());
         }
-	    
-	parent.appendChild(propElem);
+            
+        parent.appendChild(propElem);
     }
 
     @Override
     public boolean equals(Object o) {
-	if (this == o) {
+        if (this == o) {
             return true;
-	}
+        }
 
-	if (!(o instanceof SignatureProperty)) {
+        if (!(o instanceof SignatureProperty)) {
             return false;
-	}
+        }
         SignatureProperty osp = (SignatureProperty)o;
 
-	boolean idsEqual = (id == null ? osp.getId() == null
+        boolean idsEqual = (id == null ? osp.getId() == null
                                        : id.equals(osp.getId()));
 
         @SuppressWarnings("unchecked")
         List<XMLStructure> ospContent = osp.getContent();
-	return (equalsContent(ospContent) &&
-	        target.equals(osp.getTarget()) && idsEqual);
+        return (equalsContent(ospContent) &&
+                target.equals(osp.getTarget()) && idsEqual);
     }
 
     private boolean equalsContent(List<XMLStructure> otherContent) {
-	int osize = otherContent.size();
-	if (content.size() != osize) {
+        int osize = otherContent.size();
+        if (content.size() != osize) {
             return false;
-	}
+        }
         for (int i = 0; i < osize; i++) {
             XMLStructure oxs = otherContent.get(i);
             XMLStructure xs = content.get(i);
             if (oxs instanceof javax.xml.crypto.dom.DOMStructure) {
-		if (!(xs instanceof javax.xml.crypto.dom.DOMStructure)) {
+                if (!(xs instanceof javax.xml.crypto.dom.DOMStructure)) {
                     return false;
-		}
+                }
                 Node onode = ((javax.xml.crypto.dom.DOMStructure)oxs).getNode();
-		Node node = ((javax.xml.crypto.dom.DOMStructure)xs).getNode();
-		if (!DOMUtils.nodesEqual(node, onode)) {
-		    return false;
-		}
+                Node node = ((javax.xml.crypto.dom.DOMStructure)xs).getNode();
+                if (!DOMUtils.nodesEqual(node, onode)) {
+                    return false;
+                }
             } else {
-		if (!(xs.equals(oxs))) {
+                if (!(xs.equals(oxs))) {
                     return false;
-		}
+                }
             }
-	}
+        }
 
-	return true;
+        return true;
     }
 }

Modified: santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java?rev=1064079&r1=1064078&r2=1064079&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java Thu Jan 27 11:11:33 2011
@@ -73,26 +73,26 @@ public final class DOMSignedInfo extends
      *    type <code>Reference</code>
      */
     public DOMSignedInfo(CanonicalizationMethod cm, SignatureMethod sm,
-	                 List<Reference> references)
+                         List<Reference> references)
     {
         if (cm == null || sm == null || references == null) {
             throw new NullPointerException();
         }
         this.canonicalizationMethod = cm;
         this.signatureMethod = sm;
-	this.references = Collections.unmodifiableList
-	    (new ArrayList<Reference>(references));
-	if (this.references.isEmpty()) {
-	    throw new IllegalArgumentException("list of references must " +
-	        "contain at least one entry");
-	}
-	for (int i = 0, size = this.references.size(); i < size; i++) {
-	    Object obj = this.references.get(i);
-	    if (!(obj instanceof Reference)) {
-		throw new ClassCastException("list of references contains " +
-		    "an illegal type");
-	    }
-	}
+        this.references = Collections.unmodifiableList
+            (new ArrayList<Reference>(references));
+        if (this.references.isEmpty()) {
+            throw new IllegalArgumentException("list of references must " +
+                "contain at least one entry");
+        }
+        for (int i = 0, size = this.references.size(); i < size; i++) {
+            Object obj = this.references.get(i);
+            if (!(obj instanceof Reference)) {
+                throw new ClassCastException("list of references contains " +
+                    "an illegal type");
+            }
+        }
     }
 
     /**
@@ -111,7 +111,7 @@ public final class DOMSignedInfo extends
      *    type <code>Reference</code>
      */
     public DOMSignedInfo(CanonicalizationMethod cm, SignatureMethod sm, 
-	                 List<Reference> references, String id)
+                         List<Reference> references, String id)
     {
         this(cm, sm, references);
         this.id = id;
@@ -123,32 +123,32 @@ public final class DOMSignedInfo extends
      * @param siElem a SignedInfo element
      */
     public DOMSignedInfo(Element siElem, XMLCryptoContext context,
-	                 Provider provider)
+                         Provider provider)
         throws MarshalException
     {
-	localSiElem = siElem;
-	ownerDoc = siElem.getOwnerDocument();
+        localSiElem = siElem;
+        ownerDoc = siElem.getOwnerDocument();
 
         // get Id attribute, if specified
         id = DOMUtils.getAttributeValue(siElem, "Id");
 
         // unmarshal CanonicalizationMethod
-	Element cmElem = DOMUtils.getFirstChildElement(siElem);
-	canonicalizationMethod = new DOMCanonicalizationMethod(cmElem, context,
+        Element cmElem = DOMUtils.getFirstChildElement(siElem);
+        canonicalizationMethod = new DOMCanonicalizationMethod(cmElem, context,
                                                                provider);
 
         // unmarshal SignatureMethod
-	Element smElem = DOMUtils.getNextSiblingElement(cmElem);
-	signatureMethod = DOMSignatureMethod.unmarshal(smElem);
+        Element smElem = DOMUtils.getNextSiblingElement(cmElem);
+        signatureMethod = DOMSignatureMethod.unmarshal(smElem);
 
-	// unmarshal References
-	ArrayList<Reference> refList = new ArrayList<Reference>(5);
-	Element refElem = DOMUtils.getNextSiblingElement(smElem);
-	while (refElem != null) {
-	    refList.add(new DOMReference(refElem, context, provider));
-	    refElem = DOMUtils.getNextSiblingElement(refElem);
-	}
-	references = Collections.unmodifiableList(refList);
+        // unmarshal References
+        ArrayList<Reference> refList = new ArrayList<Reference>(5);
+        Element refElem = DOMUtils.getNextSiblingElement(smElem);
+        while (refElem != null) {
+            refList.add(new DOMReference(refElem, context, provider));
+            refElem = DOMUtils.getNextSiblingElement(refElem);
+        }
+        references = Collections.unmodifiableList(refList);
     }
 
     public CanonicalizationMethod getCanonicalizationMethod() {
@@ -164,96 +164,96 @@ public final class DOMSignedInfo extends
     }
 
     public List getReferences() {
-	return references;
+        return references;
     }
 
     public InputStream getCanonicalizedData() {
-	return canonData;
+        return canonData;
     }
 
     public void canonicalize(XMLCryptoContext context,ByteArrayOutputStream bos)
-	throws XMLSignatureException
+        throws XMLSignatureException
     {
-	if (context == null) {
+        if (context == null) {
             throw new NullPointerException("context cannot be null");
-	}
+        }
 
-	OutputStream os = new UnsyncBufferedOutputStream(bos);
+        OutputStream os = new UnsyncBufferedOutputStream(bos);
         try {
             os.close();
         } catch (IOException e) {
             // Impossible
         }
 
-	DOMSubTreeData subTree = new DOMSubTreeData(localSiElem, true);
+        DOMSubTreeData subTree = new DOMSubTreeData(localSiElem, true);
 
-	try {
-	    ((DOMCanonicalizationMethod) 
-		canonicalizationMethod).canonicalize(subTree, context, os);
-	} catch (TransformException te) {
-	    throw new XMLSignatureException(te);
-	}
+        try {
+            ((DOMCanonicalizationMethod) 
+                canonicalizationMethod).canonicalize(subTree, context, os);
+        } catch (TransformException te) {
+            throw new XMLSignatureException(te);
+        }
 
-	byte[] signedInfoBytes = bos.toByteArray();
+        byte[] signedInfoBytes = bos.toByteArray();
 
         // this whole block should only be done if logging is enabled
-	if (log.isLoggable(Level.FINE)) {
+        if (log.isLoggable(Level.FINE)) {
             log.log(Level.FINE, "Canonicalized SignedInfo:"); 
             StringBuffer sb = new StringBuffer(signedInfoBytes.length);
             for (int i = 0; i < signedInfoBytes.length; i++) {
                 sb.append((char)signedInfoBytes[i]);
             }
             log.log(Level.FINE, sb.toString());
-	    log.log(Level.FINE, "Data to be signed/verified:" +
+            log.log(Level.FINE, "Data to be signed/verified:" +
                     Base64.encode(signedInfoBytes));
-	}
+        }
 
-	this.canonData = new ByteArrayInputStream(signedInfoBytes);
+        this.canonData = new ByteArrayInputStream(signedInfoBytes);
     }
 
     public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
-	throws MarshalException
+        throws MarshalException
     {
         ownerDoc = DOMUtils.getOwnerDocument(parent);
-	Element siElem = DOMUtils.createElement(ownerDoc, "SignedInfo",
+        Element siElem = DOMUtils.createElement(ownerDoc, "SignedInfo",
                                                 XMLSignature.XMLNS, dsPrefix);
 
-	// create and append CanonicalizationMethod element
-	DOMCanonicalizationMethod dcm =
-	    (DOMCanonicalizationMethod)canonicalizationMethod;
-	dcm.marshal(siElem, dsPrefix, context); 
+        // create and append CanonicalizationMethod element
+        DOMCanonicalizationMethod dcm =
+            (DOMCanonicalizationMethod)canonicalizationMethod;
+        dcm.marshal(siElem, dsPrefix, context); 
 
-	// create and append SignatureMethod element
-	((DOMStructure)signatureMethod).marshal(siElem, dsPrefix, context);
+        // create and append SignatureMethod element
+        ((DOMStructure)signatureMethod).marshal(siElem, dsPrefix, context);
 
-	// create and append Reference elements
+        // create and append Reference elements
         for (Reference reference : references) {
-	    ((DOMReference)reference).marshal(siElem, dsPrefix, context);
-	}
+            ((DOMReference)reference).marshal(siElem, dsPrefix, context);
+        }
 
-	// append Id attribute
+        // append Id attribute
         DOMUtils.setAttributeID(siElem, "Id", id);
-	    
-	parent.appendChild(siElem);
-	localSiElem = siElem;
+            
+        parent.appendChild(siElem);
+        localSiElem = siElem;
     }
 
     @Override
     public boolean equals(Object o) {
-	if (this == o) {
-	    return true;
-	}
-
-	if (!(o instanceof SignedInfo)) {
-	    return false;
-	}
-	SignedInfo osi = (SignedInfo)o;
+        if (this == o) {
+            return true;
+        }
+
+        if (!(o instanceof SignedInfo)) {
+            return false;
+        }
+        SignedInfo osi = (SignedInfo)o;
 
-	boolean idEqual = (id == null ? osi.getId() == null
+        boolean idEqual = (id == null ? osi.getId() == null
                                       : id.equals(osi.getId()));
 
-	return (canonicalizationMethod.equals(osi.getCanonicalizationMethod()) 
-	        && signatureMethod.equals(osi.getSignatureMethod()) && 
-	        references.equals(osi.getReferences()) && idEqual);
+        return (canonicalizationMethod.equals(osi.getCanonicalizationMethod()) 
+                && signatureMethod.equals(osi.getSignatureMethod()) && 
+                references.equals(osi.getReferences()) && idEqual);
     }
 }

Modified: santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMStructure.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMStructure.java?rev=1064079&r1=1064078&r2=1064079&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMStructure.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMStructure.java Thu Jan 27 11:11:33 2011
@@ -35,13 +35,13 @@ import org.w3c.dom.Node;
 public abstract class DOMStructure implements XMLStructure {
 
     public final boolean isFeatureSupported(String feature) {
-	if (feature == null) {
-	    throw new NullPointerException();
-	} else {
-	    return false;
-	}
+        if (feature == null) {
+            throw new NullPointerException();
+        } else {
+            return false;
+        }
     }
 
     public abstract void marshal(Node parent, String dsPrefix, 
-	DOMCryptoContext context) throws MarshalException;
+        DOMCryptoContext context) throws MarshalException;
 }

Modified: santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMSubTreeData.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMSubTreeData.java?rev=1064079&r1=1064078&r2=1064079&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMSubTreeData.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMSubTreeData.java Thu Jan 27 11:11:33 2011
@@ -44,20 +44,20 @@ public class DOMSubTreeData implements N
     private Node root;
 
     public DOMSubTreeData(Node root, boolean excludeComments) {
-	this.root = root;
-	this.excludeComments = excludeComments;
+        this.root = root;
+        this.excludeComments = excludeComments;
     }
 
     public Iterator iterator() {
-	return new DelayedNodeIterator(root, excludeComments);
+        return new DelayedNodeIterator(root, excludeComments);
     }
 
     public Node getRoot() {
-	return root;
+        return root;
     }
 
     public boolean excludeComments() {
-	return excludeComments;
+        return excludeComments;
     }
 
     /**
@@ -65,69 +65,69 @@ public class DOMSubTreeData implements N
      * not populated until the caller first attempts to advance the iterator.
      */
     static class DelayedNodeIterator implements Iterator {
-    	private Node root;
-	private List<Node> nodeSet;
-	private ListIterator<Node> li;
-	private boolean withComments;
+        private Node root;
+        private List<Node> nodeSet;
+        private ListIterator<Node> li;
+        private boolean withComments;
 
-	DelayedNodeIterator(Node root, boolean excludeComments) {
+        DelayedNodeIterator(Node root, boolean excludeComments) {
             this.root = root;
             this.withComments = !excludeComments;
-	}
+        }
 
         public boolean hasNext() {
             if (nodeSet == null) {
-		nodeSet = dereferenceSameDocumentURI(root);
-		li = nodeSet.listIterator();
+                nodeSet = dereferenceSameDocumentURI(root);
+                li = nodeSet.listIterator();
             }
-	    return li.hasNext();
+            return li.hasNext();
         }
 
         public Object next() {
             if (nodeSet == null) {
-		nodeSet = dereferenceSameDocumentURI(root);
-		li = nodeSet.listIterator();
+                nodeSet = dereferenceSameDocumentURI(root);
+                li = nodeSet.listIterator();
             }
             if (li.hasNext()) {
-		return li.next();
+                return li.next();
             } else {
                 throw new NoSuchElementException();
-	    }
+            }
         }
 
         public void remove() {
             throw new UnsupportedOperationException();
         }
 
-	/**
+        /**
          * Dereferences a same-document URI fragment.
-	 *
-	 * @param node the node (document or element) referenced by the
+         *
+         * @param node the node (document or element) referenced by the
          *	 URI fragment. If null, returns an empty set.
-	 * @return a set of nodes (minus any comment nodes)
-	 */
-	private List<Node> dereferenceSameDocumentURI(Node node) {
+         * @return a set of nodes (minus any comment nodes)
+         */
+        private List<Node> dereferenceSameDocumentURI(Node node) {
             List<Node> nodeSet = new ArrayList<Node>();
             if (node != null) {
-		nodeSetMinusCommentNodes(node, nodeSet, null);
+                nodeSetMinusCommentNodes(node, nodeSet, null);
             }
             return nodeSet;
-	}
+        }
 
-	/**
+        /**
          * Recursively traverses the subtree, and returns an XPath-equivalent
-	 * node-set of all nodes traversed, excluding any comment nodes,
-	 * if specified.
-	 *
+         * node-set of all nodes traversed, excluding any comment nodes,
+         * if specified.
+         *
          * @param node the node to traverse
-	 * @param nodeSet the set of nodes traversed so far
-	 * @param the previous sibling node
-	 */
-	private void nodeSetMinusCommentNodes(Node node, List<Node> nodeSet,
+         * @param nodeSet the set of nodes traversed so far
+         * @param the previous sibling node
+         */
+        private void nodeSetMinusCommentNodes(Node node, List<Node> nodeSet,
                                               Node prevSibling)
         {
             switch (node.getNodeType()) {
-		case Node.ELEMENT_NODE :
+                case Node.ELEMENT_NODE :
                     NamedNodeMap attrs = node.getAttributes();
                     if (attrs != null) {
                         for (int i = 0, len = attrs.getLength(); i < len; i++) {
@@ -135,30 +135,30 @@ public class DOMSubTreeData implements N
                         }
                     }
                     nodeSet.add(node);
-		case Node.DOCUMENT_NODE :
+                case Node.DOCUMENT_NODE :
                     Node pSibling = null;
                     for (Node child = node.getFirstChild(); child != null;
                         child = child.getNextSibling()) {
-			nodeSetMinusCommentNodes(child, nodeSet, pSibling);
+                        nodeSetMinusCommentNodes(child, nodeSet, pSibling);
                         pSibling = child;
                     }
                     break;
-		case Node.TEXT_NODE :
-		case Node.CDATA_SECTION_NODE:
+                case Node.TEXT_NODE :
+                case Node.CDATA_SECTION_NODE:
                     // emulate XPath which only returns the first node in
                     // contiguous text/cdata nodes
                     if (prevSibling != null &&
                         (prevSibling.getNodeType() == Node.TEXT_NODE ||
                          prevSibling.getNodeType() == Node.CDATA_SECTION_NODE)){			return;
                     }
-		case Node.PROCESSING_INSTRUCTION_NODE :
+                case Node.PROCESSING_INSTRUCTION_NODE :
                     nodeSet.add(node);
-	            break;
-		case Node.COMMENT_NODE:
-		    if (withComments) { 
+                    break;
+                case Node.COMMENT_NODE:
+                    if (withComments) { 
                         nodeSet.add(node);
-		    }
+                    }
             }
-	}
+        }
     }
 }

Modified: santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMTransform.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMTransform.java?rev=1064079&r1=1064078&r2=1064079&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMTransform.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMTransform.java Thu Jan 27 11:11:33 2011
@@ -52,7 +52,7 @@ public class DOMTransform extends DOMStr
      * @param spi the TransformService
      */
     public DOMTransform(TransformService spi) {
-	this.spi = spi;
+        this.spi = spi;
     }
 
     /**
@@ -67,28 +67,28 @@ public class DOMTransform extends DOMStr
         throws MarshalException
     {
         String algorithm = DOMUtils.getAttributeValue(transElem, "Algorithm");
-	try {
-	    spi = TransformService.getInstance(algorithm, "DOM");
-	} catch (NoSuchAlgorithmException e1) {
-	    try {
-	        spi = TransformService.getInstance(algorithm, "DOM", provider);
-	    } catch (NoSuchAlgorithmException e2) {
-	        throw new MarshalException(e2);
-	    }
-	}
-	try {
+        try {
+            spi = TransformService.getInstance(algorithm, "DOM");
+        } catch (NoSuchAlgorithmException e1) {
+            try {
+                spi = TransformService.getInstance(algorithm, "DOM", provider);
+            } catch (NoSuchAlgorithmException e2) {
+                throw new MarshalException(e2);
+            }
+        }
+        try {
             spi.init(new javax.xml.crypto.dom.DOMStructure(transElem), context);
-	} catch (InvalidAlgorithmParameterException iape) {
-	    throw new MarshalException(iape);
-	}
+        } catch (InvalidAlgorithmParameterException iape) {
+            throw new MarshalException(iape);
+        }
     }
 
     public final AlgorithmParameterSpec getParameterSpec() {
-	return spi.getParameterSpec();
+        return spi.getParameterSpec();
     }
 
     public final String getAlgorithm() {
-	return spi.getAlgorithm();
+        return spi.getAlgorithm();
     }
 
     /**
@@ -96,22 +96,22 @@ public class DOMTransform extends DOMStr
      * method to marshal any algorithm-specific parameters.
      */
     public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
-	throws MarshalException
+        throws MarshalException
     {
         Document ownerDoc = DOMUtils.getOwnerDocument(parent);
 
-	Element transformElem = null;
-	if (parent.getLocalName().equals("Transforms")) {
+        Element transformElem = null;
+        if (parent.getLocalName().equals("Transforms")) {
             transformElem = DOMUtils.createElement(ownerDoc, "Transform",
                                                    XMLSignature.XMLNS,
                                                    dsPrefix);
-	} else {
+        } else {
             transformElem = DOMUtils.createElement(ownerDoc,
                                                    "CanonicalizationMethod",
                                                    XMLSignature.XMLNS,
                                                    dsPrefix);
-	}
-	DOMUtils.setAttribute(transformElem, "Algorithm", getAlgorithm());
+        }
+        DOMUtils.setAttribute(transformElem, "Algorithm", getAlgorithm());
 
         spi.marshalParams(new javax.xml.crypto.dom.DOMStructure(transformElem),
                           context);
@@ -131,9 +131,9 @@ public class DOMTransform extends DOMStr
      *    executing the transform
      */
     public Data transform(Data data, XMLCryptoContext xc)
-	throws TransformException
+        throws TransformException
     {
-	return spi.transform(data, xc);
+        return spi.transform(data, xc);
     }
 
     /**
@@ -150,24 +150,24 @@ public class DOMTransform extends DOMStr
      *    executing the transform
      */
     public Data transform(Data data, XMLCryptoContext xc, OutputStream os)
-	throws TransformException
+        throws TransformException
     {
-	return spi.transform(data, xc, os);
+        return spi.transform(data, xc, os);
     }
 
     @Override
     public boolean equals(Object o) {
-	if (this == o) {
+        if (this == o) {
             return true;
-	}
+        }
 
         if (!(o instanceof Transform)) {
             return false;
-	}
+        }
         Transform otransform = (Transform)o;
 
-	return (getAlgorithm().equals(otransform.getAlgorithm()) &&
-	        DOMUtils.paramsEqual(getParameterSpec(),
+        return (getAlgorithm().equals(otransform.getAlgorithm()) &&
+                DOMUtils.paramsEqual(getParameterSpec(),
                                      otransform.getParameterSpec()));
     }
 
@@ -188,10 +188,10 @@ public class DOMTransform extends DOMStr
      *    executing the transform
      */
     Data transform(Data data, XMLCryptoContext xc, DOMSignContext context)
-	throws MarshalException, TransformException
+        throws MarshalException, TransformException
     {
         marshal(context.getParent(),
                 DOMUtils.getSignaturePrefix(context), context);
-	return transform(data, xc);
+        return transform(data, xc);
     }
 }

Modified: santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMURIDereferencer.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMURIDereferencer.java?rev=1064079&r1=1064078&r2=1064079&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMURIDereferencer.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMURIDereferencer.java Thu Jan 27 11:11:33 2011
@@ -44,55 +44,55 @@ public class DOMURIDereferencer implemen
     static final URIDereferencer INSTANCE = new DOMURIDereferencer();
 
     private DOMURIDereferencer() {
-	// need to call org.apache.xml.security.Init.init() 
+        // need to call org.apache.xml.security.Init.init() 
         // before calling any apache security code
-	Init.init();
+        Init.init();
     }
 
     public Data dereference(URIReference uriRef, XMLCryptoContext context)
-	throws URIReferenceException {
+        throws URIReferenceException {
 
-	if (uriRef == null) {
-	    throw new NullPointerException("uriRef cannot be null");
-	}
-	if (context == null) {
-	    throw new NullPointerException("context cannot be null");
-	}
+        if (uriRef == null) {
+            throw new NullPointerException("uriRef cannot be null");
+        }
+        if (context == null) {
+            throw new NullPointerException("context cannot be null");
+        }
 
-	DOMURIReference domRef = (DOMURIReference) uriRef;
+        DOMURIReference domRef = (DOMURIReference) uriRef;
         Attr uriAttr = (Attr) domRef.getHere();
-	String uri = uriRef.getURI();
+        String uri = uriRef.getURI();
         DOMCryptoContext dcc = (DOMCryptoContext) context;
 
-	// Check if same-document URI and register ID
-	if (uri != null && uri.length() != 0 && uri.charAt(0) == '#') {
+        // Check if same-document URI and register ID
+        if (uri != null && uri.length() != 0 && uri.charAt(0) == '#') {
             String id = uri.substring(1);
 
-	    if (id.startsWith("xpointer(id(")) {
-	        int i1 = id.indexOf('\'');
-	        int i2 = id.indexOf('\'', i1+1);
-		id = id.substring(i1+1, i2);
-	    }
+            if (id.startsWith("xpointer(id(")) {
+                int i1 = id.indexOf('\'');
+                int i2 = id.indexOf('\'', i1+1);
+                id = id.substring(i1+1, i2);
+            }
 
             // this is a bit of a hack to check for registered 
-	    // IDRefs and manually register them with Apache's IdResolver 
-	    // map which includes builtin schema knowledge of DSig/Enc IDs
+            // IDRefs and manually register them with Apache's IdResolver 
+            // map which includes builtin schema knowledge of DSig/Enc IDs
             Node referencedElem = dcc.getElementById(id);
-	    if (referencedElem != null) {
-	        IdResolver.registerElementById((Element) referencedElem, id);
-	    }
-	} 
+            if (referencedElem != null) {
+                IdResolver.registerElementById((Element) referencedElem, id);
+            }
+        } 
 
         try {
-	    String baseURI = context.getBaseURI();
+            String baseURI = context.getBaseURI();
             ResourceResolver apacheResolver = 
-	        ResourceResolver.getInstance(uriAttr, baseURI);
+                ResourceResolver.getInstance(uriAttr, baseURI);
             XMLSignatureInput in = apacheResolver.resolve(uriAttr, baseURI);
-	    if (in.isOctetStream()) {
-	        return new ApacheOctetStreamData(in);
-	    } else {
-	        return new ApacheNodeSetData(in);
-	    }
+            if (in.isOctetStream()) {
+                return new ApacheOctetStreamData(in);
+            } else {
+                return new ApacheNodeSetData(in);
+            }
         } catch (Exception e) {
             throw new URIReferenceException(e);
         }

Modified: santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMUtils.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMUtils.java?rev=1064079&r1=1064078&r2=1064079&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMUtils.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMUtils.java Thu Jan 27 11:11:33 2011
@@ -73,7 +73,7 @@ public class DOMUtils {
                                         String nsURI, String prefix)
     {
         String qName = (prefix == null || prefix.length() == 0)
-		       ? tag : prefix + ":" + tag;
+                       ? tag : prefix + ":" + tag;
         return doc.createElementNS(nsURI, qName);
     }
 
@@ -86,8 +86,8 @@ public class DOMUtils {
      * @param value the attribute value. If null, no attribute is set. 
      */
     public static void setAttribute(Element elem, String name, String value) {
-	if (value == null) return;
-	elem.setAttributeNS(null, name, value);
+        if (value == null) return;
+        elem.setAttributeNS(null, name, value);
     }
 
     /**
@@ -101,9 +101,9 @@ public class DOMUtils {
      * @param value the attribute value. If null, no attribute is set. 
      */
     public static void setAttributeID(Element elem, String name, String value) {
-	if (value == null) return;
-	elem.setAttributeNS(null, name, value);
-	IdResolver.registerElementById(elem, value);
+        if (value == null) return;
+        elem.setAttributeNS(null, name, value);
+        IdResolver.registerElementById(elem, value);
     }
 
     /**
@@ -184,7 +184,7 @@ public class DOMUtils {
      * @return a Set of Nodes
      */
     public static Set<Node> nodeSet(NodeList nl) {
-	return new NodeSet(nl);
+        return new NodeSet(nl);
     }
 
     static class NodeSet extends AbstractSet<Node> {
@@ -228,7 +228,7 @@ public class DOMUtils {
                 (nsURI, context.getDefaultNamespacePrefix());
         } else {
             return null;
-	}
+        }
     }
 
     /**
@@ -239,7 +239,7 @@ public class DOMUtils {
      *    null if not set
      */
     public static String getSignaturePrefix(XMLCryptoContext context) {
-	return getNSPrefix(context, XMLSignature.XMLNS);
+        return getNSPrefix(context, XMLSignature.XMLNS);
     }
     
     /**
@@ -258,14 +258,14 @@ public class DOMUtils {
      * Compares 2 nodes for equality. Implementation is not complete.
      */
     public static boolean nodesEqual(Node thisNode, Node otherNode) {
-	if (thisNode == otherNode) {
-	    return true;
-	}
-	if (thisNode.getNodeType() != otherNode.getNodeType()) {
-	    return false;
-	}
-	// FIXME - test content, etc
-	return true;
+        if (thisNode == otherNode) {
+            return true;
+        }
+        if (thisNode.getNodeType() != otherNode.getNodeType()) {
+            return false;
+        }
+        // FIXME - test content, etc
+        return true;
     }
 
     /**
@@ -274,40 +274,40 @@ public class DOMUtils {
      * if necessary.
      */
     public static void appendChild(Node parent, Node child) {
-	Document ownerDoc = getOwnerDocument(parent);
-	if (child.getOwnerDocument() != ownerDoc) {
-	    parent.appendChild(ownerDoc.importNode(child, true));
-	} else {
-	    parent.appendChild(child);
-	}
+        Document ownerDoc = getOwnerDocument(parent);
+        if (child.getOwnerDocument() != ownerDoc) {
+            parent.appendChild(ownerDoc.importNode(child, true));
+        } else {
+            parent.appendChild(child);
+        }
     }
 
     public static boolean paramsEqual(AlgorithmParameterSpec spec1,
-	AlgorithmParameterSpec spec2) {
-	if (spec1 == spec2) {
-	    return true;
-	}
-	if (spec1 instanceof XPathFilter2ParameterSpec &&
-	    spec2 instanceof XPathFilter2ParameterSpec) {
-	    return paramsEqual((XPathFilter2ParameterSpec)spec1,
-		               (XPathFilter2ParameterSpec)spec2);
-	}
-	if (spec1 instanceof ExcC14NParameterSpec &&
-	    spec2 instanceof ExcC14NParameterSpec) {
-	    return paramsEqual((ExcC14NParameterSpec) spec1,
-		               (ExcC14NParameterSpec)spec2);
-	}
-	if (spec1 instanceof XPathFilterParameterSpec &&
-	    spec2 instanceof XPathFilterParameterSpec) {
-	    return paramsEqual((XPathFilterParameterSpec)spec1,
-		               (XPathFilterParameterSpec)spec2);
-	}
-	if (spec1 instanceof XSLTTransformParameterSpec &&
-	    spec2 instanceof XSLTTransformParameterSpec) {
-	    return paramsEqual((XSLTTransformParameterSpec)spec1,
-		               (XSLTTransformParameterSpec)spec2);
-	}
-	return false;
+        AlgorithmParameterSpec spec2) {
+        if (spec1 == spec2) {
+            return true;
+        }
+        if (spec1 instanceof XPathFilter2ParameterSpec &&
+            spec2 instanceof XPathFilter2ParameterSpec) {
+            return paramsEqual((XPathFilter2ParameterSpec)spec1,
+                               (XPathFilter2ParameterSpec)spec2);
+        }
+        if (spec1 instanceof ExcC14NParameterSpec &&
+            spec2 instanceof ExcC14NParameterSpec) {
+            return paramsEqual((ExcC14NParameterSpec) spec1,
+                               (ExcC14NParameterSpec)spec2);
+        }
+        if (spec1 instanceof XPathFilterParameterSpec &&
+            spec2 instanceof XPathFilterParameterSpec) {
+            return paramsEqual((XPathFilterParameterSpec)spec1,
+                               (XPathFilterParameterSpec)spec2);
+        }
+        if (spec1 instanceof XSLTTransformParameterSpec &&
+            spec2 instanceof XSLTTransformParameterSpec) {
+            return paramsEqual((XSLTTransformParameterSpec)spec1,
+                               (XSLTTransformParameterSpec)spec2);
+        }
+        return false;
     }
 
     private static boolean paramsEqual(XPathFilter2ParameterSpec spec1,
@@ -317,7 +317,7 @@ public class DOMUtils {
         List<XPathType> types = spec1.getXPathList();
         @SuppressWarnings("unchecked")
         List<XPathType> otypes = spec2.getXPathList();
-	int size = types.size();
+        int size = types.size();
         if (size != otypes.size()) {
             return false;
         }
@@ -325,7 +325,7 @@ public class DOMUtils {
             XPathType type = types.get(i);
             XPathType otype = otypes.get(i);
             if (!type.getExpression().equals(otype.getExpression()) ||
-		!type.getNamespaceMap().equals(otype.getNamespaceMap()) ||
+                !type.getNamespaceMap().equals(otype.getNamespaceMap()) ||
                 type.getFilter() != otype.getFilter()) {
                 return false;
             }
@@ -334,20 +334,20 @@ public class DOMUtils {
     }
 
     private static boolean paramsEqual(ExcC14NParameterSpec spec1,
-	                               ExcC14NParameterSpec spec2)
+                                       ExcC14NParameterSpec spec2)
     {
         return spec1.getPrefixList().equals(spec2.getPrefixList());
     }
 
     private static boolean paramsEqual(XPathFilterParameterSpec spec1,
-	                               XPathFilterParameterSpec spec2)
+                                       XPathFilterParameterSpec spec2)
     {
         return (spec1.getXPath().equals(spec2.getXPath()) && 
-	        spec1.getNamespaceMap().equals(spec2.getNamespaceMap()));
+                spec1.getNamespaceMap().equals(spec2.getNamespaceMap()));
     }
 
     private static boolean paramsEqual(XSLTTransformParameterSpec spec1,
-	                               XSLTTransformParameterSpec spec2)
+                                       XSLTTransformParameterSpec spec2)
     {
 
         XMLStructure ostylesheet = spec2.getStylesheet();
@@ -357,7 +357,7 @@ public class DOMUtils {
         Node ostylesheetElem =
             ((javax.xml.crypto.dom.DOMStructure) ostylesheet).getNode();
         XMLStructure stylesheet = spec1.getStylesheet();        
-	Node stylesheetElem =
+        Node stylesheetElem =
             ((javax.xml.crypto.dom.DOMStructure) stylesheet).getNode();
         return nodesEqual(stylesheetElem, ostylesheetElem);
     }

Modified: santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMX509Data.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMX509Data.java?rev=1064079&r1=1064078&r2=1064079&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMX509Data.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMX509Data.java Thu Jan 27 11:11:33 2011
@@ -74,10 +74,10 @@ public final class DOMX509Data extends D
             throw new IllegalArgumentException("content cannot be empty");
         }
         for (int i = 0, size = contentCopy.size(); i < size; i++) {
-	    Object x509Type = contentCopy.get(i);
-	    if (x509Type instanceof String) {
-		new X500Principal((String)x509Type);
-	    } else if (!(x509Type instanceof byte[]) &&
+            Object x509Type = contentCopy.get(i);
+            if (x509Type instanceof String) {
+                new X500Principal((String)x509Type);
+            } else if (!(x509Type instanceof byte[]) &&
                 !(x509Type instanceof X509Certificate) &&
                 !(x509Type instanceof X509CRL) &&
                 !(x509Type instanceof XMLStructure)) {
@@ -97,17 +97,17 @@ public final class DOMX509Data extends D
     public DOMX509Data(Element xdElem) throws MarshalException {
         // get all children nodes
         NodeList nl = xdElem.getChildNodes();
-	int length = nl.getLength();
-	List<Object> content = new ArrayList<Object>(length);
+        int length = nl.getLength();
+        List<Object> content = new ArrayList<Object>(length);
         for (int i = 0; i < length; i++) {
             Node child = nl.item(i);
             // ignore all non-Element nodes
             if (child.getNodeType() != Node.ELEMENT_NODE) {
                 continue;
-	    }
+            }
 
             Element childElem = (Element)child;
-	    String localName = childElem.getLocalName();
+            String localName = childElem.getLocalName();
             if (localName.equals("X509Certificate")) {
                 content.add(unmarshalX509Certificate(childElem));
             } else if (localName.equals("X509IssuerSerial")) {
@@ -115,46 +115,46 @@ public final class DOMX509Data extends D
             } else if (localName.equals("X509SubjectName")) {
                 content.add(childElem.getFirstChild().getNodeValue());
             } else if (localName.equals("X509SKI")) {
-		try {
+                try {
                     content.add(Base64.decode(childElem));
-		} catch (Base64DecodingException bde) {
-		    throw new MarshalException("cannot decode X509SKI", bde);
-		}
+                } catch (Base64DecodingException bde) {
+                    throw new MarshalException("cannot decode X509SKI", bde);
+                }
             } else if (localName.equals("X509CRL")) {
                 content.add(unmarshalX509CRL(childElem));
             } else {
-		content.add(new javax.xml.crypto.dom.DOMStructure(childElem));
+                content.add(new javax.xml.crypto.dom.DOMStructure(childElem));
             }
         }
         this.content = Collections.unmodifiableList(content);
     }
 
     public List getContent() {
-	return content;
+        return content;
     }
 
     public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
-	throws MarshalException
+        throws MarshalException
     {
         Document ownerDoc = DOMUtils.getOwnerDocument(parent);
         Element xdElem = DOMUtils.createElement(ownerDoc, "X509Data",
                                                 XMLSignature.XMLNS, dsPrefix);
 
         // append children and preserve order
-	for (int i = 0, size = content.size(); i < size; i++) {
-	    Object object = content.get(i);
+        for (int i = 0, size = content.size(); i < size; i++) {
+            Object object = content.get(i);
             if (object instanceof X509Certificate) {
                 marshalCert((X509Certificate)object,xdElem,ownerDoc,dsPrefix);
-	    } else if (object instanceof XMLStructure) {
-	        if (object instanceof X509IssuerSerial) {
-		    ((DOMX509IssuerSerial)object).marshal
-			(xdElem, dsPrefix, context);
-		} else {
-		    javax.xml.crypto.dom.DOMStructure domContent =
-			(javax.xml.crypto.dom.DOMStructure)object;
-		    DOMUtils.appendChild(xdElem, domContent.getNode());
-		}
-	    } else if (object instanceof byte[]) {
+            } else if (object instanceof XMLStructure) {
+                if (object instanceof X509IssuerSerial) {
+                    ((DOMX509IssuerSerial)object).marshal
+                        (xdElem, dsPrefix, context);
+                } else {
+                    javax.xml.crypto.dom.DOMStructure domContent =
+                        (javax.xml.crypto.dom.DOMStructure)object;
+                    DOMUtils.appendChild(xdElem, domContent.getNode());
+                }
+            } else if (object instanceof byte[]) {
                 marshalSKI((byte[])object, xdElem, ownerDoc, dsPrefix);
             } else if (object instanceof String) {
                 marshalSubjectName((String)object, xdElem, ownerDoc,dsPrefix);
@@ -167,7 +167,7 @@ public final class DOMX509Data extends D
     }
 
     private void marshalSKI(byte[] skid, Node parent, Document doc, 
-	                    String dsPrefix)
+                            String dsPrefix)
     {
         Element skidElem = DOMUtils.createElement(doc, "X509SKI",
                                                   XMLSignature.XMLNS, dsPrefix);
@@ -176,7 +176,7 @@ public final class DOMX509Data extends D
     }
 
     private void marshalSubjectName(String name, Node parent, Document doc,
-	                            String dsPrefix)
+                                    String dsPrefix)
     {
         Element snElem = DOMUtils.createElement(doc, "X509SubjectName",
                                                 XMLSignature.XMLNS, dsPrefix);
@@ -185,7 +185,7 @@ public final class DOMX509Data extends D
     }
 
     private void marshalCert(X509Certificate cert, Node parent, Document doc,
-	                     String dsPrefix)
+                             String dsPrefix)
         throws MarshalException
     {
         Element certElem = DOMUtils.createElement(doc, "X509Certificate",
@@ -200,7 +200,7 @@ public final class DOMX509Data extends D
     }
 
     private void marshalCRL(X509CRL crl, Node parent, Document doc, 
-	                    String dsPrefix)
+                            String dsPrefix)
         throws MarshalException
     {
         Element crlElem = DOMUtils.createElement(doc, "X509CRL",
@@ -215,7 +215,7 @@ public final class DOMX509Data extends D
     }
 
     private X509Certificate unmarshalX509Certificate(Element elem) 
-	throws MarshalException
+        throws MarshalException
     {
         try {
             ByteArrayInputStream bs = unmarshalBase64Binary(elem);
@@ -235,11 +235,11 @@ public final class DOMX509Data extends D
     }
 
     private ByteArrayInputStream unmarshalBase64Binary(Element elem) 
-	throws MarshalException {
+        throws MarshalException {
         try {
             if (cf == null) {
                 cf = CertificateFactory.getInstance("X.509");
-	    }
+            }
             return new ByteArrayInputStream(Base64.decode(elem));
         } catch (CertificateException e) {
             throw new MarshalException("Cannot create CertificateFactory", e);
@@ -249,36 +249,36 @@ public final class DOMX509Data extends D
     }
 
     public boolean equals(Object o) {
-	if (this == o) {
+        if (this == o) {
             return true;
-	}
+        }
 
         if (!(o instanceof X509Data)) {
             return false;
-	}
+        }
         X509Data oxd = (X509Data)o;
 
-	@SuppressWarnings("unchecked") List<Object> ocontent = oxd.getContent();
-	int size = content.size();
-	if (size != ocontent.size()) {
-	    return false;
-	}
-
-	for (int i = 0; i < size; i++) {
-	    Object x = content.get(i);
-	    Object ox = ocontent.get(i);
-	    if (x instanceof byte[]) {
-		if (!(ox instanceof byte[]) || 
-		    !Arrays.equals((byte[])x, (byte[])ox)) {
-		    return false;
-		} 
-	    } else {
-		if (!(x.equals(ox))) {
-		    return false;
-		}
-	    }
-	}
+        @SuppressWarnings("unchecked") List<Object> ocontent = oxd.getContent();
+        int size = content.size();
+        if (size != ocontent.size()) {
+            return false;
+        }
+
+        for (int i = 0; i < size; i++) {
+            Object x = content.get(i);
+            Object ox = ocontent.get(i);
+            if (x instanceof byte[]) {
+                if (!(ox instanceof byte[]) || 
+                    !Arrays.equals((byte[])x, (byte[])ox)) {
+                    return false;
+                } 
+            } else {
+                if (!(x.equals(ox))) {
+                    return false;
+                }
+            }
+        }
 
-	return true;
+        return true;
     }
 }

Modified: santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMX509IssuerSerial.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMX509IssuerSerial.java?rev=1064079&r1=1064078&r2=1064079&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMX509IssuerSerial.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMX509IssuerSerial.java Thu Jan 27 11:11:33 2011
@@ -57,16 +57,16 @@ public final class DOMX509IssuerSerial e
      *    <code>serialNumber</code> is <code>null</code> 
      */
     public DOMX509IssuerSerial(String issuerName, BigInteger serialNumber) {
-	if (issuerName == null) {
-	    throw new NullPointerException("issuerName cannot be null");
-	}
-	if (serialNumber == null) {
-	    throw new NullPointerException("serialNumber cannot be null");
-	}
-	// check that issuer distinguished name conforms to RFC 2253
-	new X500Principal(issuerName);
-	this.issuerName = issuerName;
-	this.serialNumber = serialNumber;
+        if (issuerName == null) {
+            throw new NullPointerException("issuerName cannot be null");
+        }
+        if (serialNumber == null) {
+            throw new NullPointerException("serialNumber cannot be null");
+        }
+        // check that issuer distinguished name conforms to RFC 2253
+        new X500Principal(issuerName);
+        this.issuerName = issuerName;
+        this.serialNumber = serialNumber;
     }
 
     /**
@@ -78,19 +78,19 @@ public final class DOMX509IssuerSerial e
         Element iNElem = DOMUtils.getFirstChildElement(isElem);
         Element sNElem = DOMUtils.getNextSiblingElement(iNElem);
         issuerName = iNElem.getFirstChild().getNodeValue();
-	serialNumber = new BigInteger(sNElem.getFirstChild().getNodeValue());
+        serialNumber = new BigInteger(sNElem.getFirstChild().getNodeValue());
     }
 
     public String getIssuerName() {
-	return issuerName;
+        return issuerName;
     }
 
     public BigInteger getSerialNumber() {
-	return serialNumber;
+        return serialNumber;
     }
 
     public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
-	throws MarshalException
+        throws MarshalException
     {
         Document ownerDoc = DOMUtils.getOwnerDocument(parent);
 
@@ -109,14 +109,14 @@ public final class DOMX509IssuerSerial e
 
     @Override
     public boolean equals(Object obj) {
-	if (this == obj) {
+        if (this == obj) {
             return true;
-	}
+        }
         if (!(obj instanceof X509IssuerSerial)) {
             return false;
-	}
+        }
         X509IssuerSerial ois = (X509IssuerSerial)obj;
-	return (issuerName.equals(ois.getIssuerName()) &&
-	        serialNumber.equals(ois.getSerialNumber()));
+        return (issuerName.equals(ois.getIssuerName()) &&
+                serialNumber.equals(ois.getSerialNumber()));
     }
 }

Modified: santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java?rev=1064079&r1=1064078&r2=1064079&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java Thu Jan 27 11:11:33 2011
@@ -59,7 +59,7 @@ public final class DOMXMLObject extends 
      *    entries that are not of type {@link XMLStructure}
      */
     public DOMXMLObject(List<XMLStructure> content, String id, String mimeType,
-	                String encoding)
+                        String encoding)
     {
         if (content == null || content.isEmpty()) {
             this.content = Collections.emptyList();
@@ -74,9 +74,9 @@ public final class DOMXMLObject extends 
             }
             this.content = Collections.unmodifiableList(contentCopy);
         }
-	this.id = id;
-	this.mimeType = mimeType;
-	this.encoding = encoding;
+        this.id = id;
+        this.mimeType = mimeType;
+        this.encoding = encoding;
     }
 
     /**
@@ -86,36 +86,36 @@ public final class DOMXMLObject extends 
      * @throws MarshalException if there is an error when unmarshalling
      */
     public DOMXMLObject(Element objElem, XMLCryptoContext context,
-	                Provider provider)
+                        Provider provider)
     throws MarshalException
     {
-	// unmarshal attributes
+        // unmarshal attributes
         this.encoding = DOMUtils.getAttributeValue(objElem, "Encoding");
         this.id = DOMUtils.getAttributeValue(objElem, "Id");
         this.mimeType = DOMUtils.getAttributeValue(objElem, "MimeType");
 
-	NodeList nodes = objElem.getChildNodes();
-	int length = nodes.getLength();
-	List<XMLStructure> content = new ArrayList<XMLStructure>(length);
-	for (int i = 0; i < length; i++) {
+        NodeList nodes = objElem.getChildNodes();
+        int length = nodes.getLength();
+        List<XMLStructure> content = new ArrayList<XMLStructure>(length);
+        for (int i = 0; i < length; i++) {
             Node child = nodes.item(i);
             if (child.getNodeType() == Node.ELEMENT_NODE) {
-		Element childElem = (Element)child;
+                Element childElem = (Element)child;
                 String tag = childElem.getLocalName();
                 if (tag.equals("Manifest")) {
                     content.add(new DOMManifest(childElem, context, provider));
-		    continue;
+                    continue;
                 } else if (tag.equals("SignatureProperties")) {
                     content.add(new DOMSignatureProperties(childElem));
-		    continue;
+                    continue;
                 } else if (tag.equals("X509Data")) {
                     content.add(new DOMX509Data(childElem));
-		    continue;
-		}
-		//@@@FIXME: check for other dsig structures
-	    }
-	    content.add(new javax.xml.crypto.dom.DOMStructure(child));
-	}
+                    continue;
+                }
+                //@@@FIXME: check for other dsig structures
+            }
+            content.add(new javax.xml.crypto.dom.DOMStructure(child));
+        }
         if (content.isEmpty()) {
             this.content = Collections.emptyList();
         } else {
@@ -140,15 +140,15 @@ public final class DOMXMLObject extends 
     }
 
     public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
-	throws MarshalException {
+        throws MarshalException {
         Document ownerDoc = DOMUtils.getOwnerDocument(parent);
 
         Element objElem = DOMUtils.createElement(ownerDoc, "Object",
                                                  XMLSignature.XMLNS, dsPrefix);
 
-	// set attributes
+        // set attributes
         DOMUtils.setAttributeID(objElem, "Id", id);
-	DOMUtils.setAttribute(objElem, "MimeType", mimeType);
+        DOMUtils.setAttribute(objElem, "MimeType", mimeType);
         DOMUtils.setAttribute(objElem, "Encoding", encoding);
 
         // create and append any elements and mixed content, if necessary
@@ -156,64 +156,64 @@ public final class DOMXMLObject extends 
             if (object instanceof DOMStructure) {
                 ((DOMStructure)object).marshal(objElem, dsPrefix, context);
             } else {
-	        javax.xml.crypto.dom.DOMStructure domObject = 
-		    (javax.xml.crypto.dom.DOMStructure)object;
-		DOMUtils.appendChild(objElem, domObject.getNode());
+                javax.xml.crypto.dom.DOMStructure domObject = 
+                    (javax.xml.crypto.dom.DOMStructure)object;
+                DOMUtils.appendChild(objElem, domObject.getNode());
             }
         }
-	    
-	parent.appendChild(objElem);
+            
+        parent.appendChild(objElem);
     }
 
     @Override
     public boolean equals(Object o) {
-	if (this == o) {
+        if (this == o) {
             return true;
-	}
+        }
 
         if (!(o instanceof XMLObject)) {
             return false;
-	}
+        }
         XMLObject oxo = (XMLObject)o;
 
-	boolean idsEqual = (id == null ? oxo.getId() == null
+        boolean idsEqual = (id == null ? oxo.getId() == null
                                        : id.equals(oxo.getId()));
-	boolean encodingsEqual =
+        boolean encodingsEqual =
             (encoding == null ? oxo.getEncoding() == null
                               : encoding.equals(oxo.getEncoding()));
-	boolean mimeTypesEqual =
+        boolean mimeTypesEqual =
             (mimeType == null ? oxo.getMimeType() == null
                               : mimeType.equals(oxo.getMimeType()));
 
         @SuppressWarnings("unchecked")
         List<XMLStructure> oxoContent = oxo.getContent();
-	return (idsEqual && encodingsEqual && mimeTypesEqual && 
-	        equalsContent(oxoContent));
+        return (idsEqual && encodingsEqual && mimeTypesEqual && 
+                equalsContent(oxoContent));
     }
 
     private boolean equalsContent(List<XMLStructure> otherContent) {
-	if (content.size() != otherContent.size()) {
-	    return false;
-	}
-	for (int i = 0, osize = otherContent.size(); i < osize; i++) {
-	    XMLStructure oxs = otherContent.get(i);
-	    XMLStructure xs = content.get(i);
-	    if (oxs instanceof javax.xml.crypto.dom.DOMStructure) {
-		if (!(xs instanceof javax.xml.crypto.dom.DOMStructure)) {
-		    return false;
-		}
-		Node onode = ((javax.xml.crypto.dom.DOMStructure)oxs).getNode();
-		Node node = ((javax.xml.crypto.dom.DOMStructure)xs).getNode();
-		if (!DOMUtils.nodesEqual(node, onode)) {
-		    return false;
-		}
-	    } else {
-		if (!(xs.equals(oxs))) {
-		    return false;
-		}
-	    }
-	}
+        if (content.size() != otherContent.size()) {
+            return false;
+        }
+        for (int i = 0, osize = otherContent.size(); i < osize; i++) {
+            XMLStructure oxs = otherContent.get(i);
+            XMLStructure xs = content.get(i);
+            if (oxs instanceof javax.xml.crypto.dom.DOMStructure) {
+                if (!(xs instanceof javax.xml.crypto.dom.DOMStructure)) {
+                    return false;
+                }
+                Node onode = ((javax.xml.crypto.dom.DOMStructure)oxs).getNode();
+                Node node = ((javax.xml.crypto.dom.DOMStructure)xs).getNode();
+                if (!DOMUtils.nodesEqual(node, onode)) {
+                    return false;
+                }
+            } else {
+                if (!(xs.equals(oxs))) {
+                    return false;
+                }
+            }
+        }
 
-	return true;
+        return true;
     }
 }

Modified: santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java?rev=1064079&r1=1064078&r2=1064079&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java Thu Jan 27 11:11:33 2011
@@ -77,7 +77,7 @@ public final class DOMXMLSignature exten
     private HashMap<String, XMLStructure> signatureIdMap;
 
     static {
-	org.apache.xml.security.Init.init();
+        org.apache.xml.security.Init.init();
     }
  
     /**
@@ -124,42 +124,42 @@ public final class DOMXMLSignature exten
      * @throws MarshalException if XMLSignature cannot be unmarshalled
      */
     public DOMXMLSignature(Element sigElem, XMLCryptoContext context,
-	                   Provider provider)
+                           Provider provider)
         throws MarshalException
     {
         localSigElem = sigElem;
         ownerDoc = localSigElem.getOwnerDocument();
 
         // get Id attribute, if specified
-	id = DOMUtils.getAttributeValue(localSigElem, "Id");
+        id = DOMUtils.getAttributeValue(localSigElem, "Id");
 
-	// unmarshal SignedInfo
-	Element siElem = DOMUtils.getFirstChildElement(localSigElem);
-	si = new DOMSignedInfo(siElem, context, provider);
-
-	// unmarshal SignatureValue 
-	Element sigValElem = DOMUtils.getNextSiblingElement(siElem);
-	sv = new DOMSignatureValue(sigValElem);
-
-	// unmarshal KeyInfo, if specified
-	Element nextSibling = DOMUtils.getNextSiblingElement(sigValElem);
-	if (nextSibling != null && nextSibling.getLocalName().equals("KeyInfo")) {
-	    ki = new DOMKeyInfo(nextSibling, context, provider);
-	    nextSibling = DOMUtils.getNextSiblingElement(nextSibling);
-	}
-
-	// unmarshal Objects, if specified
-	if (nextSibling == null) {
-	    objects = Collections.emptyList();
-	} else {
-	    List<XMLObject> tempObjects = new ArrayList<XMLObject>();
-	    while (nextSibling != null) {
-	        tempObjects.add(new DOMXMLObject(nextSibling,
+        // unmarshal SignedInfo
+        Element siElem = DOMUtils.getFirstChildElement(localSigElem);
+        si = new DOMSignedInfo(siElem, context, provider);
+
+        // unmarshal SignatureValue 
+        Element sigValElem = DOMUtils.getNextSiblingElement(siElem);
+        sv = new DOMSignatureValue(sigValElem);
+
+        // unmarshal KeyInfo, if specified
+        Element nextSibling = DOMUtils.getNextSiblingElement(sigValElem);
+        if (nextSibling != null && nextSibling.getLocalName().equals("KeyInfo")) {
+            ki = new DOMKeyInfo(nextSibling, context, provider);
+            nextSibling = DOMUtils.getNextSiblingElement(nextSibling);
+        }
+
+        // unmarshal Objects, if specified
+        if (nextSibling == null) {
+            objects = Collections.emptyList();
+        } else {
+            List<XMLObject> tempObjects = new ArrayList<XMLObject>();
+            while (nextSibling != null) {
+                tempObjects.add(new DOMXMLObject(nextSibling,
                                                  context, provider));
-	        nextSibling = DOMUtils.getNextSiblingElement(nextSibling);
-	    }
-	    objects = Collections.unmodifiableList(tempObjects);	
-	}
+                nextSibling = DOMUtils.getNextSiblingElement(nextSibling);
+            }
+            objects = Collections.unmodifiableList(tempObjects);	
+        }
     }
 
     public String getId() {
@@ -179,17 +179,17 @@ public final class DOMXMLSignature exten
     }
 
     public SignatureValue getSignatureValue() {
-	return sv;
+        return sv;
     }
 
     public KeySelectorResult getKeySelectorResult() {
-	return ksr;
+        return ksr;
     }
 
     public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
-	throws MarshalException
+        throws MarshalException
     {
-	marshal(parent, null, dsPrefix, context);
+        marshal(parent, null, dsPrefix, context);
     }
 
     public void marshal(Node parent, Node nextSibling, String dsPrefix,
@@ -209,43 +209,43 @@ public final class DOMXMLSignature exten
                                    dsPrefix, XMLSignature.XMLNS);
         }
 
-	// create and append SignedInfo element
-	((DOMSignedInfo)si).marshal(sigElem, dsPrefix, context);
+        // create and append SignedInfo element
+        ((DOMSignedInfo)si).marshal(sigElem, dsPrefix, context);
 
         // create and append SignatureValue element
-	((DOMSignatureValue)sv).marshal(sigElem, dsPrefix, context);
+        ((DOMSignatureValue)sv).marshal(sigElem, dsPrefix, context);
+
+        // create and append KeyInfo element if necessary
+        if (ki != null) {
+            ((DOMKeyInfo)ki).marshal(sigElem, null, dsPrefix, context);
+        }
 
-	// create and append KeyInfo element if necessary
-	if (ki != null) {
-	    ((DOMKeyInfo)ki).marshal(sigElem, null, dsPrefix, context);
-	}
-
-	// create and append Object elements if necessary
-	for (int i = 0, size = objects.size(); i < size; i++) {
-	    ((DOMXMLObject)objects.get(i)).marshal(sigElem, dsPrefix, context);
-	}
+        // create and append Object elements if necessary
+        for (int i = 0, size = objects.size(); i < size; i++) {
+            ((DOMXMLObject)objects.get(i)).marshal(sigElem, dsPrefix, context);
+        }
 
-	// append Id attribute
+        // append Id attribute
         DOMUtils.setAttributeID(sigElem, "Id", id);
-	    
-	parent.insertBefore(sigElem, nextSibling);
+            
+        parent.insertBefore(sigElem, nextSibling);
     }
 
     public boolean validate(XMLValidateContext vc) 
-	throws XMLSignatureException
+        throws XMLSignatureException
     {
-	if (vc == null) {
-	    throw new NullPointerException("validateContext is null");
-	}
+        if (vc == null) {
+            throw new NullPointerException("validateContext is null");
+        }
 
         if (!(vc instanceof DOMValidateContext)) {
             throw new ClassCastException
                 ("validateContext must be of type DOMValidateContext");
         }
 
-	if (validated) {
-	    return validationStatus;
-	}
+        if (validated) {
+            return validationStatus;
+        }
 
         // validate the signature
         boolean sigValidity = sv.validate(vc);
@@ -262,103 +262,103 @@ public final class DOMXMLSignature exten
         for (int i = 0, size = refs.size(); validateRefs && i < size; i++) {
             Reference ref = refs.get(i);
             boolean refValid = ref.validate(vc);
-	    if (log.isLoggable(Level.FINE)) {
+            if (log.isLoggable(Level.FINE)) {
                 log.log(Level.FINE, "Reference[" + ref.getURI() +
                         "] is valid: " + refValid);
-	    }
+            }
             validateRefs &= refValid;
         }
         if (!validateRefs) {
-	    if (log.isLoggable(Level.FINE)) {
+            if (log.isLoggable(Level.FINE)) {
                 log.log(Level.FINE, "Couldn't validate the References");
-	    }
-	    validationStatus = false;
-	    validated = true;
-	    return validationStatus;
+            }
+            validationStatus = false;
+            validated = true;
+            return validationStatus;
         }
 
-	// validate Manifests, if property set
+        // validate Manifests, if property set
         boolean validateMans = true;
-	if (Boolean.TRUE.equals(vc.getProperty
+        if (Boolean.TRUE.equals(vc.getProperty
                                 ("org.jcp.xml.dsig.validateManifests")))
         {
-	    for (int i=0, size=objects.size(); validateMans && i < size; i++) {
+            for (int i=0, size=objects.size(); validateMans && i < size; i++) {
                 XMLObject xo = objects.get(i);
                 @SuppressWarnings("unchecked")
                 List<XMLStructure> content = xo.getContent();
-		int csize = content.size();
+                int csize = content.size();
                 for (int j = 0; validateMans && j < csize; j++) {
                     XMLStructure xs = content.get(j);
                     if (xs instanceof Manifest) {
-	    		if (log.isLoggable(Level.FINE)) {
+                        if (log.isLoggable(Level.FINE)) {
                             log.log(Level.FINE, "validating manifest");
-			}
+                        }
                         Manifest man = (Manifest)xs;
                         @SuppressWarnings("unchecked")
                         List<Reference> manRefs = man.getReferences();
-			int rsize = manRefs.size();
+                        int rsize = manRefs.size();
                         for (int k = 0; validateMans && k < rsize; k++) {
                             Reference ref = manRefs.get(k);
                             boolean refValid = ref.validate(vc);
-	    		    if (log.isLoggable(Level.FINE)) {
+                            if (log.isLoggable(Level.FINE)) {
                                 log.log(Level.FINE, "Manifest ref[" +
                                         ref.getURI() + "] is valid: " +
                                         refValid);
-			    }
-			    validateMans &= refValid;
-			}
+                            }
+                            validateMans &= refValid;
+                        }
                     }
                 }
             }
-	}
+        }
 
-	validationStatus = validateMans;
-	validated = true;
-	return validationStatus;
+        validationStatus = validateMans;
+        validated = true;
+        return validationStatus;
     }
 
     public void sign(XMLSignContext signContext) 
-	throws MarshalException, XMLSignatureException
+        throws MarshalException, XMLSignatureException
     {
-	if (signContext == null) {
-	    throw new NullPointerException("signContext cannot be null");
-	}
+        if (signContext == null) {
+            throw new NullPointerException("signContext cannot be null");
+        }
         DOMSignContext context = (DOMSignContext)signContext;
         if (context != null) {
             marshal(context.getParent(), context.getNextSibling(),
                     DOMUtils.getSignaturePrefix(context), context);
         }
 
-	// generate references and signature value
-	List<Reference> allReferences = new ArrayList<Reference>();
+        // generate references and signature value
+        List<Reference> allReferences = new ArrayList<Reference>();
 
-	// traverse the Signature and register all objects with IDs that
-	// may contain References
-	signatureIdMap = new HashMap<String, XMLStructure>();
-	signatureIdMap.put(id, this);
-	signatureIdMap.put(si.getId(), si);
+        // traverse the Signature and register all objects with IDs that
+        // may contain References
+        signatureIdMap = new HashMap<String, XMLStructure>();
+        signatureIdMap.put(id, this);
+        signatureIdMap.put(si.getId(), si);
         @SuppressWarnings("unchecked")
-	List<Reference> refs = si.getReferences();
+        List<Reference> refs = si.getReferences();
         for (Reference ref : refs) {
             signatureIdMap.put(ref.getId(), ref);
-	}
+        }
         for (XMLObject obj : objects) {
             signatureIdMap.put(obj.getId(), obj);
             @SuppressWarnings("unchecked")
             List<XMLStructure> content = obj.getContent();
             for (XMLStructure xs : content) {
-		if (xs instanceof Manifest) {
+                if (xs instanceof Manifest) {
                     Manifest man = (Manifest)xs;
                     signatureIdMap.put(man.getId(), man);
                     @SuppressWarnings("unchecked")
                     List<Reference> manRefs = man.getReferences();
                     for (Reference ref : manRefs) {
-			allReferences.add(ref);
-			signatureIdMap.put(ref.getId(), ref);
+                        allReferences.add(ref);
+                        signatureIdMap.put(ref.getId(), ref);
                     }
-		}
+                }
             }
-	}
+        }
         // always add SignedInfo references after Manifest references so
         // that Manifest reference are digested first
         allReferences.addAll(refs);
@@ -366,222 +366,222 @@ public final class DOMXMLSignature exten
         // generate/digest each reference
         for (Reference ref : allReferences) {
             digestReference((DOMReference)ref, signContext);
-	}
+        }
 
         // do final sweep to digest any references that were skipped or missed
         for (Reference ref : allReferences) {
             if (((DOMReference)ref).isDigested()) {
-		continue;
+                continue;
             }
             ((DOMReference)ref).digest(signContext);
-	}
+        }
 
         Key signingKey = null;
-	KeySelectorResult ksr = null;
-	try {
+        KeySelectorResult ksr = null;
+        try {
             ksr = signContext.getKeySelector().select(ki,
                                                       KeySelector.Purpose.SIGN,
-		                                      si.getSignatureMethod(),
+                                                      si.getSignatureMethod(),
                                                       signContext);
             signingKey = ksr.getKey();
             if (signingKey == null) {
-		throw new XMLSignatureException("the keySelector did not " +
-            	                                "find a signing key");
+                throw new XMLSignatureException("the keySelector did not " +
+                                                "find a signing key");
             }
-	} catch (KeySelectorException kse) {
+        } catch (KeySelectorException kse) {
             throw new XMLSignatureException("cannot find signing key", kse);
-	}
+        }
 
-	// calculate signature value
-	try {
+        // calculate signature value
+        try {
             byte[] val = ((AbstractDOMSignatureMethod)
                 si.getSignatureMethod()).sign(signingKey, si, signContext);
-	    ((DOMSignatureValue)sv).setValue(val);
-	} catch (InvalidKeyException ike) {
+            ((DOMSignatureValue)sv).setValue(val);
+        } catch (InvalidKeyException ike) {
             throw new XMLSignatureException(ike);
-	}
+        }
 
         this.localSigElem = sigElem;   
-	this.ksr = ksr;
+        this.ksr = ksr;
     }
 
     @Override
     public boolean equals(Object o) {
-	if (this == o) {
-	    return true;
-	}
-
-	if (!(o instanceof XMLSignature)) {
-	    return false;
-	}
-	XMLSignature osig = (XMLSignature)o;
-
-	boolean idEqual =
-	    (id == null ? osig.getId() == null : id.equals(osig.getId()));
-	boolean keyInfoEqual =
-	    (ki == null ? osig.getKeyInfo() == null
+        if (this == o) {
+            return true;
+        }
+
+        if (!(o instanceof XMLSignature)) {
+            return false;
+        }
+        XMLSignature osig = (XMLSignature)o;
+
+        boolean idEqual =
+            (id == null ? osig.getId() == null : id.equals(osig.getId()));
+        boolean keyInfoEqual =
+            (ki == null ? osig.getKeyInfo() == null
                         : ki.equals(osig.getKeyInfo()));
 
-	return (idEqual && keyInfoEqual &&
-	        sv.equals(osig.getSignatureValue()) &&
-	        si.equals(osig.getSignedInfo()) &&
-	        objects.equals(osig.getObjects()));
+        return (idEqual && keyInfoEqual &&
+                sv.equals(osig.getSignatureValue()) &&
+                si.equals(osig.getSignedInfo()) &&
+                objects.equals(osig.getObjects()));
     }
 
     private void digestReference(DOMReference ref, XMLSignContext signContext)
-	throws XMLSignatureException
+        throws XMLSignatureException
     {
-	if (ref.isDigested()) {
-       	    return;
-	}
+        if (ref.isDigested()) {
+            return;
+        }
         // check dependencies
-	String uri = ref.getURI();
-	if (Utils.sameDocumentURI(uri)) {
+        String uri = ref.getURI();
+        if (Utils.sameDocumentURI(uri)) {
             String id = Utils.parseIdFromSameDocumentURI(uri);
             if (id != null && signatureIdMap.containsKey(id)) {
-		XMLStructure xs = signatureIdMap.get(id);
-		if (xs instanceof DOMReference) {
+                XMLStructure xs = signatureIdMap.get(id);
+                if (xs instanceof DOMReference) {
                     digestReference((DOMReference)xs, signContext);
-		} else if (xs instanceof Manifest) {
+                } else if (xs instanceof Manifest) {
                     Manifest man = (Manifest)xs;
                     List manRefs = man.getReferences();
-		    for (int i = 0, size = manRefs.size(); i < size; i++) {
-			digestReference((DOMReference)manRefs.get(i),
+                    for (int i = 0, size = manRefs.size(); i < size; i++) {
+                        digestReference((DOMReference)manRefs.get(i),
                                         signContext);
-		    }
-		}
+                    }
+                }
             }
-	    // if uri="" and there are XPath Transforms, there may be
-	    // reference dependencies in the XPath Transform - so be on
-	    // the safe side, and skip and do at end in the final sweep
-	    if (uri.length() == 0) {
+            // if uri="" and there are XPath Transforms, there may be
+            // reference dependencies in the XPath Transform - so be on
+            // the safe side, and skip and do at end in the final sweep
+            if (uri.length() == 0) {
                 @SuppressWarnings("unchecked")
-		List<Transform> transforms = ref.getTransforms();
+                List<Transform> transforms = ref.getTransforms();
                 for (Transform transform : transforms) {
-		    String transformAlg = transform.getAlgorithm();
-		    if (transformAlg.equals(Transform.XPATH) ||
-			transformAlg.equals(Transform.XPATH2)) {
-                	return;
+                    String transformAlg = transform.getAlgorithm();
+                    if (transformAlg.equals(Transform.XPATH) ||
+                        transformAlg.equals(Transform.XPATH2)) {
+                        return;
                     }
-            	}
+                }
             }
-	}
-	ref.digest(signContext);
+        }
+        ref.digest(signContext);
     }
 
     public class DOMSignatureValue extends DOMStructure 
-	implements SignatureValue
+        implements SignatureValue
     {
-	private String id;
+        private String id;
         private byte[] value;
         private String valueBase64;
         private Element sigValueElem;
-	private boolean validated = false;
-	private boolean validationStatus;
+        private boolean validated = false;
+        private boolean validationStatus;
+
+        DOMSignatureValue(String id) {
+            this.id = id;
+        }
+
+        DOMSignatureValue(Element sigValueElem) throws MarshalException {
+            try {
+                // base64 decode signatureValue
+                value = Base64.decode(sigValueElem);
+            } catch (Base64DecodingException bde) {
+                throw new MarshalException(bde);
+            }
 
-	DOMSignatureValue(String id) {
-	    this.id = id;
-	}
-
-	DOMSignatureValue(Element sigValueElem) throws MarshalException {
-	    try {
-	        // base64 decode signatureValue
-	        value = Base64.decode(sigValueElem);
-	    } catch (Base64DecodingException bde) {
-	        throw new MarshalException(bde);
-	    }
-
-	    id = DOMUtils.getAttributeValue(sigValueElem, "Id");
-	    this.sigValueElem = sigValueElem;
-	}
-
-	public String getId() {
-	    return id;
-	}
+            id = DOMUtils.getAttributeValue(sigValueElem, "Id");
+            this.sigValueElem = sigValueElem;
+        }
+
+        public String getId() {
+            return id;
+        }
 
         public byte[] getValue() {
-	    return (value == null) ? null : (byte[])value.clone();
+            return (value == null) ? null : (byte[])value.clone();
         }
 
         public boolean validate(XMLValidateContext validateContext) 
-	    throws XMLSignatureException
+            throws XMLSignatureException
         {
-	    if (validateContext == null) {
-		throw new NullPointerException("context cannot be null");
-	    }
-
-	    if (validated) {
-		return validationStatus;
-	    }
-
-	    // get validating key
-	    SignatureMethod sm = si.getSignatureMethod();
-	    Key validationKey = null;
-	    KeySelectorResult ksResult;
-	    try {
-		ksResult = validateContext.getKeySelector().select
-		    (ki, KeySelector.Purpose.VERIFY, sm, validateContext);
-		validationKey = ksResult.getKey();
-		if (validationKey == null) {
-		    throw new XMLSignatureException("the keyselector did not " +
-			                            "find a validation key");
-		}
-	    } catch (KeySelectorException kse) {
-		throw new XMLSignatureException("cannot find validation " +
-		                                "key", kse);
-	    }
-
-	    // canonicalize SignedInfo and verify signature
-	    try {
-		validationStatus = ((AbstractDOMSignatureMethod)sm).verify
-		    (validationKey, si, value, validateContext);
-	    } catch (Exception e) {
-		throw new XMLSignatureException(e);
-	    }
-
-	    validated = true;
-	    ksr = ksResult;
-	    return validationStatus;
+            if (validateContext == null) {
+                throw new NullPointerException("context cannot be null");
+            }
+
+            if (validated) {
+                return validationStatus;
+            }
+
+            // get validating key
+            SignatureMethod sm = si.getSignatureMethod();
+            Key validationKey = null;
+            KeySelectorResult ksResult;
+            try {
+                ksResult = validateContext.getKeySelector().select
+                    (ki, KeySelector.Purpose.VERIFY, sm, validateContext);
+                validationKey = ksResult.getKey();
+                if (validationKey == null) {
+                    throw new XMLSignatureException("the keyselector did not " +
+                                                    "find a validation key");
+                }
+            } catch (KeySelectorException kse) {
+                throw new XMLSignatureException("cannot find validation " +
+                                                "key", kse);
+            }
+
+            // canonicalize SignedInfo and verify signature
+            try {
+                validationStatus = ((AbstractDOMSignatureMethod)sm).verify
+                    (validationKey, si, value, validateContext);
+            } catch (Exception e) {
+                throw new XMLSignatureException(e);
+            }
+
+            validated = true;
+            ksr = ksResult;
+            return validationStatus;
         }
 
         @Override
         public boolean equals(Object o) {
-	    if (this == o) {
-	        return true;
-	    }
-
-	    if (!(o instanceof SignatureValue)) {
-	        return false;
-	    }
-	    SignatureValue osv = (SignatureValue)o;
-
-	    boolean idEqual =
-	        (id == null ? osv.getId() == null : id.equals(osv.getId()));
-
-	    //XXX compare signature values?
-	    return idEqual;
-	}
+            if (this == o) {
+                return true;
+            }
 
-	public void marshal(Node parent, String dsPrefix,
-	                    DOMCryptoContext context)
+            if (!(o instanceof SignatureValue)) {
+                return false;
+            }
+            SignatureValue osv = (SignatureValue)o;
+
+            boolean idEqual =
+                (id == null ? osv.getId() == null : id.equals(osv.getId()));
+
+            //XXX compare signature values?
+            return idEqual;
+        }
+
+        public void marshal(Node parent, String dsPrefix,
+                            DOMCryptoContext context)
             throws MarshalException
         {
             // create SignatureValue element
             sigValueElem = DOMUtils.createElement(ownerDoc, "SignatureValue",
                                                   XMLSignature.XMLNS, dsPrefix);
-	    if (valueBase64 != null) {
-	        sigValueElem.appendChild(ownerDoc.createTextNode(valueBase64));
-	    }
+            if (valueBase64 != null) {
+                sigValueElem.appendChild(ownerDoc.createTextNode(valueBase64));
+            }
 
             // append Id attribute, if specified
             DOMUtils.setAttributeID(sigValueElem, "Id", id);
             parent.appendChild(sigValueElem);
-	}
+        }
 
-	void setValue(byte[] value) {
-	    this.value = value;
+        void setValue(byte[] value) {
+            this.value = value;
             valueBase64 = Base64.encode(value);
             sigValueElem.appendChild(ownerDoc.createTextNode(valueBase64));
-	}
+        }
     }
 }