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 2017/02/13 11:09:16 UTC
svn commit: r1782742 [2/4] - in /santuario/xml-security-java/trunk/src:
main/java/org/apache/jcp/xml/dsig/internal/dom/
main/java/org/apache/xml/security/algorithms/
main/java/org/apache/xml/security/algorithms/implementations/
main/java/org/apache/xml...
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/algorithms/ECDSAUtils.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/algorithms/ECDSAUtils.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/algorithms/ECDSAUtils.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/algorithms/ECDSAUtils.java Mon Feb 13 11:09:13 2017
@@ -66,7 +66,7 @@ public final class ECDSAUtils {
}
public static ECCurveDefinition getECCurveDefinition(String oid) {
- org.apache.xml.security.algorithms.implementations.ECDSAUtils.ECCurveDefinition curveDef =
+ org.apache.xml.security.algorithms.implementations.ECDSAUtils.ECCurveDefinition curveDef =
org.apache.xml.security.algorithms.implementations.ECDSAUtils.getECCurveDefinition(oid);
if (curveDef != null) {
return new ECCurveDefinition(curveDef.getName(), curveDef.getOid(), curveDef.getField(), curveDef.getA(),
@@ -76,9 +76,9 @@ public final class ECDSAUtils {
return null;
}
- public static class ECCurveDefinition
+ public static class ECCurveDefinition
extends org.apache.xml.security.algorithms.implementations.ECDSAUtils.ECCurveDefinition {
-
+
public ECCurveDefinition(String name, String oid, String field, String a, String b, String x, String y, String n, int h) {
super(name, oid, field, a, b, x, y, n, h);
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractSignatureInputHandler.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractSignatureInputHandler.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractSignatureInputHandler.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractSignatureInputHandler.java Mon Feb 13 11:09:13 2017
@@ -157,7 +157,7 @@ public abstract class AbstractSignatureI
null,
signatureType.getSignedInfo().getCanonicalizationMethod().getAlgorithm(),
XMLSecurityConstants.DIRECTION.IN);
-
+
Iterator<XMLSecEvent> iterator = eventDeque.descendingIterator();
//forward to <Signature> Element
int i = 0;
@@ -198,18 +198,18 @@ public abstract class AbstractSignatureI
XMLStreamReader xmlStreamReader = inputProcessorChain.getSecurityContext().
<XMLInputFactory>get(XMLSecurityConstants.XMLINPUTFACTORY).
createXMLStreamReader(is);
-
+
while (xmlStreamReader.hasNext()) {
XMLSecEvent xmlSecEvent = XMLSecEventFactory.allocate(xmlStreamReader, null);
signedInfoDeque.push(xmlSecEvent);
xmlStreamReader.next();
}
-
+
@SuppressWarnings("unchecked")
final SignedInfoType signedInfoType =
((JAXBElement<SignedInfoType>) parseStructure(signedInfoDeque, 0, securityProperties)).getValue();
signatureType.setSignedInfo(signedInfoType);
-
+
return signedInfoDeque;
}
} catch (XMLStreamException | IOException e) {
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractSignatureReferenceVerifyInputProcessor.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractSignatureReferenceVerifyInputProcessor.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractSignatureReferenceVerifyInputProcessor.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractSignatureReferenceVerifyInputProcessor.java Mon Feb 13 11:09:13 2017
@@ -195,7 +195,7 @@ public abstract class AbstractSignatureR
try {
// A reflection hack to avoid breaking the ResourceResolver interface for SANTUARIO-407.
Method m = resolver.getClass().getMethod("matches", XMLSecStartElement.class, QName.class);
- if (m != null
+ if (m != null
&& (Boolean)m.invoke(resolver, xmlSecStartElement, getSecurityProperties().getIdAttributeNS())) {
if (referenceTypes == Collections.<ReferenceType>emptyList()) {
referenceTypes = new ArrayList<>();
@@ -210,7 +210,7 @@ public abstract class AbstractSignatureR
} catch (IllegalAccessException ex) {
// No need to report this
}
-
+
if (!resourceMatches && keyValue.getKey().matches(xmlSecStartElement)) {
if (referenceTypes == Collections.<ReferenceType>emptyList()) {
referenceTypes = new ArrayList<>();
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/resourceResolvers/ResolverSameDocument.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/resourceResolvers/ResolverSameDocument.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/resourceResolvers/ResolverSameDocument.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/resourceResolvers/ResolverSameDocument.java Mon Feb 13 11:09:13 2017
@@ -73,7 +73,7 @@ public class ResolverSameDocument implem
public boolean matches(XMLSecStartElement xmlSecStartElement) {
return this.matches(xmlSecStartElement, XMLSecurityConstants.ATT_NULL_Id);
}
-
+
public boolean matches(XMLSecStartElement xmlSecStartElement, QName idAttributeNS) {
if (id.isEmpty()) {
if (firstElementOccured) {
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/resourceResolvers/ResolverXPointer.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/resourceResolvers/ResolverXPointer.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/resourceResolvers/ResolverXPointer.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/resourceResolvers/ResolverXPointer.java Mon Feb 13 11:09:13 2017
@@ -96,7 +96,7 @@ public class ResolverXPointer implements
public boolean matches(XMLSecStartElement xmlSecStartElement) {
return this.matches(xmlSecStartElement, XMLSecurityConstants.ATT_NULL_Id);
}
-
+
public boolean matches(XMLSecStartElement xmlSecStartElement, QName idAttributeNS) {
//when id is null we have #xpointer(/) and then we just return true for the first start-element
if (id == null) {
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/InvalidTransformException.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/InvalidTransformException.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/InvalidTransformException.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/InvalidTransformException.java Mon Feb 13 11:09:13 2017
@@ -67,7 +67,7 @@ public class InvalidTransformException e
public InvalidTransformException(Exception originalException, String msgId) {
super(originalException, msgId);
}
-
+
@Deprecated
public InvalidTransformException(String msgID, Exception originalException) {
this(originalException, msgID);
@@ -83,7 +83,7 @@ public class InvalidTransformException e
public InvalidTransformException(Exception originalException, String msgId, Object exArgs[]) {
super(originalException, msgId, exArgs);
}
-
+
@Deprecated
public InvalidTransformException(String msgID, Object[] exArgs, Exception originalException) {
this(originalException, msgID, exArgs);
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/TransformationException.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/TransformationException.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/TransformationException.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/TransformationException.java Mon Feb 13 11:09:13 2017
@@ -70,7 +70,7 @@ public class TransformationException ext
public TransformationException(Exception originalException, String msgID) {
super(originalException, msgID);
}
-
+
@Deprecated
public TransformationException(String msgID, Exception originalException) {
this(originalException, msgID);
@@ -86,7 +86,7 @@ public class TransformationException ext
public TransformationException(Exception originalException, String msgID, Object exArgs[]) {
super(originalException, msgID, exArgs);
}
-
+
@Deprecated
public TransformationException(String msgID, Object[] exArgs, Exception originalException) {
this(originalException, msgID, exArgs);
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformBase64Decode.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformBase64Decode.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformBase64Decode.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformBase64Decode.java Mon Feb 13 11:09:13 2017
@@ -100,7 +100,7 @@ public class TransformBase64Decode exten
) throws IOException, CanonicalizationException, TransformationException {
if (input.isElement()) {
Node el = input.getSubNode();
- if (input.getSubNode().getNodeType() == Node.TEXT_NODE) {
+ if (input.getSubNode().getNodeType() == Node.TEXT_NODE) {
el = el.getParentNode();
}
StringBuilder sb = new StringBuilder();
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N.java Mon Feb 13 11:09:13 2017
@@ -55,7 +55,7 @@ public class TransformC14N extends Trans
c14n.setWriter(os);
}
byte[] result = null;
- result = c14n.engineCanonicalize(input);
+ result = c14n.engineCanonicalize(input);
XMLSignatureInput output = new XMLSignatureInput(result);
output.setSecureValidation(secureValidation);
if (os != null) {
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N11.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N11.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N11.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N11.java Mon Feb 13 11:09:13 2017
@@ -48,7 +48,7 @@ public class TransformC14N11 extends Tra
c14n.setWriter(os);
}
byte[] result = null;
- result = c14n.engineCanonicalize(input);
+ result = c14n.engineCanonicalize(input);
XMLSignatureInput output = new XMLSignatureInput(result);
output.setSecureValidation(secureValidation);
if (os != null) {
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N11_WithComments.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N11_WithComments.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N11_WithComments.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14N11_WithComments.java Mon Feb 13 11:09:13 2017
@@ -50,7 +50,7 @@ public class TransformC14N11_WithComment
}
byte[] result = null;
- result = c14n.engineCanonicalize(input);
+ result = c14n.engineCanonicalize(input);
XMLSignatureInput output = new XMLSignatureInput(result);
output.setSecureValidation(secureValidation);
if (os != null) {
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14NWithComments.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14NWithComments.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14NWithComments.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformC14NWithComments.java Mon Feb 13 11:09:13 2017
@@ -56,7 +56,7 @@ public class TransformC14NWithComments e
}
byte[] result = null;
- result = c14n.engineCanonicalize(input);
+ result = c14n.engineCanonicalize(input);
XMLSignatureInput output = new XMLSignatureInput(result);
output.setSecureValidation(secureValidation);
if (os != null) {
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXPath.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXPath.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXPath.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXPath.java Mon Feb 13 11:09:13 2017
@@ -136,7 +136,7 @@ public class TransformXPath extends Tran
/**
* @see org.apache.xml.security.signature.NodeFilter#isNodeInclude(org.w3c.dom.Node)
*/
- public int isNodeInclude(Node currentNode) {
+ public int isNodeInclude(Node currentNode) {
try {
boolean include = xPathAPI.evaluate(currentNode, xpathnode, str, xpathElement);
if (include) {
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXPath2Filter.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXPath2Filter.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXPath2Filter.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXPath2Filter.java Mon Feb 13 11:09:13 2017
@@ -179,7 +179,7 @@ class XPath2NodeFilter implements NodeFi
/**
* @see org.apache.xml.security.signature.NodeFilter#isNodeInclude(org.w3c.dom.Node)
*/
- public int isNodeInclude(Node currentNode) {
+ public int isNodeInclude(Node currentNode) {
int result = 1;
if (hasSubtractFilter && rooted(currentNode, subtractNodes)) {
@@ -189,7 +189,7 @@ class XPath2NodeFilter implements NodeFi
}
//TODO OPTIMIZE
- if (result == 1) {
+ if (result == 1) {
return 1;
}
if (hasUnionFilter) {
@@ -197,7 +197,7 @@ class XPath2NodeFilter implements NodeFi
return 1;
}
result = 0;
- }
+ }
return result;
}
@@ -208,8 +208,8 @@ class XPath2NodeFilter implements NodeFi
if (inList(n, subtractNodes)) {
inSubtract = level;
} else {
- inSubtract = -1;
- }
+ inSubtract = -1;
+ }
}
if (inSubtract != -1){
result = -1;
@@ -221,14 +221,14 @@ class XPath2NodeFilter implements NodeFi
inIntersect = -1;
result = 0;
} else {
- inIntersect = level;
- }
+ inIntersect = level;
+ }
}
if (level <= inUnion) {
inUnion = -1;
}
- if (result == 1) {
+ if (result == 1) {
return 1;
}
if (hasUnionFilter) {
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXSLT.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXSLT.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXSLT.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/implementations/TransformXSLT.java Mon Feb 13 11:09:13 2017
@@ -113,9 +113,9 @@ public class TransformXSLT extends Trans
Transformer transformer = tFactory.newTransformer();
DOMSource source = new DOMSource(xsltElement);
StreamResult result = new StreamResult(os);
-
+
transformer.transform(source, result);
-
+
stylesheet =
new StreamSource(new ByteArrayInputStream(os.toByteArray()));
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/Base64.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/Base64.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/Base64.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/Base64.java Mon Feb 13 11:09:13 2017
@@ -293,7 +293,7 @@ public class Base64 {
* @throws Base64DecodingException
*
*/
- public static final byte[] decode(byte[] base64) throws Base64DecodingException {
+ public static final byte[] decode(byte[] base64) throws Base64DecodingException {
return decodeInternal(base64, -1);
}
@@ -604,12 +604,12 @@ public class Base64 {
* @throws Base64DecodingException
*/
public static final void decode(byte[] base64Data, OutputStream os)
- throws Base64DecodingException, IOException {
+ throws Base64DecodingException, IOException {
decode(base64Data, os, -1);
}
protected static final void decode(byte[] base64Data, OutputStream os, int len)
- throws Base64DecodingException, IOException {
+ throws Base64DecodingException, IOException {
// remove white spaces
if (len == -1) {
len = removeWhiteSpace(base64Data);
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/DigesterOutputStream.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/DigesterOutputStream.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/DigesterOutputStream.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/DigesterOutputStream.java Mon Feb 13 11:09:13 2017
@@ -36,7 +36,7 @@ public class DigesterOutputStream extend
* @param mda
*/
public DigesterOutputStream(MessageDigestAlgorithm mda) {
- this.mda = mda;
+ this.mda = mda;
}
/** @inheritDoc */
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/ElementProxy.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/ElementProxy.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/ElementProxy.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/ElementProxy.java Mon Feb 13 11:09:13 2017
@@ -58,7 +58,7 @@ public abstract class ElementProxy {
* Constructor ElementProxy
*
*/
- public ElementProxy() {
+ public ElementProxy() {
}
/**
@@ -129,7 +129,7 @@ public abstract class ElementProxy {
result = doc.createElementNS(namespace, prefix + ":" + localName);
result.setAttributeNS(Constants.NamespaceSpecNS, "xmlns:" + prefix, namespace);
}
- }
+ }
return result;
}
@@ -268,12 +268,12 @@ public abstract class ElementProxy {
byte[] bytes = XMLUtils.getBytes(bi, bi.bitLength());
String encodedInt = Base64.getMimeEncoder().encodeToString(bytes);
-
+
Document doc = e.getOwnerDocument();
Text text = doc.createTextNode(encodedInt);
e.appendChild(text);
-
+
appendSelf(e);
addReturnToSelf();
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/UnsyncByteArrayOutputStream.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/UnsyncByteArrayOutputStream.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/UnsyncByteArrayOutputStream.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/UnsyncByteArrayOutputStream.java Mon Feb 13 11:09:13 2017
@@ -26,9 +26,9 @@ import java.io.OutputStream;
* @author raul
*
*/
-public class UnsyncByteArrayOutputStream extends OutputStream {
+public class UnsyncByteArrayOutputStream extends OutputStream {
- // Maximum array size. Using same value as ArrayList in OpenJDK.
+ // Maximum array size. Using same value as ArrayList in OpenJDK.
// Integer.MAX_VALUE doesn't work on some VMs, as some header values are reserved
private static final int VM_ARRAY_INDEX_MAX_VALUE = Integer.MAX_VALUE - 8;
private static final int INITIAL_SIZE = 8192;
@@ -73,7 +73,7 @@ public class UnsyncByteArrayOutputStream
if (newPos > size) {
expandSize(newPos);
}
- buf[pos++] = (byte)arg0;
+ buf[pos++] = (byte)arg0;
}
public byte[] toByteArray() {
@@ -85,7 +85,7 @@ public class UnsyncByteArrayOutputStream
public void reset() {
pos = 0;
}
-
+
/**
* Takes the contents of this stream and writes it to the output stream
* {@code out}.
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/XMLUtils.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/XMLUtils.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/XMLUtils.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/XMLUtils.java Mon Feb 13 11:09:13 2017
@@ -165,7 +165,7 @@ public final class XMLUtils {
if (rootNode == exclude) {
return;
}
- switch (rootNode.getNodeType()) {
+ switch (rootNode.getNodeType()) {
case Node.ELEMENT_NODE:
result.add(rootNode);
Element el = (Element)rootNode;
@@ -177,7 +177,7 @@ public final class XMLUtils {
}
}
//no return keep working
- case Node.DOCUMENT_NODE:
+ case Node.DOCUMENT_NODE:
for (Node r = rootNode.getFirstChild(); r != null; r = r.getNextSibling()) {
if (r.getNodeType() == Node.TEXT_NODE) {
result.add(r);
@@ -617,8 +617,8 @@ public final class XMLUtils {
if (!element.hasChildNodes()) {
break;
}
- if (element.hasAttributes()) {
- NamedNodeMap attributes = element.getAttributes();
+ if (element.hasAttributes()) {
+ NamedNodeMap attributes = element.getAttributes();
int attributesLength = attributes.getLength();
for (Node child = element.getFirstChild(); child!=null;
@@ -640,7 +640,7 @@ public final class XMLUtils {
}
childElement.setAttributeNS(namespaceNs,
currentAttr.getName(),
- currentAttr.getNodeValue());
+ currentAttr.getNodeValue());
}
}
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/resolver/ResourceResolver.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/resolver/ResourceResolver.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/resolver/ResourceResolver.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/resolver/ResourceResolver.java Mon Feb 13 11:09:13 2017
@@ -86,7 +86,7 @@ public class ResourceResolver {
} catch (InstantiationException e) {
throw new ResourceResolverException(e, context.uriToResolve, context.baseUri, "");
} catch (IllegalAccessException e) {
- throw new ResourceResolverException(e, context.uriToResolve, context.baseUri, "");
+ throw new ResourceResolverException(e, context.uriToResolve, context.baseUri, "");
}
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/resolver/ResourceResolverException.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/resolver/ResourceResolverException.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/resolver/ResourceResolverException.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/resolver/ResourceResolverException.java Mon Feb 13 11:09:13 2017
@@ -79,7 +79,7 @@ public class ResourceResolverException e
this.uri = uri;
this.baseURI = baseURI;
}
-
+
@Deprecated
public ResourceResolverException(String msgID, Exception originalException,
String uri, String baseURI) {
@@ -102,7 +102,7 @@ public class ResourceResolverException e
this.uri = uri;
this.baseURI = baseURI;
}
-
+
@Deprecated
public ResourceResolverException(String msgID, Object exArgs[],
Exception originalException, String uri,
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/resolver/implementations/ResolverDirectHTTP.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/resolver/implementations/ResolverDirectHTTP.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/resolver/implementations/ResolverDirectHTTP.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/utils/resolver/implementations/ResolverDirectHTTP.java Mon Feb 13 11:09:13 2017
@@ -96,7 +96,7 @@ public class ResolverDirectHTTP extends
@Override
public XMLSignatureInput engineResolveURI(ResourceResolverContext context)
throws ResourceResolverException {
-
+
try {
// calculate new URI
URI uriNew = getNewURI(context.uriToResolve, context.baseUri);
@@ -131,16 +131,16 @@ public class ResolverDirectHTTP extends
byte[] buf = new byte[4096];
int read = 0;
int summarized = 0;
-
+
while ((read = inputStream.read(buf)) >= 0) {
baos.write(buf, 0, read);
summarized += read;
}
-
+
if (log.isDebugEnabled()) {
log.debug("Fetched " + summarized + " bytes from URI " + uriNew.toString());
}
-
+
XMLSignatureInput result = new XMLSignatureInput(baos.toByteArray());
result.setSecureValidation(context.secureValidation);
Modified: santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/OctetStreamDataTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/OctetStreamDataTest.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/OctetStreamDataTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/OctetStreamDataTest.java Mon Feb 13 11:09:13 2017
@@ -40,7 +40,7 @@ public class OctetStreamDataTest extends
try {
osdata = new OctetStreamData(null);
fail("Should raise a NPE for null input stream");
- } catch (NullPointerException npe) {}
+ } catch (NullPointerException npe) {}
try {
osdata = new OctetStreamData(null, "uri", "mimeType");
fail("Should raise a NPE for null input stream");
@@ -49,7 +49,7 @@ public class OctetStreamDataTest extends
int len = 300;
byte[] in = new byte[len];
new Random().nextBytes(in);
-
+
try (ByteArrayInputStream bais = new ByteArrayInputStream(in)) {
osdata = new OctetStreamData(bais);
assertNotNull(osdata);
Modified: santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/CanonicalizationMethodTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/CanonicalizationMethodTest.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/CanonicalizationMethodTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/CanonicalizationMethodTest.java Mon Feb 13 11:09:13 2017
@@ -102,7 +102,7 @@ public class CanonicalizationMethodTest
new ExcC14NParameterSpec());
AlgorithmParameterSpec aps = cm.getParameterSpec();
assertNotNull(aps);
- assertTrue(aps instanceof ExcC14NParameterSpec);
+ assertTrue(aps instanceof ExcC14NParameterSpec);
}
}
Modified: santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/DigestMethodTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/DigestMethodTest.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/DigestMethodTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/DigestMethodTest.java Mon Feb 13 11:09:13 2017
@@ -47,7 +47,7 @@ public class DigestMethodTest extends or
DigestMethod dm;
for (int i = 0; i < MD_ALGOS.length; i++) {
String algo = MD_ALGOS[i];
- dm = factory.newDigestMethod(algo, null);
+ dm = factory.newDigestMethod(algo, null);
try {
dm.isFeatureSupported(null);
fail("Should raise a NPE for null feature");
Modified: santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/InteropC14nTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/InteropC14nTest.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/InteropC14nTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/InteropC14nTest.java Mon Feb 13 11:09:13 2017
@@ -44,7 +44,7 @@ public class InteropC14nTest extends org
public InteropC14nTest() {
String fs = System.getProperty("file.separator");
- base = System.getProperty("basedir") == null ? "./": System.getProperty("basedir");
+ base = System.getProperty("basedir") == null ? "./": System.getProperty("basedir");
base = base + fs + "src/test/resources" + fs + "interop";
}
Modified: santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/ManifestTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/ManifestTest.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/ManifestTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/ManifestTest.java Mon Feb 13 11:09:13 2017
@@ -68,7 +68,7 @@ public class ManifestTest extends org.ju
man = fac.newManifest(refs, id);
expectedId = id;
break;
- }
+ }
assertNotNull(man);
assertTrue(Arrays.equals(man.getReferences().toArray(), refs.toArray()));
assertEquals(man.getId(), expectedId);
@@ -154,7 +154,7 @@ public class ManifestTest extends org.ju
@org.junit.Test
public void testgetReferences() throws Exception {
List<Reference> refs = new ArrayList<>();
- refs.add(VALID_REF);
+ refs.add(VALID_REF);
Manifest man = fac.newManifest(refs);
@SuppressWarnings("unchecked")
List<Reference> stored = man.getReferences();
Modified: santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyInfoFactoryTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyInfoFactoryTest.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyInfoFactoryTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyInfoFactoryTest.java Mon Feb 13 11:09:13 2017
@@ -186,7 +186,7 @@ public class KeyInfoFactoryTest extends
fail("Should raise a NPE for null URI");
} catch (NullPointerException npe) {}
- // test RetrievalMethod(String, String, List)
+ // test RetrievalMethod(String, String, List)
try {
rm = factory.newRetrievalMethod(null, null, null);
fail("Should raise a NPE for null URI");
Modified: santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/RetrievalMethodTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/RetrievalMethodTest.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/RetrievalMethodTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/RetrievalMethodTest.java Mon Feb 13 11:09:13 2017
@@ -92,7 +92,7 @@ public class RetrievalMethodTest extends
case 1:
rm = fac.newRetrievalMethod(uri, type, null);
break;
- }
+ }
try {
rm.isFeatureSupported(null);
fail("Should raise a NPE for null feature");
Modified: santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/X509IssuerSerialTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/X509IssuerSerialTest.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/X509IssuerSerialTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/javax/xml/crypto/test/dsig/keyinfo/X509IssuerSerialTest.java Mon Feb 13 11:09:13 2017
@@ -44,13 +44,13 @@ public class X509IssuerSerialTest extend
@org.junit.Test
public void testgetIssuerName() {
X509IssuerSerial x509is = fac.newX509IssuerSerial(name,BigInteger.ZERO);
- assertNotNull(x509is.getIssuerName());
+ assertNotNull(x509is.getIssuerName());
}
@org.junit.Test
public void testgetSerialNumber() {
X509IssuerSerial x509is = fac.newX509IssuerSerial(name,BigInteger.ZERO);
- assertNotNull(x509is.getSerialNumber());
+ assertNotNull(x509is.getSerialNumber());
}
@org.junit.Test
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/CreateExclC14nInteropValues.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/CreateExclC14nInteropValues.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/CreateExclC14nInteropValues.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/CreateExclC14nInteropValues.java Mon Feb 13 11:09:13 2017
@@ -344,7 +344,7 @@ public class CreateExclC14nInteropValues
try (InputStream is = new ByteArrayInputStream(xmlStr.getBytes("UTF8"))) {
importDoc = db.parse(is);
}
-
+
obj.getElement().appendChild(doc.createTextNode("\n"));
obj.getElement()
.appendChild(doc.importNode(importDoc.getDocumentElement(), true));
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer11Test.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer11Test.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer11Test.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer11Test.java Mon Feb 13 11:09:13 2017
@@ -393,7 +393,7 @@ public class Canonicalizer11Test extends
// if everything is OK, result is true; we do a binary compare, byte by byte
boolean result = java.security.MessageDigest.isEqual(refBytes, c14nBytes);
- if (!result) {
+ if (!result) {
File f = new File(fileOut);
if (!f.exists()) {
File parent = new File(f.getParent());
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315Test.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315Test.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315Test.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315Test.java Mon Feb 13 11:09:13 2017
@@ -1080,7 +1080,7 @@ public class Canonicalizer20010315Test e
// if everything is OK, result is true; we do a binary compare, byte by byte
boolean result = java.security.MessageDigest.isEqual(refBytes, c14nBytes);
- if (!result) {
+ if (!result) {
File f = new File(fileOut);
if (!f.exists()) {
File parent = new File(f.getParent());
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/NameSpaceSymbTableTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/NameSpaceSymbTableTest.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/NameSpaceSymbTableTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/NameSpaceSymbTableTest.java Mon Feb 13 11:09:13 2017
@@ -188,13 +188,13 @@ public class NameSpaceSymbTableTest exte
NameSpaceSymbTable ns = new NameSpaceSymbTable();
ns.push();
- ns.addMappingAndRender("generated-command", "http://foo.com/command",node1);
+ ns.addMappingAndRender("generated-command", "http://foo.com/command",node1);
ns.addMappingAndRender("generated-event", "http://foo.com/event",node1);
ns.addMappingAndRender("command", "http://foo.com/command",node1);
ns.addMappingAndRender("ui", "http://foo.com/ui", node1);
ns.addMappingAndRender("event", "http://foo.com/event", node1);
ns.addMappingAndRender("instruction", "http://foo/instruction", node1);
- ns.addMappingAndRender("directory", "http://foo.com/io/directory", node1);
+ ns.addMappingAndRender("directory", "http://foo.com/io/directory", node1);
ns.addMappingAndRender("function", "http://foo.com/function", node1);
ns.addMappingAndRender("xmlns", "http://www.w3.org/1999/xhtml", node1);
ns.addMappingAndRender("ctrl", "http://foo.com/controls", node1);
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/signature/X509DataTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/signature/X509DataTest.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/signature/X509DataTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/signature/X509DataTest.java Mon Feb 13 11:09:13 2017
@@ -1,119 +1,119 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.xml.security.test.dom.signature;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.security.KeyStore;
-import java.security.PrivateKey;
-import java.security.cert.X509Certificate;
-
-import org.apache.xml.security.Init;
-import org.apache.xml.security.signature.XMLSignature;
-import org.apache.xml.security.utils.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-public class X509DataTest extends org.junit.Assert {
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.xml.security.test.dom.signature;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.security.KeyStore;
+import java.security.PrivateKey;
+import java.security.cert.X509Certificate;
+
+import org.apache.xml.security.Init;
+import org.apache.xml.security.signature.XMLSignature;
+import org.apache.xml.security.utils.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class X509DataTest extends org.junit.Assert {
private static final String BASEDIR = System.getProperty("basedir");
- KeyStore ks = null;
-
- @org.junit.Test
- public void testAddX509SubjectName() throws Exception {
- Init.init();
-
- javax.xml.parsers.DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
- Document doc = db.newDocument();
- XMLSignature sig = new XMLSignature(doc, "", XMLSignature.ALGO_ID_SIGNATURE_DSA);
-
- doc.appendChild(sig.getElement());
- sig.addDocument("");
-
- //Add in the KeyInfo for the certificate that we used the private key of
- X509Certificate cert =getCertificate();
- sig.addKeyInfo(cert);
- sig.addKeyInfo(cert.getPublicKey());
-
- // Add these three lines
- org.apache.xml.security.keys.KeyInfo ki = sig.getKeyInfo();
- ki.itemX509Data(0).addSubjectName(cert.getSubjectX500Principal().getName());
- ki.itemX509Data(0).addIssuerSerial(cert.getIssuerX500Principal().getName(), cert.getSerialNumber());
-
- sig.sign(getPrivateKey());
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- XMLUtils.outputDOM(doc, os);
- XMLSignature newSig = getSignature(os.toByteArray());
-
- assertNotNull(newSig.getKeyInfo().itemX509Data(0));
- assertEquals(cert.getSubjectX500Principal().getName(),
- newSig.getKeyInfo().itemX509Data(0).itemSubjectName(0).getSubjectName());
- assertEquals(cert.getIssuerX500Principal().getName(),
- newSig.getKeyInfo().itemX509Data(0).itemIssuerSerial(0).getIssuerName());
- }
-
- private XMLSignature getSignature(byte[] s) throws Exception {
-
- javax.xml.parsers.DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
- Document doc = null;
- try (InputStream is = new ByteArrayInputStream(s)) {
- doc = db.parse(is);
- }
- Element el = (Element)doc.getFirstChild();
- return new XMLSignature(el, "");
- }
-
- private KeyStore getKeyStore() throws Exception {
- if (ks != null) {
- return ks;
- }
- String keystoreType = "JKS";
- String keystoreFile = "src/test/resources/org/apache/xml/security/samples/input/keystore.jks";
- String keystorePass = "xmlsecurity";
- ks = KeyStore.getInstance(keystoreType);
- FileInputStream fis = null;
- if (BASEDIR != null && !"".equals(BASEDIR)) {
- fis = new FileInputStream(BASEDIR + "/" + keystoreFile);
- } else {
- fis = new FileInputStream(keystoreFile);
- }
- //load the keystore
- ks.load(fis, keystorePass.toCharArray());
- return ks;
- }
-
- private X509Certificate getCertificate() throws Exception {
- String certificateAlias = "test";
- X509Certificate cert =
- (X509Certificate) getKeyStore().getCertificate(certificateAlias);
- return cert;
- }
-
- private PrivateKey getPrivateKey() throws Exception {
- String privateKeyAlias = "test";
- String privateKeyPass = "xmlsecurity";
- PrivateKey privateKey =
- (PrivateKey) getKeyStore().getKey(privateKeyAlias, privateKeyPass.toCharArray());
- return privateKey;
- }
-
-}
+ KeyStore ks = null;
+
+ @org.junit.Test
+ public void testAddX509SubjectName() throws Exception {
+ Init.init();
+
+ javax.xml.parsers.DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
+ Document doc = db.newDocument();
+ XMLSignature sig = new XMLSignature(doc, "", XMLSignature.ALGO_ID_SIGNATURE_DSA);
+
+ doc.appendChild(sig.getElement());
+ sig.addDocument("");
+
+ //Add in the KeyInfo for the certificate that we used the private key of
+ X509Certificate cert =getCertificate();
+ sig.addKeyInfo(cert);
+ sig.addKeyInfo(cert.getPublicKey());
+
+ // Add these three lines
+ org.apache.xml.security.keys.KeyInfo ki = sig.getKeyInfo();
+ ki.itemX509Data(0).addSubjectName(cert.getSubjectX500Principal().getName());
+ ki.itemX509Data(0).addIssuerSerial(cert.getIssuerX500Principal().getName(), cert.getSerialNumber());
+
+ sig.sign(getPrivateKey());
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ XMLUtils.outputDOM(doc, os);
+ XMLSignature newSig = getSignature(os.toByteArray());
+
+ assertNotNull(newSig.getKeyInfo().itemX509Data(0));
+ assertEquals(cert.getSubjectX500Principal().getName(),
+ newSig.getKeyInfo().itemX509Data(0).itemSubjectName(0).getSubjectName());
+ assertEquals(cert.getIssuerX500Principal().getName(),
+ newSig.getKeyInfo().itemX509Data(0).itemIssuerSerial(0).getIssuerName());
+ }
+
+ private XMLSignature getSignature(byte[] s) throws Exception {
+
+ javax.xml.parsers.DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
+ Document doc = null;
+ try (InputStream is = new ByteArrayInputStream(s)) {
+ doc = db.parse(is);
+ }
+ Element el = (Element)doc.getFirstChild();
+ return new XMLSignature(el, "");
+ }
+
+ private KeyStore getKeyStore() throws Exception {
+ if (ks != null) {
+ return ks;
+ }
+ String keystoreType = "JKS";
+ String keystoreFile = "src/test/resources/org/apache/xml/security/samples/input/keystore.jks";
+ String keystorePass = "xmlsecurity";
+ ks = KeyStore.getInstance(keystoreType);
+ FileInputStream fis = null;
+ if (BASEDIR != null && !"".equals(BASEDIR)) {
+ fis = new FileInputStream(BASEDIR + "/" + keystoreFile);
+ } else {
+ fis = new FileInputStream(keystoreFile);
+ }
+ //load the keystore
+ ks.load(fis, keystorePass.toCharArray());
+ return ks;
+ }
+
+ private X509Certificate getCertificate() throws Exception {
+ String certificateAlias = "test";
+ X509Certificate cert =
+ (X509Certificate) getKeyStore().getCertificate(certificateAlias);
+ return cert;
+ }
+
+ private PrivateKey getPrivateKey() throws Exception {
+ String privateKeyAlias = "test";
+ String privateKeyPass = "xmlsecurity";
+ PrivateKey privateKey =
+ (PrivateKey) getKeyStore().getKey(privateKeyAlias, privateKeyPass.toCharArray());
+ return privateKey;
+ }
+
+}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/transforms/EmptyNamespaceTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/transforms/EmptyNamespaceTest.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/transforms/EmptyNamespaceTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/transforms/EmptyNamespaceTest.java Mon Feb 13 11:09:13 2017
@@ -83,7 +83,7 @@ public class EmptyNamespaceTest {
transformer.transform(stream);
transformer.doFinal();
-
+
String result = outputStream.toString();
Assert.assertEquals(message, result);
}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/transforms/implementations/Xpath2TransformationTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/transforms/implementations/Xpath2TransformationTest.java?rev=1782742&r1=1782741&r2=1782742&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/transforms/implementations/Xpath2TransformationTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/transforms/implementations/Xpath2TransformationTest.java Mon Feb 13 11:09:13 2017
@@ -1,157 +1,157 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.xml.security.test.dom.transforms.implementations;
-
-import java.io.ByteArrayInputStream;
-
-import org.apache.xml.security.Init;
-import org.apache.xml.security.signature.XMLSignature;
-import org.apache.xml.security.utils.Constants;
-import org.apache.xml.security.utils.XMLUtils;
-import org.w3c.dom.Element;
-
-public class Xpath2TransformationTest extends org.junit.Assert {
-
- static {
- Init.init();
- }
-
- @org.junit.Test
- public void testXpath2Transform() throws Exception {
- String sig="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
- "<edoc:EDOC xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:edoc=\"http://www.imtf.com/hypersuite/edoc/2.0/\" sysid=\"CC9CC230-C0A8024E01A3CA10-AC154F78\">\r\n" +
- " <edoc:Version>2.0</edoc:Version>\r\n" +
- " <edoc:Object edocVersion=\"2.0\">\r\n" +
- " <edoc:ObjectMetadata>\r\n" +
- " <edoc:ObjectType>Record</edoc:ObjectType>\r\n" +
- " <edoc:ObjectCreationDate>2004-12-13T14:27:35</edoc:ObjectCreationDate>\r\n" +
- " </edoc:ObjectMetadata>\r\n" +
- " <edoc:ObjectContent>\r\n" +
- " <edoc:Record>\r\n" +
- " <edoc:RecordMetadata></edoc:RecordMetadata>\r\n" +
- " <edoc:Document id=\"Revision-1-Document-1\">\r\n" +
- " <edoc:DocumentMetadata>\r\n" +
- " <dc:date>2003-07-20</dc:date>\r\n" +
- " <dc:type>20</dc:type>\r\n" +
- " <dc:format>PDF</dc:format>\r\n" +
- " <edoc:customer-number>222222</edoc:customer-number>\r\n" +
- " </edoc:DocumentMetadata>\r\n" +
- " <edoc:Encoding id=\"Revision-1-Document-1-Encoding-1\">\r\n" +
- " <edoc:EncodingMetadata>\r\n" +
- " </edoc:EncodingMetadata>\r\n" +
- " <edoc:ContentData encapsulation=\"Base64\" id=\"Revision-1-Document-1-Encoding-1-ContentData-1\" sourceFileSize=\"102550\">AAA</edoc:ContentData>\r\n" +
- " </edoc:Encoding>\r\n" +
- " </edoc:Document>\r\n" +
- " </edoc:Record>\r\n" +
- " </edoc:ObjectContent>\r\n" +
- " </edoc:Object>\r\n" +
- "<edoc:SignatureBlock id=\"Revision-1-Signature-1\"><edoc:SignatureDate>2006-08-09T17:21:35</edoc:SignatureDate><edoc:Signer>Hess Yvan (first signature)</edoc:Signer><ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\r\n" +
- "<ds:SignedInfo>\r\n" +
- "<ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"></ds:CanonicalizationMethod>\r\n" +
- "<ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"></ds:SignatureMethod>\r\n" +
- "<ds:Reference URI=\"\">\r\n" +
- "<ds:Transforms>\r\n" +
- "<ds:Transform Algorithm=\"http://www.w3.org/2002/06/xmldsig-filter2\">\r\n" +
- "<dsig-xpath:XPath xmlns:dsig-xpath=\"http://www.w3.org/2002/06/xmldsig-filter2\" Filter=\"intersect\">/edoc:EDOC/edoc:Object</dsig-xpath:XPath>\r\n" +
- "</ds:Transform>\r\n" +
- "</ds:Transforms>\r\n" +
- "<ds:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"></ds:DigestMethod>\r\n" +
- "<ds:DigestValue>YMXHTYArDBcWDG99epurfdSEAWM=</ds:DigestValue>\r\n" +
- "</ds:Reference>\r\n" +
- "</ds:SignedInfo>\r\n" +
- "<ds:SignatureValue>\r\n" +
- "Un2HBIOcwGe36k8eDEJISKP8/EmCp813JlmV0qqxIPVgdMsIJXR5Wky6uqwP+E3wAXj4NykW76GV\r\n" +
- "1eSD9dTKw/M/bFMbId0nBp0ZFaFE5DKU/My4956qr2oyJqiFRKOokCxds0jMQvGcKeWVC9oAROxR\r\n" +
- "byZQbrtjGw9YS+D5afY=\r\n" +
- "</ds:SignatureValue>\r\n" +
- "<ds:KeyInfo>\r\n" +
- "<ds:X509Data>\r\n" +
- "<ds:X509Certificate>\r\n" +
- "MIIDADCCAmmgAwIBAgIGAQpEtx7tMA0GCSqGSIb3DQEBBQUAMIGXMRQwEgYDVQQGEwtTd2l0emVy\r\n" +
- "bGFuZDERMA8GA1UECBMIRnJpYm91cmcxETAPBgNVBAcTCEdpdmlzaWV6MRUwEwYDVQQLEwxIeXBl\r\n" +
- "cnN1aXRlIDUxGTAXBgNVBAoTEEluZm9ybWF0aXF1ZS1NVEYxJzAlBgNVBAMTHklNVEYgUm9vdENl\r\n" +
- "cnRpZmljYXRlIEF1dGhvcml0eTAeFw0wNjAzMjgyMjAwMDBaFw0xNjAzMTcyMzAwMDBaMIGMMRQw\r\n" +
- "EgYDVQQGEwtTd2l0emVybGFuZDERMA8GA1UECBMIRnJpYm91cmcxETAPBgNVBAcTCEdpdmlzaWV6\r\n" +
- "MRUwEwYDVQQLEwxIeXBlcnN1aXRlIDUxGTAXBgNVBAoTEEluZm9ybWF0aXF1ZS1NVEYxHDAaBgNV\r\n" +
- "BAMTE0lNVEYgRW5kQ2VydGlmaWNhdGUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAOxpALzU\r\n" +
- "r8TjtFB7ghScWXdaDuHHRM7bPOoyuDSCxCznCBQitrwT/Un/vkZjDxSTG1bLWObqUMf1Yf6ul30n\r\n" +
- "nU9NsHO2fr7+YwtGnCV5vZ+qzWSQBY7qS+Gg8Ft9z0PluNRe84ukcQt7mdqSYet2qKbYWLP8tyFc\r\n" +
- "XCYs0JL5E6aTAgMBAAGjYDBeMB8GA1UdIwQYMBaAFIeIxHkuiPSRw5OArsqR7wZYgVPlMB0GA1Ud\r\n" +
- "DgQWBBRrfNhYheJHag+VBqDPWEOQyt3rqDAMBgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIFoDAN\r\n" +
- "BgkqhkiG9w0BAQUFAAOBgQB4OVKzObDkpadteusbvcEin2GdK3B2qz/HwqH07AEt/pQbJ/oQOsYL\r\n" +
- "qVyDFt3umJ5uHon15nkps3HRE4MoYNfVbtz1G+0nMcAbxVYJDIfC4YBJRUAm/aA0twfkiH6gFmLi\r\n" +
- "V8o5YRtkjXvZQKUtJ/Ps/m0DAC4A935jTHDd6F4FCw==\r\n" +
- "</ds:X509Certificate>\r\n" +
- "</ds:X509Data>\r\n" +
- "</ds:KeyInfo>\r\n" +
- "</ds:Signature></edoc:SignatureBlock></edoc:EDOC>";
-
- String correctC14n="<edoc:Object xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:edoc=\"http://www.imtf.com/hypersuite/edoc/2.0/\" edocVersion=\"2.0\">\n" +
- " <edoc:ObjectMetadata>\n" +
- " <edoc:ObjectType>Record</edoc:ObjectType>\n" +
- " <edoc:ObjectCreationDate>2004-12-13T14:27:35</edoc:ObjectCreationDate>\n" +
- " </edoc:ObjectMetadata>\n" +
- " <edoc:ObjectContent>\n" +
- " <edoc:Record>\n" +
- " <edoc:RecordMetadata></edoc:RecordMetadata>\n" +
- " <edoc:Document id=\"Revision-1-Document-1\">\n" +
- " <edoc:DocumentMetadata>\n" +
- " <dc:date>2003-07-20</dc:date>\n" +
- " <dc:type>20</dc:type>\n" +
- " <dc:format>PDF</dc:format>\n" +
- " <edoc:customer-number>222222</edoc:customer-number>\n" +
- " </edoc:DocumentMetadata>\n" +
- " <edoc:Encoding id=\"Revision-1-Document-1-Encoding-1\">\n" +
- " <edoc:EncodingMetadata>\n" +
- " </edoc:EncodingMetadata>\n" +
- " <edoc:ContentData encapsulation=\"Base64\" id=\"Revision-1-Document-1-Encoding-1-ContentData-1\" sourceFileSize=\"102550\">AAA</edoc:ContentData>\n" +
- " </edoc:Encoding>\n" +
- " </edoc:Document>\n" +
- " </edoc:Record>\n" +
- " </edoc:ObjectContent>\n" +
- " </edoc:Object>";
-
- javax.xml.parsers.DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
- org.w3c.dom.Document doc = null;
- try (ByteArrayInputStream is = new ByteArrayInputStream(sig.getBytes())) {
- doc = db.parse(is);
- }
- Element sigElement =
- (Element) doc.getElementsByTagNameNS(
- Constants.SignatureSpecNS, Constants._TAG_SIGNATURE).item(0);
- XMLSignature sign = new XMLSignature(sigElement, "");
- boolean verify =
- sign.checkSignatureValue(sign.getKeyInfo().getPublicKey());
- if (!verify) {
- for (int i = 0; i < sign.getSignedInfo().getLength(); i++) {
- boolean refVerify =
- sign.getSignedInfo().getVerificationResult(i);
- if (!refVerify) {
- byte[] contentBytes =
- sign.getSignedInfo().item(i).getContentsAfterTransformation().getBytes();
- assertEquals(
- correctC14n,
- new String(contentBytes)
- );
- }
- }
- }
- }
-
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.xml.security.test.dom.transforms.implementations;
+
+import java.io.ByteArrayInputStream;
+
+import org.apache.xml.security.Init;
+import org.apache.xml.security.signature.XMLSignature;
+import org.apache.xml.security.utils.Constants;
+import org.apache.xml.security.utils.XMLUtils;
+import org.w3c.dom.Element;
+
+public class Xpath2TransformationTest extends org.junit.Assert {
+
+ static {
+ Init.init();
+ }
+
+ @org.junit.Test
+ public void testXpath2Transform() throws Exception {
+ String sig="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
+ "<edoc:EDOC xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:edoc=\"http://www.imtf.com/hypersuite/edoc/2.0/\" sysid=\"CC9CC230-C0A8024E01A3CA10-AC154F78\">\r\n" +
+ " <edoc:Version>2.0</edoc:Version>\r\n" +
+ " <edoc:Object edocVersion=\"2.0\">\r\n" +
+ " <edoc:ObjectMetadata>\r\n" +
+ " <edoc:ObjectType>Record</edoc:ObjectType>\r\n" +
+ " <edoc:ObjectCreationDate>2004-12-13T14:27:35</edoc:ObjectCreationDate>\r\n" +
+ " </edoc:ObjectMetadata>\r\n" +
+ " <edoc:ObjectContent>\r\n" +
+ " <edoc:Record>\r\n" +
+ " <edoc:RecordMetadata></edoc:RecordMetadata>\r\n" +
+ " <edoc:Document id=\"Revision-1-Document-1\">\r\n" +
+ " <edoc:DocumentMetadata>\r\n" +
+ " <dc:date>2003-07-20</dc:date>\r\n" +
+ " <dc:type>20</dc:type>\r\n" +
+ " <dc:format>PDF</dc:format>\r\n" +
+ " <edoc:customer-number>222222</edoc:customer-number>\r\n" +
+ " </edoc:DocumentMetadata>\r\n" +
+ " <edoc:Encoding id=\"Revision-1-Document-1-Encoding-1\">\r\n" +
+ " <edoc:EncodingMetadata>\r\n" +
+ " </edoc:EncodingMetadata>\r\n" +
+ " <edoc:ContentData encapsulation=\"Base64\" id=\"Revision-1-Document-1-Encoding-1-ContentData-1\" sourceFileSize=\"102550\">AAA</edoc:ContentData>\r\n" +
+ " </edoc:Encoding>\r\n" +
+ " </edoc:Document>\r\n" +
+ " </edoc:Record>\r\n" +
+ " </edoc:ObjectContent>\r\n" +
+ " </edoc:Object>\r\n" +
+ "<edoc:SignatureBlock id=\"Revision-1-Signature-1\"><edoc:SignatureDate>2006-08-09T17:21:35</edoc:SignatureDate><edoc:Signer>Hess Yvan (first signature)</edoc:Signer><ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\r\n" +
+ "<ds:SignedInfo>\r\n" +
+ "<ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"></ds:CanonicalizationMethod>\r\n" +
+ "<ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"></ds:SignatureMethod>\r\n" +
+ "<ds:Reference URI=\"\">\r\n" +
+ "<ds:Transforms>\r\n" +
+ "<ds:Transform Algorithm=\"http://www.w3.org/2002/06/xmldsig-filter2\">\r\n" +
+ "<dsig-xpath:XPath xmlns:dsig-xpath=\"http://www.w3.org/2002/06/xmldsig-filter2\" Filter=\"intersect\">/edoc:EDOC/edoc:Object</dsig-xpath:XPath>\r\n" +
+ "</ds:Transform>\r\n" +
+ "</ds:Transforms>\r\n" +
+ "<ds:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"></ds:DigestMethod>\r\n" +
+ "<ds:DigestValue>YMXHTYArDBcWDG99epurfdSEAWM=</ds:DigestValue>\r\n" +
+ "</ds:Reference>\r\n" +
+ "</ds:SignedInfo>\r\n" +
+ "<ds:SignatureValue>\r\n" +
+ "Un2HBIOcwGe36k8eDEJISKP8/EmCp813JlmV0qqxIPVgdMsIJXR5Wky6uqwP+E3wAXj4NykW76GV\r\n" +
+ "1eSD9dTKw/M/bFMbId0nBp0ZFaFE5DKU/My4956qr2oyJqiFRKOokCxds0jMQvGcKeWVC9oAROxR\r\n" +
+ "byZQbrtjGw9YS+D5afY=\r\n" +
+ "</ds:SignatureValue>\r\n" +
+ "<ds:KeyInfo>\r\n" +
+ "<ds:X509Data>\r\n" +
+ "<ds:X509Certificate>\r\n" +
+ "MIIDADCCAmmgAwIBAgIGAQpEtx7tMA0GCSqGSIb3DQEBBQUAMIGXMRQwEgYDVQQGEwtTd2l0emVy\r\n" +
+ "bGFuZDERMA8GA1UECBMIRnJpYm91cmcxETAPBgNVBAcTCEdpdmlzaWV6MRUwEwYDVQQLEwxIeXBl\r\n" +
+ "cnN1aXRlIDUxGTAXBgNVBAoTEEluZm9ybWF0aXF1ZS1NVEYxJzAlBgNVBAMTHklNVEYgUm9vdENl\r\n" +
+ "cnRpZmljYXRlIEF1dGhvcml0eTAeFw0wNjAzMjgyMjAwMDBaFw0xNjAzMTcyMzAwMDBaMIGMMRQw\r\n" +
+ "EgYDVQQGEwtTd2l0emVybGFuZDERMA8GA1UECBMIRnJpYm91cmcxETAPBgNVBAcTCEdpdmlzaWV6\r\n" +
+ "MRUwEwYDVQQLEwxIeXBlcnN1aXRlIDUxGTAXBgNVBAoTEEluZm9ybWF0aXF1ZS1NVEYxHDAaBgNV\r\n" +
+ "BAMTE0lNVEYgRW5kQ2VydGlmaWNhdGUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAOxpALzU\r\n" +
+ "r8TjtFB7ghScWXdaDuHHRM7bPOoyuDSCxCznCBQitrwT/Un/vkZjDxSTG1bLWObqUMf1Yf6ul30n\r\n" +
+ "nU9NsHO2fr7+YwtGnCV5vZ+qzWSQBY7qS+Gg8Ft9z0PluNRe84ukcQt7mdqSYet2qKbYWLP8tyFc\r\n" +
+ "XCYs0JL5E6aTAgMBAAGjYDBeMB8GA1UdIwQYMBaAFIeIxHkuiPSRw5OArsqR7wZYgVPlMB0GA1Ud\r\n" +
+ "DgQWBBRrfNhYheJHag+VBqDPWEOQyt3rqDAMBgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIFoDAN\r\n" +
+ "BgkqhkiG9w0BAQUFAAOBgQB4OVKzObDkpadteusbvcEin2GdK3B2qz/HwqH07AEt/pQbJ/oQOsYL\r\n" +
+ "qVyDFt3umJ5uHon15nkps3HRE4MoYNfVbtz1G+0nMcAbxVYJDIfC4YBJRUAm/aA0twfkiH6gFmLi\r\n" +
+ "V8o5YRtkjXvZQKUtJ/Ps/m0DAC4A935jTHDd6F4FCw==\r\n" +
+ "</ds:X509Certificate>\r\n" +
+ "</ds:X509Data>\r\n" +
+ "</ds:KeyInfo>\r\n" +
+ "</ds:Signature></edoc:SignatureBlock></edoc:EDOC>";
+
+ String correctC14n="<edoc:Object xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:edoc=\"http://www.imtf.com/hypersuite/edoc/2.0/\" edocVersion=\"2.0\">\n" +
+ " <edoc:ObjectMetadata>\n" +
+ " <edoc:ObjectType>Record</edoc:ObjectType>\n" +
+ " <edoc:ObjectCreationDate>2004-12-13T14:27:35</edoc:ObjectCreationDate>\n" +
+ " </edoc:ObjectMetadata>\n" +
+ " <edoc:ObjectContent>\n" +
+ " <edoc:Record>\n" +
+ " <edoc:RecordMetadata></edoc:RecordMetadata>\n" +
+ " <edoc:Document id=\"Revision-1-Document-1\">\n" +
+ " <edoc:DocumentMetadata>\n" +
+ " <dc:date>2003-07-20</dc:date>\n" +
+ " <dc:type>20</dc:type>\n" +
+ " <dc:format>PDF</dc:format>\n" +
+ " <edoc:customer-number>222222</edoc:customer-number>\n" +
+ " </edoc:DocumentMetadata>\n" +
+ " <edoc:Encoding id=\"Revision-1-Document-1-Encoding-1\">\n" +
+ " <edoc:EncodingMetadata>\n" +
+ " </edoc:EncodingMetadata>\n" +
+ " <edoc:ContentData encapsulation=\"Base64\" id=\"Revision-1-Document-1-Encoding-1-ContentData-1\" sourceFileSize=\"102550\">AAA</edoc:ContentData>\n" +
+ " </edoc:Encoding>\n" +
+ " </edoc:Document>\n" +
+ " </edoc:Record>\n" +
+ " </edoc:ObjectContent>\n" +
+ " </edoc:Object>";
+
+ javax.xml.parsers.DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
+ org.w3c.dom.Document doc = null;
+ try (ByteArrayInputStream is = new ByteArrayInputStream(sig.getBytes())) {
+ doc = db.parse(is);
+ }
+ Element sigElement =
+ (Element) doc.getElementsByTagNameNS(
+ Constants.SignatureSpecNS, Constants._TAG_SIGNATURE).item(0);
+ XMLSignature sign = new XMLSignature(sigElement, "");
+ boolean verify =
+ sign.checkSignatureValue(sign.getKeyInfo().getPublicKey());
+ if (!verify) {
+ for (int i = 0; i < sign.getSignedInfo().getLength(); i++) {
+ boolean refVerify =
+ sign.getSignedInfo().getVerificationResult(i);
+ if (!refVerify) {
+ byte[] contentBytes =
+ sign.getSignedInfo().item(i).getContentsAfterTransformation().getBytes();
+ assertEquals(
+ correctC14n,
+ new String(contentBytes)
+ );
+ }
+ }
+ }
+ }
+
+}