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 2013/11/11 17:50:51 UTC
svn commit: r1540770 - in /santuario/xml-security-java/trunk/src:
main/java/org/apache/xml/security/stax/ext/
main/java/org/apache/xml/security/stax/impl/
main/java/org/apache/xml/security/stax/impl/processor/input/
main/java/org/apache/xml/security/st...
Author: coheigea
Date: Mon Nov 11 16:50:50 2013
New Revision: 1540770
URL: http://svn.apache.org/r1540770
Log:
Merging a tidied up version of Marc's SwA patch
Modified:
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/SecurePart.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/Transformer.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/XMLSecurityConstants.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/XMLSecurityUtils.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/EncryptionPartDef.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractDecryptInputProcessor.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractSignatureInputHandler.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractSignatureReferenceVerifyInputProcessor.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/XMLDecryptInputProcessor.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/AbstractSignatureEndingOutputProcessor.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/AbstractSignatureOutputProcessor.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/XMLSignatureOutputProcessor.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/transformer/TransformIdentity.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/transformer/canonicalizer/Canonicalizer20010315_Excl.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/transformer/canonicalizer/CanonicalizerBase.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/util/MultiInputStream.java
santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315ExclusiveTest.java
santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/transformer/TransformBase64DecodeTest.java
santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/transformer/TransformCanonicalizerTest.java
santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/transformer/TransformEnvelopedSignatureTest.java
santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/transformer/TransformIdentityTest.java
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/SecurePart.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/SecurePart.java?rev=1540770&r1=1540769&r2=1540770&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/SecurePart.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/SecurePart.java Mon Nov 11 16:50:50 2013
@@ -64,8 +64,8 @@ public class SecurePart {
private String idToSign;
private String idToReference;
private String externalReference;
- private String[] transforms = new String[]{XMLSecurityConstants.NS_C14N_EXCL};
- private String digestMethod = XMLSecurityConstants.NS_XMLDSIG_SHA1;
+ private String[] transforms;
+ private String digestMethod;
private boolean required = true;
public SecurePart(QName name, Modifier modifier) {
@@ -101,6 +101,11 @@ public class SecurePart {
this.externalReference = externalReference;
}
+ public SecurePart(String externalReference, Modifier modifier) {
+ this.externalReference = externalReference;
+ this.modifier = modifier;
+ }
+
public SecurePart(String externalReference, String[] transforms, String digestMethod) {
this.externalReference = externalReference;
this.transforms = transforms;
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/Transformer.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/Transformer.java?rev=1540770&r1=1540769&r2=1540770&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/Transformer.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/Transformer.java Mon Nov 11 16:50:50 2013
@@ -24,7 +24,7 @@ import org.apache.xml.security.stax.ext.
import javax.xml.stream.XMLStreamException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.util.List;
+import java.util.Map;
/**
* @author $Author$
@@ -36,7 +36,7 @@ public interface Transformer {
void setTransformer(Transformer transformer) throws XMLSecurityException;
- void setList(List<?> list) throws XMLSecurityException;
+ void setProperties(Map<String, Object> properties) throws XMLSecurityException;
XMLSecurityConstants.TransformMethod getPreferredTransformMethod(XMLSecurityConstants.TransformMethod forInput);
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/XMLSecurityConstants.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/XMLSecurityConstants.java?rev=1540770&r1=1540769&r2=1540770&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/XMLSecurityConstants.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/XMLSecurityConstants.java Mon Nov 11 16:50:50 2013
@@ -194,12 +194,15 @@ public class XMLSecurityConstants {
public static final QName TAG_xenc_EncryptionProperties = new QName(NS_XMLENC, "EncryptionProperties", PREFIX_XENC);
public static final QName TAG_xenc_CipherData = new QName(NS_XMLENC, "CipherData", PREFIX_XENC);
public static final QName TAG_xenc_CipherValue = new QName(NS_XMLENC, "CipherValue", PREFIX_XENC);
+ public static final QName TAG_xenc_CipherReference = new QName(NS_XMLENC, "CipherReference", PREFIX_XENC);
public static final QName TAG_xenc_ReferenceList = new QName(NS_XMLENC, "ReferenceList", PREFIX_XENC);
public static final QName TAG_xenc_DataReference = new QName(NS_XMLENC, "DataReference", PREFIX_XENC);
public static final QName ATT_NULL_URI = new QName(null, "URI");
public static final QName TAG_xenc_EncryptedData = new QName(NS_XMLENC, "EncryptedData", PREFIX_XENC);
-
+
+ public static final QName TAG_xenc_Transforms = new QName(NS_XMLENC, "Transforms", PREFIX_XENC);
+
public static final String PREFIX_WSSE11 = "wsse11";
public static final QName TAG_wsse11_EncryptedHeader = new QName(NS_WSSE11, "EncryptedHeader", PREFIX_WSSE11);
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/XMLSecurityUtils.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/XMLSecurityUtils.java?rev=1540770&r1=1540769&r2=1540770&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/XMLSecurityUtils.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/ext/XMLSecurityUtils.java Mon Nov 11 16:50:50 2013
@@ -111,8 +111,9 @@ public class XMLSecurityUtils {
return Thread.currentThread().getContextClassLoader().loadClass(className);
}
- public static Transformer getTransformer(Object methodParameter1, Object methodParameter2, String algorithm,
- XMLSecurityConstants.DIRECTION direction) throws XMLSecurityException {
+ public static Transformer getTransformer(
+ Transformer transformer, OutputStream outputStream, Map<String, Object> properties, String algorithm,
+ XMLSecurityConstants.DIRECTION direction) throws XMLSecurityException {
@SuppressWarnings("unchecked")
Class<Transformer> transformerClass = (Class<Transformer>) TransformerAlgorithmMapper.getTransformerClass(algorithm, direction);
@@ -120,13 +121,13 @@ public class XMLSecurityUtils {
try {
childTransformer = transformerClass.newInstance();
- if (methodParameter2 != null) {
- if (methodParameter1 != null) {
- childTransformer.setList((List<?>) methodParameter1);
- }
- childTransformer.setOutputStream((OutputStream) methodParameter2);
+ if (properties != null) {
+ childTransformer.setProperties(properties);
+ }
+ if (outputStream != null) {
+ childTransformer.setOutputStream(outputStream);
} else {
- childTransformer.setTransformer((Transformer) methodParameter1);
+ childTransformer.setTransformer(transformer);
}
} catch (InstantiationException e) {
throw new XMLSecurityException(e);
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/EncryptionPartDef.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/EncryptionPartDef.java?rev=1540770&r1=1540769&r2=1540770&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/EncryptionPartDef.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/EncryptionPartDef.java Mon Nov 11 16:50:50 2013
@@ -35,6 +35,8 @@ public class EncryptionPartDef {
private Key symmetricKey;
private String keyId;
private String encRefId;
+ private String cipherReferenceId;
+ private String mimeType;
public SecurePart getSecurePart() {
return securePart;
@@ -75,4 +77,20 @@ public class EncryptionPartDef {
public void setEncRefId(String encRefId) {
this.encRefId = encRefId;
}
+
+ public String getCipherReferenceId() {
+ return cipherReferenceId;
+ }
+
+ public void setCipherReferenceId(String cipherReferenceId) {
+ this.cipherReferenceId = cipherReferenceId;
+ }
+
+ public String getMimeType() {
+ return mimeType;
+ }
+
+ public void setMimeType(String mimeType) {
+ this.mimeType = mimeType;
+ }
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractDecryptInputProcessor.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractDecryptInputProcessor.java?rev=1540770&r1=1540769&r2=1540770&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractDecryptInputProcessor.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/AbstractDecryptInputProcessor.java Mon Nov 11 16:50:50 2013
@@ -204,6 +204,14 @@ public abstract class AbstractDecryptInp
final String algorithmURI = encryptedDataType.getEncryptionMethod().getAlgorithm();
final int ivLength = JCEAlgorithmMapper.getIVLengthFromURI(algorithmURI) / 8;
Cipher symCipher = getCipher(algorithmURI);
+
+ if (encryptedDataType.getCipherData().getCipherReference() != null) {
+ handleCipherReference(inputProcessorChain, encryptedDataType, symCipher, inboundSecurityToken);
+ subInputProcessorChain.reset();
+ return isSecurityHeaderEvent
+ ? subInputProcessorChain.processHeaderEvent()
+ : subInputProcessorChain.processEvent();
+ }
//create a new Thread for streaming decryption
DecryptionThread decryptionThread =
@@ -434,7 +442,8 @@ public abstract class AbstractDecryptInp
if (++count >= 50) {
throw new XMLSecurityException("stax.xmlStructureSizeExceeded", 50);
}
-
+
+ //the keyInfoCount is necessary to prevent early while-loop abort when the KeyInfo also contains a CipherValue.
if (encryptedDataXMLSecEvent.getEventType() == XMLStreamConstants.START_ELEMENT
&& encryptedDataXMLSecEvent.asStartElement().getName().equals(
XMLSecurityConstants.TAG_dsig_KeyInfo)) {
@@ -445,8 +454,10 @@ public abstract class AbstractDecryptInp
keyInfoCount--;
}
}
- while (!(encryptedDataXMLSecEvent.getEventType() == XMLStreamConstants.START_ELEMENT
+ while (!((encryptedDataXMLSecEvent.getEventType() == XMLStreamConstants.START_ELEMENT
&& encryptedDataXMLSecEvent.asStartElement().getName().equals(XMLSecurityConstants.TAG_xenc_CipherValue)
+ || encryptedDataXMLSecEvent.getEventType() == XMLStreamConstants.END_ELEMENT
+ && encryptedDataXMLSecEvent.asEndElement().getName().equals(XMLSecurityConstants.TAG_xenc_EncryptedData))
&& keyInfoCount == 0));
xmlSecEvents.push(XMLSecEventFactory.createXmlSecEndElement(XMLSecurityConstants.TAG_xenc_CipherValue));
@@ -501,6 +512,10 @@ public abstract class AbstractDecryptInp
InboundSecurityToken inboundSecurityToken,
EncryptedDataType encryptedDataType) throws XMLSecurityException;
+ protected abstract void handleCipherReference(InputProcessorChain inputProcessorChain,
+ EncryptedDataType encryptedDataType, Cipher cipher,
+ InboundSecurityToken inboundSecurityToken) throws XMLSecurityException;
+
protected ReferenceType matchesReferenceId(XMLSecStartElement xmlSecStartElement) {
Attribute refId = getReferenceIDAttribute(xmlSecStartElement);
if (refId != null) {
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=1540770&r1=1540769&r2=1540770&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 Nov 11 16:50:50 2013
@@ -24,6 +24,7 @@ import org.apache.xml.security.binding.x
import org.apache.xml.security.binding.xmldsig.SignedInfoType;
import org.apache.xml.security.exceptions.XMLSecurityException;
import org.apache.xml.security.stax.ext.*;
+import org.apache.xml.security.stax.impl.transformer.canonicalizer.Canonicalizer20010315_Excl;
import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
import org.apache.xml.security.stax.ext.stax.XMLSecEvent;
import org.apache.xml.security.stax.ext.stax.XMLSecEventFactory;
@@ -41,10 +42,7 @@ import java.io.OutputStream;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
-import java.util.ArrayDeque;
-import java.util.Deque;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
/**
* @author $Author$
@@ -152,6 +150,7 @@ public abstract class AbstractSignatureI
Transformer transformer = XMLSecurityUtils.getTransformer(
null,
unsynchronizedByteArrayOutputStream,
+ null,
signatureType.getSignedInfo().getCanonicalizationMethod().getAlgorithm(),
XMLSecurityConstants.DIRECTION.IN);
@@ -309,12 +308,18 @@ public abstract class AbstractSignatureI
canonicalizationMethodType.getContent(),
XMLSecurityConstants.TAG_c14nExcl_InclusiveNamespaces
);
- List<String> inclusiveNamespaces = inclusiveNamespacesType != null
- ? inclusiveNamespacesType.getPrefixList()
- : null;
+
+ Map<String, Object> transformerProperties = null;
+ if (inclusiveNamespacesType != null) {
+ transformerProperties = new HashMap<String, Object>();
+ transformerProperties.put(
+ Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST,
+ inclusiveNamespacesType.getPrefixList());
+ }
transformer = XMLSecurityUtils.getTransformer(
- inclusiveNamespaces,
+ null,
this.bufferedSignerOutputStream,
+ transformerProperties,
canonicalizationMethodType.getAlgorithm(),
XMLSecurityConstants.DIRECTION.IN);
} catch (NoSuchAlgorithmException 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=1540770&r1=1540769&r2=1540770&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 Nov 11 16:50:50 2013
@@ -19,6 +19,7 @@
package org.apache.xml.security.stax.impl.processor.input;
import org.apache.commons.codec.binary.Base64;
+import org.apache.xml.security.stax.impl.transformer.canonicalizer.Canonicalizer20010315_Excl;
import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -198,6 +199,8 @@ public abstract class AbstractSignatureR
@Override
public void doFinal(InputProcessorChain inputProcessorChain) throws XMLStreamException, XMLSecurityException {
+ //first call must be (order matters!):
+ inputProcessorChain.doFinal();
for (int i = 0; i < sameDocumentReferences.size(); i++) {
KeyValue<ResourceResolver, ReferenceType> keyValue = sameDocumentReferences.get(i);
@@ -209,7 +212,10 @@ public abstract class AbstractSignatureR
if (externalReferences.size() > 0) {
for (int i = 0; i < externalReferences.size(); i++) {
KeyValue<ResourceResolver, ReferenceType> keyValue = externalReferences.get(i);
- verifyExternalReference(inputProcessorChain, keyValue.getKey(), keyValue.getValue());
+ verifyExternalReference(
+ inputProcessorChain,
+ keyValue.getKey().getInputStreamFromExternalReference(),
+ keyValue.getValue());
processedReferences.add(keyValue.getValue());
}
@@ -220,8 +226,6 @@ public abstract class AbstractSignatureR
}
}
}
-
- inputProcessorChain.doFinal();
}
protected InternalSignatureReferenceVerifier getSignatureReferenceVerifier(
@@ -230,36 +234,35 @@ public abstract class AbstractSignatureR
return new InternalSignatureReferenceVerifier(securityProperties, inputProcessorChain, referenceType, startElement);
}
- private void verifyExternalReference(InputProcessorChain inputProcessorChain, ResourceResolver resourceResolver,
+ protected void verifyExternalReference(InputProcessorChain inputProcessorChain, InputStream inputStream,
ReferenceType referenceType) throws XMLSecurityException, XMLStreamException {
- DigestOutputStream digestOutputStream;
- OutputStream bufferedDigestOutputStream;
- Transformer transformer;
-
- InputStream inputStream = new BufferedInputStream(resourceResolver.getInputStreamFromExternalReference());
+ BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
try {
- digestOutputStream = createMessageDigestOutputStream(referenceType, inputProcessorChain.getSecurityContext());
- bufferedDigestOutputStream = new UnsynchronizedBufferedOutputStream(digestOutputStream);
+ DigestOutputStream digestOutputStream =
+ createMessageDigestOutputStream(referenceType, inputProcessorChain.getSecurityContext());
+ UnsynchronizedBufferedOutputStream bufferedDigestOutputStream =
+ new UnsynchronizedBufferedOutputStream(digestOutputStream);
if (referenceType.getTransforms() != null) {
- transformer = buildTransformerChain(referenceType, bufferedDigestOutputStream, inputProcessorChain, null);
- transformer.transform(inputStream);
+ Transformer transformer =
+ buildTransformerChain(referenceType, bufferedDigestOutputStream, inputProcessorChain, null);
+ transformer.transform(bufferedInputStream);
bufferedDigestOutputStream.close();
} else {
- XMLSecurityUtils.copy(inputStream, bufferedDigestOutputStream);
+ XMLSecurityUtils.copy(bufferedInputStream, bufferedDigestOutputStream);
bufferedDigestOutputStream.close();
}
+ compareDigest(digestOutputStream.getDigestValue(), referenceType);
} catch (IOException e) {
throw new XMLSecurityException(e);
} finally {
try {
- inputStream.close();
+ bufferedInputStream.close();
} catch (IOException e) {
logger.warn("Could not close external resource input stream, ignored.");
}
}
- compareDigest(digestOutputStream.getDigestValue(), referenceType);
}
protected DigestOutputStream createMessageDigestOutputStream(ReferenceType referenceType, InboundSecurityContext inboundSecurityContext)
@@ -333,12 +336,6 @@ public abstract class AbstractSignatureR
for (int i = transformTypeList.size() - 1; i >= 0; i--) {
TransformType transformType = transformTypeList.get(i);
- InclusiveNamespaces inclusiveNamespacesType =
- XMLSecurityUtils.getQNameType(transformType.getContent(),
- XMLSecurityConstants.TAG_c14nExcl_InclusiveNamespaces);
- List<String> inclusiveNamespaces = inclusiveNamespacesType != null
- ? inclusiveNamespacesType.getPrefixList()
- : null;
String algorithm = transformType.getAlgorithm();
AlgorithmSuiteSecurityEvent algorithmSuiteSecurityEvent = new AlgorithmSuiteSecurityEvent();
@@ -347,19 +344,31 @@ public abstract class AbstractSignatureR
algorithmSuiteSecurityEvent.setCorrelationID(referenceType.getId());
inputProcessorChain.getSecurityContext().registerSecurityEvent(algorithmSuiteSecurityEvent);
+ InclusiveNamespaces inclusiveNamespacesType =
+ XMLSecurityUtils.getQNameType(transformType.getContent(),
+ XMLSecurityConstants.TAG_c14nExcl_InclusiveNamespaces);
+
+ Map<String, Object> transformerProperties = null;
+ if (inclusiveNamespacesType != null) {
+ transformerProperties = new HashMap<String, Object>();
+ transformerProperties.put(
+ Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST,
+ inclusiveNamespacesType.getPrefixList());
+ }
+
if (parentTransformer != null) {
parentTransformer = XMLSecurityUtils.getTransformer(
- parentTransformer, inclusiveNamespaces, algorithm, XMLSecurityConstants.DIRECTION.IN);
+ parentTransformer, null, transformerProperties, algorithm, XMLSecurityConstants.DIRECTION.IN);
} else {
parentTransformer =
XMLSecurityUtils.getTransformer(
- inclusiveNamespaces, outputStream, algorithm, XMLSecurityConstants.DIRECTION.IN);
+ null, outputStream, transformerProperties, algorithm, XMLSecurityConstants.DIRECTION.IN);
}
}
return parentTransformer;
}
- private void compareDigest(byte[] calculatedDigest, ReferenceType referenceType) throws XMLSecurityException {
+ protected void compareDigest(byte[] calculatedDigest, ReferenceType referenceType) throws XMLSecurityException {
if (logger.isDebugEnabled()) {
logger.debug("Calculated Digest: " + new String(Base64.encodeBase64(calculatedDigest)));
logger.debug("Stored Digest: " + new String(Base64.encodeBase64(referenceType.getDigestValue())));
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/XMLDecryptInputProcessor.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/XMLDecryptInputProcessor.java?rev=1540770&r1=1540769&r2=1540770&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/XMLDecryptInputProcessor.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/input/XMLDecryptInputProcessor.java Mon Nov 11 16:50:50 2013
@@ -20,6 +20,7 @@ package org.apache.xml.security.stax.imp
import java.util.List;
+import javax.crypto.Cipher;
import javax.xml.namespace.QName;
import org.apache.xml.security.binding.xmlenc.EncryptedDataType;
@@ -81,6 +82,12 @@ public class XMLDecryptInputProcessor ex
inputProcessorChain.getSecurityContext().registerSecurityEvent(contentEncryptedElementSecurityEvent);
}
+ @Override
+ protected void handleCipherReference(InputProcessorChain inputProcessorChain, EncryptedDataType encryptedDataType,
+ Cipher cipher, InboundSecurityToken inboundSecurityToken) throws XMLSecurityException {
+ throw new XMLSecurityException("errorMessages.NotYetImplementedException");
+ }
+
/**
* The DecryptedEventReaderInputProcessor reads the decrypted stream with a StAX reader and
* forwards the generated XMLEvents
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/AbstractSignatureEndingOutputProcessor.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/AbstractSignatureEndingOutputProcessor.java?rev=1540770&r1=1540769&r2=1540770&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/AbstractSignatureEndingOutputProcessor.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/AbstractSignatureEndingOutputProcessor.java Mon Nov 11 16:50:50 2013
@@ -23,10 +23,7 @@ import java.io.OutputStream;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
import javax.xml.stream.XMLStreamException;
@@ -44,6 +41,7 @@ import org.apache.xml.security.stax.ext.
import org.apache.xml.security.stax.impl.SignaturePartDef;
import org.apache.xml.security.stax.impl.algorithms.SignatureAlgorithm;
import org.apache.xml.security.stax.impl.algorithms.SignatureAlgorithmFactory;
+import org.apache.xml.security.stax.impl.transformer.canonicalizer.Canonicalizer20010315_Excl;
import org.apache.xml.security.stax.impl.util.IDGenerator;
import org.apache.xml.security.stax.impl.util.SignerOutputStream;
import org.apache.xml.security.stax.impl.util.UnsynchronizedBufferedOutputStream;
@@ -244,7 +242,7 @@ public abstract class AbstractSignatureE
final String canonicalizationAlgorithm = getSecurityProperties().getSignatureCanonicalizationAlgorithm();
- List<String> inclusiveNamespacePrefixes = null;
+ Map<String, Object> transformerProperties = null;
if (getSecurityProperties().isAddExcC14NInclusivePrefixes() &&
XMLSecurityConstants.NS_C14N_EXCL.equals(canonicalizationAlgorithm)) {
@@ -257,12 +255,15 @@ public abstract class AbstractSignatureE
}
prefixes.append(prefix);
}
- inclusiveNamespacePrefixes = new ArrayList<String>(prefixSet);
this.inclusiveNamespacePrefixes = prefixes.toString();
+
+ transformerProperties = new HashMap<String, Object>(2);
+ transformerProperties.put(
+ Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, new ArrayList<String>(prefixSet));
}
- this.transformer = XMLSecurityUtils.getTransformer(inclusiveNamespacePrefixes, this.bufferedSignerOutputStream,
- canonicalizationAlgorithm, XMLSecurityConstants.DIRECTION.OUT);
+ this.transformer = XMLSecurityUtils.getTransformer(null, this.bufferedSignerOutputStream,
+ transformerProperties, canonicalizationAlgorithm, XMLSecurityConstants.DIRECTION.OUT);
super.init(outputProcessorChain);
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/AbstractSignatureOutputProcessor.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/AbstractSignatureOutputProcessor.java?rev=1540770&r1=1540769&r2=1540770&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/AbstractSignatureOutputProcessor.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/AbstractSignatureOutputProcessor.java Mon Nov 11 16:50:50 2013
@@ -19,6 +19,7 @@
package org.apache.xml.security.stax.impl.processor.output;
import org.apache.commons.codec.binary.Base64;
+import org.apache.xml.security.stax.impl.transformer.canonicalizer.Canonicalizer20010315_Excl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.xml.security.exceptions.XMLSecurityException;
@@ -72,56 +73,66 @@ public abstract class AbstractSignatureO
}
protected void doFinalInternal(OutputProcessorChain outputProcessorChain) throws XMLSecurityException, XMLStreamException {
- List<SignaturePartDef> signaturePartDefs = getSignaturePartDefList();
-
- Map<Object, SecurePart> dynamicSecureParts = outputProcessorChain.getSecurityContext().getAsMap(XMLSecurityConstants.SIGNATURE_PARTS);
+ Map<Object, SecurePart> dynamicSecureParts =
+ outputProcessorChain.getSecurityContext().getAsMap(XMLSecurityConstants.SIGNATURE_PARTS);
Iterator<Map.Entry<Object, SecurePart>> securePartsMapIterator = dynamicSecureParts.entrySet().iterator();
while (securePartsMapIterator.hasNext()) {
Map.Entry<Object, SecurePart> securePartEntry = securePartsMapIterator.next();
final SecurePart securePart = securePartEntry.getValue();
- final String externalReference = securePart.getExternalReference();
- if (externalReference != null) {
- ResourceResolver resourceResolver = ResourceResolverMapper.getResourceResolver(externalReference, outputProcessorChain.getDocumentContext().getBaseURI());
-
- DigestOutputStream digestOutputStream = createMessageDigestOutputStream(securePart.getDigestMethod());
- InputStream inputStream = resourceResolver.getInputStreamFromExternalReference();
-
- SignaturePartDef signaturePartDef = new SignaturePartDef();
- signaturePartDef.setSecurePart(securePart);
- signaturePartDef.setSigRefId(externalReference);
- signaturePartDef.setExternalResource(true);
- signaturePartDef.setTransforms(securePart.getTransforms());
- String digestMethod = securePart.getDigestMethod();
- if (digestMethod == null) {
- digestMethod = getSecurityProperties().getSignatureDigestAlgorithm();
- }
- signaturePartDef.setDigestAlgo(digestMethod);
- signaturePartDefs.add(signaturePartDef);
+ if (securePart.getExternalReference() != null) {
+ digestExternalReference(outputProcessorChain, securePart);
+ }
+ }
- try {
- if (securePart.getTransforms() != null) {
- signaturePartDef.setExcludeVisibleC14Nprefixes(true);
- Transformer transformer = buildTransformerChain(digestOutputStream, signaturePartDef, null);
- transformer.transform(inputStream);
- transformer.doFinal();
- } else {
- XMLSecurityUtils.copy(inputStream, digestOutputStream);
- }
- digestOutputStream.close();
- } catch (IOException e) {
- throw new XMLSecurityException(e);
- }
+ verifySignatureParts(outputProcessorChain);
+ }
- String calculatedDigest = new String(Base64.encodeBase64(digestOutputStream.getDigestValue()));
- if (logger.isDebugEnabled()) {
- logger.debug("Calculated Digest: " + calculatedDigest);
- }
+ protected void digestExternalReference(
+ OutputProcessorChain outputProcessorChain, SecurePart securePart)
+ throws XMLSecurityException, XMLStreamException {
+
+ final String externalReference = securePart.getExternalReference();
+ ResourceResolver resourceResolver =
+ ResourceResolverMapper.getResourceResolver(
+ externalReference, outputProcessorChain.getDocumentContext().getBaseURI());
+
+ String digestAlgo = securePart.getDigestMethod();
+ if (digestAlgo == null) {
+ digestAlgo = getSecurityProperties().getSignatureDigestAlgorithm();
+ }
+
+ DigestOutputStream digestOutputStream = createMessageDigestOutputStream(digestAlgo);
+ InputStream inputStream = resourceResolver.getInputStreamFromExternalReference();
- signaturePartDef.setDigestValue(calculatedDigest);
+ SignaturePartDef signaturePartDef = new SignaturePartDef();
+ signaturePartDef.setSecurePart(securePart);
+ signaturePartDef.setSigRefId(externalReference);
+ signaturePartDef.setExternalResource(true);
+ signaturePartDef.setTransforms(securePart.getTransforms());
+ signaturePartDef.setDigestAlgo(digestAlgo);
+
+ try {
+ if (securePart.getTransforms() != null) {
+ signaturePartDef.setExcludeVisibleC14Nprefixes(true);
+ Transformer transformer = buildTransformerChain(digestOutputStream, signaturePartDef, null);
+ transformer.transform(inputStream);
+ transformer.doFinal();
+ } else {
+ XMLSecurityUtils.copy(inputStream, digestOutputStream);
}
+ digestOutputStream.close();
+ } catch (IOException e) {
+ throw new XMLSecurityException(e);
}
- verifySignatureParts(outputProcessorChain);
+ String calculatedDigest = new String(Base64.encodeBase64(digestOutputStream.getDigestValue()));
+ if (logger.isDebugEnabled()) {
+ logger.debug("Calculated Digest: " + calculatedDigest);
+ }
+
+ signaturePartDef.setDigestValue(calculatedDigest);
+
+ getSignaturePartDefList().add(signaturePartDef);
}
protected void verifySignatureParts(OutputProcessorChain outputProcessorChain) throws XMLSecurityException {
@@ -155,7 +166,7 @@ public abstract class AbstractSignatureO
this.activeInternalSignatureOutputProcessor = activeInternalSignatureOutputProcessor;
}
- private DigestOutputStream createMessageDigestOutputStream(String digestAlgorithm)
+ protected DigestOutputStream createMessageDigestOutputStream(String digestAlgorithm)
throws XMLSecurityException {
String jceName = JCEAlgorithmMapper.translateURItoJCEID(digestAlgorithm);
@@ -195,9 +206,9 @@ public abstract class AbstractSignatureO
for (int i = transforms.length - 1; i >= 0; i--) {
String transform = transforms[i];
- List<String> inclusiveNamespacePrefixes = null;
+ Map<String, Object> transformerProperties = null;
if (getSecurityProperties().isAddExcC14NInclusivePrefixes() &&
- XMLSecurityConstants.NS_C14N_EXCL.equals(transform)) {
+ XMLSecurityConstants.NS_C14N_EXCL_OMIT_COMMENTS.equals(transform)) {
Set<String> prefixSet = XMLSecurityUtils.getExcC14NInclusiveNamespacePrefixes(
xmlSecStartElement, signaturePartDef.isExcludeVisibleC14Nprefixes()
@@ -210,16 +221,19 @@ public abstract class AbstractSignatureO
}
prefixes.append(prefix);
}
- inclusiveNamespacePrefixes = new ArrayList<String>(prefixSet);
signaturePartDef.setInclusiveNamespacesPrefixes(prefixes.toString());
+ List<String> inclusiveNamespacePrefixes = new ArrayList<String>(prefixSet);
+ transformerProperties = new HashMap<String, Object>();
+ transformerProperties.put(
+ Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespacePrefixes);
}
if (parentTransformer != null) {
parentTransformer = XMLSecurityUtils.getTransformer(
- parentTransformer, null, transform, XMLSecurityConstants.DIRECTION.OUT);
+ parentTransformer, null, transformerProperties, transform, XMLSecurityConstants.DIRECTION.OUT);
} else {
parentTransformer = XMLSecurityUtils.getTransformer(
- inclusiveNamespacePrefixes, outputStream, transform, XMLSecurityConstants.DIRECTION.OUT);
+ null, outputStream, transformerProperties, transform, XMLSecurityConstants.DIRECTION.OUT);
}
}
return parentTransformer;
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/XMLSignatureOutputProcessor.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/XMLSignatureOutputProcessor.java?rev=1540770&r1=1540769&r2=1540770&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/XMLSignatureOutputProcessor.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/processor/output/XMLSignatureOutputProcessor.java Mon Nov 11 16:50:50 2013
@@ -73,12 +73,14 @@ public class XMLSignatureOutputProcessor
SignaturePartDef signaturePartDef = new SignaturePartDef();
signaturePartDef.setSecurePart(securePart);
signaturePartDef.setTransforms(securePart.getTransforms());
+ if (signaturePartDef.getTransforms() == null) {
+ signaturePartDef.setTransforms(new String[]{XMLSecurityConstants.NS_C14N_EXCL_OMIT_COMMENTS});
+ }
signaturePartDef.setExcludeVisibleC14Nprefixes(true);
- String digestMethod = securePart.getDigestMethod();
- if (digestMethod == null) {
- digestMethod = getSecurityProperties().getSignatureDigestAlgorithm();
+ signaturePartDef.setDigestAlgo(securePart.getDigestMethod());
+ if (signaturePartDef.getDigestAlgo() == null) {
+ signaturePartDef.setDigestAlgo(getSecurityProperties().getSignatureDigestAlgorithm());
}
- signaturePartDef.setDigestAlgo(digestMethod);
if (securePart.getIdToSign() == null) {
signaturePartDef.setGenerateXPointer(securePart.isGenerateXPointer());
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/transformer/TransformIdentity.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/transformer/TransformIdentity.java?rev=1540770&r1=1540769&r2=1540770&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/transformer/TransformIdentity.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/transformer/TransformIdentity.java Mon Nov 11 16:50:50 2013
@@ -29,7 +29,7 @@ import org.apache.xml.security.stax.impl
import javax.xml.stream.*;
import java.io.*;
-import java.util.List;
+import java.util.Map;
/**
* @author $Author: $
@@ -43,7 +43,6 @@ public class TransformIdentity implement
private XMLEventWriter xmlEventWriterForOutputStream;
private Transformer transformer;
private ChildOutputMethod childOutputMethod;
- private List list;
protected static XMLOutputFactory getXmlOutputFactory() {
synchronized(TransformIdentity.class) {
@@ -98,12 +97,8 @@ public class TransformIdentity implement
}
@Override
- public void setList(List list) throws XMLSecurityException {
- this.list = list;
- }
-
- protected List getList() {
- return list;
+ public void setProperties(Map<String, Object> properties) throws XMLSecurityException {
+ throw new UnsupportedOperationException("no properties supported");
}
@Override
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/transformer/canonicalizer/Canonicalizer20010315_Excl.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/transformer/canonicalizer/Canonicalizer20010315_Excl.java?rev=1540770&r1=1540769&r2=1540770&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/transformer/canonicalizer/Canonicalizer20010315_Excl.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/transformer/canonicalizer/Canonicalizer20010315_Excl.java Mon Nov 11 16:50:50 2013
@@ -29,6 +29,9 @@ import java.util.*;
*/
public abstract class Canonicalizer20010315_Excl extends CanonicalizerBase {
+ public static final String INCLUSIVE_NAMESPACES_PREFIX_LIST = "inclusiveNamespacePrefixList";
+ public static final String PROPAGATE_DEFAULT_NAMESPACE = "propagateDefaultNamespace";
+
protected ArrayList<String> inclusiveNamespaces = null;
protected boolean propagateDefaultNamespace = false;
@@ -38,12 +41,12 @@ public abstract class Canonicalizer20010
@Override
@SuppressWarnings("unchecked")
- public void setList(@SuppressWarnings("rawtypes") List list) throws XMLSecurityException {
- this.inclusiveNamespaces = getPrefixList(list);
- }
-
- public void setPropagateDefaultNamespace(boolean propagateDefaultNamespace) {
- this.propagateDefaultNamespace = propagateDefaultNamespace;
+ public void setProperties(Map<String, Object> properties) throws XMLSecurityException {
+ this.inclusiveNamespaces = getPrefixList((List<String>)properties.get(INCLUSIVE_NAMESPACES_PREFIX_LIST));
+ Boolean propagateDfltNs = (Boolean)properties.get(PROPAGATE_DEFAULT_NAMESPACE);
+ if (propagateDfltNs != null) {
+ propagateDefaultNamespace = propagateDfltNs;
+ }
}
protected static ArrayList<String> getPrefixList(List<String> inclusiveNamespaces) {
@@ -103,9 +106,8 @@ public abstract class Canonicalizer20010
}
if (this.inclusiveNamespaces != null) {
- final Iterator<String> iterator = this.inclusiveNamespaces.iterator();
- while (iterator.hasNext()) {
- final String prefix = iterator.next();
+ for (int i = 0; i < inclusiveNamespaces.size(); i++) {
+ final String prefix = inclusiveNamespaces.get(i);
String ns = xmlSecStartElement.getNamespaceURI(prefix);
if (ns == null && prefix.isEmpty()) {
ns = "";
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/transformer/canonicalizer/CanonicalizerBase.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/transformer/canonicalizer/CanonicalizerBase.java?rev=1540770&r1=1540769&r2=1540770&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/transformer/canonicalizer/CanonicalizerBase.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/transformer/canonicalizer/CanonicalizerBase.java Mon Nov 11 16:50:50 2013
@@ -77,8 +77,7 @@ public abstract class CanonicalizerBase
}
@Override
- @SuppressWarnings("unchecked")
- public void setList(@SuppressWarnings("rawtypes") List list) throws XMLSecurityException {
+ public void setProperties(Map<String, Object> properties) throws XMLSecurityException {
throw new UnsupportedOperationException("InclusiveNamespace-PrefixList not supported");
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/util/MultiInputStream.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/util/MultiInputStream.java?rev=1540770&r1=1540769&r2=1540770&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/util/MultiInputStream.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/stax/impl/util/MultiInputStream.java Mon Nov 11 16:50:50 2013
@@ -67,7 +67,15 @@ public class MultiInputStream extends In
@Override
public long skip(long n) throws IOException {
- throw new UnsupportedOperationException("skip() not supported");
+ throw new IOException("skip() not supported");
+ }
+
+ @Override
+ public int available() throws IOException {
+ if (inputStreamIndex < inputStreamCount) {
+ return inputStreams[inputStreamIndex].available();
+ }
+ return 0;
}
@Override
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315ExclusiveTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315ExclusiveTest.java?rev=1540770&r1=1540769&r2=1540770&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315ExclusiveTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/c14n/Canonicalizer20010315ExclusiveTest.java Mon Nov 11 16:50:50 2013
@@ -41,7 +41,9 @@ import javax.xml.transform.stream.Stream
import java.io.*;
import java.net.URL;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
/**
* @author $Author$
@@ -215,7 +217,9 @@ public class Canonicalizer20010315Exclus
inclusiveNamespaces.add("xsi");
inclusiveNamespaces.add("wsu");
Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer();
- c.setList(inclusiveNamespaces);
+ Map<String, Object> transformerProperties = new HashMap<String, Object>();
+ transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces);
+ c.setProperties(transformerProperties);
c.setOutputStream(baos);
canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
@@ -250,7 +254,9 @@ public class Canonicalizer20010315Exclus
List<String> inclusiveNamespaces = new ArrayList<String>();
Canonicalizer20010315_ExclWithCommentsTransformer c =
new Canonicalizer20010315_ExclWithCommentsTransformer();
- c.setList(inclusiveNamespaces);
+ Map<String, Object> transformerProperties = new HashMap<String, Object>();
+ transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces);
+ c.setProperties(transformerProperties);
c.setOutputStream(baos);
canonicalize(c, new StringReader(stringWriter.toString()), new QName("http://example.net", "elem2"));
@@ -301,7 +307,9 @@ public class Canonicalizer20010315Exclus
inclusiveNamespaces.add("#default");
inclusiveNamespaces.add("xsi");
Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer();
- c.setList(inclusiveNamespaces);
+ Map<String, Object> transformerProperties = new HashMap<String, Object>();
+ transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces);
+ c.setProperties(transformerProperties);
c.setOutputStream(baos);
canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
@@ -314,7 +322,9 @@ public class Canonicalizer20010315Exclus
List<String> inclusiveNamespaces = new ArrayList<String>();
inclusiveNamespaces.add("xsi");
Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer();
- c.setList(inclusiveNamespaces);
+ Map<String, Object> transformerProperties = new HashMap<String, Object>();
+ transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces);
+ c.setProperties(transformerProperties);
c.setOutputStream(baos);
canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
@@ -373,7 +383,9 @@ public class Canonicalizer20010315Exclus
inclusiveNamespaces.add("#default");
inclusiveNamespaces.add("xsi");
Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer();
- c.setList(inclusiveNamespaces);
+ Map<String, Object> transformerProperties = new HashMap<String, Object>();
+ transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces);
+ c.setProperties(transformerProperties);
c.setOutputStream(baos);
canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
@@ -384,7 +396,9 @@ public class Canonicalizer20010315Exclus
List<String> inclusiveNamespaces = new ArrayList<String>();
inclusiveNamespaces.add("xsi");
Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer();
- c.setList(inclusiveNamespaces);
+ Map<String, Object> transformerProperties = new HashMap<String, Object>();
+ transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces);
+ c.setProperties(transformerProperties);
c.setOutputStream(baos);
canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
@@ -431,7 +445,9 @@ public class Canonicalizer20010315Exclus
inclusiveNamespaces.add("#default");
inclusiveNamespaces.add("xsi");
Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer();
- c.setList(inclusiveNamespaces);
+ Map<String, Object> transformerProperties = new HashMap<String, Object>();
+ transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces);
+ c.setProperties(transformerProperties);
c.setOutputStream(baos);
canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
@@ -443,7 +459,9 @@ public class Canonicalizer20010315Exclus
List<String> inclusiveNamespaces = new ArrayList<String>();
inclusiveNamespaces.add("xsi");
Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer();
- c.setList(inclusiveNamespaces);
+ Map<String, Object> transformerProperties = new HashMap<String, Object>();
+ transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces);
+ c.setProperties(transformerProperties);
c.setOutputStream(baos);
canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
@@ -490,7 +508,9 @@ public class Canonicalizer20010315Exclus
inclusiveNamespaces.add("#default");
inclusiveNamespaces.add("xsi");
Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer();
- c.setList(inclusiveNamespaces);
+ Map<String, Object> transformerProperties = new HashMap<String, Object>();
+ transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces);
+ c.setProperties(transformerProperties);
c.setOutputStream(baos);
canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
@@ -502,7 +522,9 @@ public class Canonicalizer20010315Exclus
List<String> inclusiveNamespaces = new ArrayList<String>();
inclusiveNamespaces.add("xsi");
Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer();
- c.setList(inclusiveNamespaces);
+ Map<String, Object> transformerProperties = new HashMap<String, Object>();
+ transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces);
+ c.setProperties(transformerProperties);
c.setOutputStream(baos);
canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
@@ -546,8 +568,10 @@ public class Canonicalizer20010315Exclus
List<String> inclusiveNamespaces = new ArrayList<String>();
inclusiveNamespaces.add("#default");
Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer();
- c.setList(inclusiveNamespaces);
- c.setPropagateDefaultNamespace(true);
+ Map<String, Object> transformerProperties = new HashMap<String, Object>();
+ transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces);
+ transformerProperties.put(Canonicalizer20010315_Excl.PROPAGATE_DEFAULT_NAMESPACE, Boolean.TRUE);
+ c.setProperties(transformerProperties);
c.setOutputStream(baos);
canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
@@ -586,8 +610,10 @@ public class Canonicalizer20010315Exclus
List<String> inclusiveNamespaces = new ArrayList<String>();
inclusiveNamespaces.add("#default");
Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer();
- c.setList(inclusiveNamespaces);
- c.setPropagateDefaultNamespace(true);
+ Map<String, Object> transformerProperties = new HashMap<String, Object>();
+ transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces);
+ transformerProperties.put(Canonicalizer20010315_Excl.PROPAGATE_DEFAULT_NAMESPACE, Boolean.TRUE);
+ c.setProperties(transformerProperties);
c.setOutputStream(baos);
canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
@@ -626,8 +652,10 @@ public class Canonicalizer20010315Exclus
List<String> inclusiveNamespaces = new ArrayList<String>();
inclusiveNamespaces.add("#default");
Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer();
- c.setList(inclusiveNamespaces);
- c.setPropagateDefaultNamespace(true);
+ Map<String, Object> transformerProperties = new HashMap<String, Object>();
+ transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces);
+ transformerProperties.put(Canonicalizer20010315_Excl.PROPAGATE_DEFAULT_NAMESPACE, Boolean.TRUE);
+ c.setProperties(transformerProperties);
c.setOutputStream(baos);
canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
@@ -666,8 +694,10 @@ public class Canonicalizer20010315Exclus
List<String> inclusiveNamespaces = new ArrayList<String>();
inclusiveNamespaces.add("#default");
Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer();
- c.setList(inclusiveNamespaces);
- c.setPropagateDefaultNamespace(true);
+ Map<String, Object> transformerProperties = new HashMap<String, Object>();
+ transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces);
+ transformerProperties.put(Canonicalizer20010315_Excl.PROPAGATE_DEFAULT_NAMESPACE, Boolean.TRUE);
+ c.setProperties(transformerProperties);
c.setOutputStream(baos);
canonicalize(c, new StringReader(XML), new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body"));
@@ -701,8 +731,10 @@ public class Canonicalizer20010315Exclus
List<String> inclusiveNamespaces = new ArrayList<String>();
inclusiveNamespaces.add("#default");
Canonicalizer20010315_ExclOmitCommentsTransformer c = new Canonicalizer20010315_ExclOmitCommentsTransformer();
- c.setList(inclusiveNamespaces);
- c.setPropagateDefaultNamespace(true);
+ Map<String, Object> transformerProperties = new HashMap<String, Object>();
+ transformerProperties.put(Canonicalizer20010315_Excl.INCLUSIVE_NAMESPACES_PREFIX_LIST, inclusiveNamespaces);
+ transformerProperties.put(Canonicalizer20010315_Excl.PROPAGATE_DEFAULT_NAMESPACE, Boolean.TRUE);
+ c.setProperties(transformerProperties);
c.setOutputStream(baos);
canonicalize(c, new StringReader(XML), new QName("http://xmlsoap.org/Ping", "Ping"));
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/transformer/TransformBase64DecodeTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/transformer/TransformBase64DecodeTest.java?rev=1540770&r1=1540769&r2=1540770&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/transformer/TransformBase64DecodeTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/transformer/TransformBase64DecodeTest.java Mon Nov 11 16:50:50 2013
@@ -40,6 +40,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
/**
* @author $Author$
@@ -72,7 +73,7 @@ public class TransformBase64DecodeTest e
}
@Override
- public void setList(@SuppressWarnings("rawtypes") List list) throws XMLSecurityException {
+ public void setProperties(Map<String, Object> properties) throws XMLSecurityException {
}
@Override
@@ -137,7 +138,7 @@ public class TransformBase64DecodeTest e
}
@Override
- public void setList(@SuppressWarnings("rawtypes") List list) throws XMLSecurityException {
+ public void setProperties(Map<String, Object> properties) throws XMLSecurityException {
}
@Override
@@ -248,7 +249,7 @@ public class TransformBase64DecodeTest e
}
@Override
- public void setList(@SuppressWarnings("rawtypes") List list) throws XMLSecurityException {
+ public void setProperties(Map<String, Object> properties) throws XMLSecurityException {
}
@Override
@@ -296,7 +297,7 @@ public class TransformBase64DecodeTest e
}
@Override
- public void setList(@SuppressWarnings("rawtypes") List list) throws XMLSecurityException {
+ public void setProperties(Map<String, Object> properties) throws XMLSecurityException {
}
@Override
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/transformer/TransformCanonicalizerTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/transformer/TransformCanonicalizerTest.java?rev=1540770&r1=1540769&r2=1540770&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/transformer/TransformCanonicalizerTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/transformer/TransformCanonicalizerTest.java Mon Nov 11 16:50:50 2013
@@ -38,6 +38,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
+import java.util.Map;
/**
* @author $Author$
@@ -70,7 +71,7 @@ public class TransformCanonicalizerTest
}
@Override
- public void setList(@SuppressWarnings("rawtypes") List list) throws XMLSecurityException {
+ public void setProperties(Map<String, Object> properties) throws XMLSecurityException {
}
@Override
@@ -129,7 +130,7 @@ public class TransformCanonicalizerTest
}
@Override
- public void setList(@SuppressWarnings("rawtypes") List list) throws XMLSecurityException {
+ public void setProperties(Map<String, Object> properties) throws XMLSecurityException {
}
@Override
@@ -219,7 +220,7 @@ public class TransformCanonicalizerTest
}
@Override
- public void setList(@SuppressWarnings("rawtypes") List list) throws XMLSecurityException {
+ public void setProperties(Map<String, Object> properties) throws XMLSecurityException {
}
@Override
@@ -271,7 +272,7 @@ public class TransformCanonicalizerTest
}
@Override
- public void setList(@SuppressWarnings("rawtypes") List list) throws XMLSecurityException {
+ public void setProperties(Map<String, Object> properties) throws XMLSecurityException {
}
@Override
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/transformer/TransformEnvelopedSignatureTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/transformer/TransformEnvelopedSignatureTest.java?rev=1540770&r1=1540769&r2=1540770&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/transformer/TransformEnvelopedSignatureTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/transformer/TransformEnvelopedSignatureTest.java Mon Nov 11 16:50:50 2013
@@ -39,6 +39,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
/**
* @author $Author$
@@ -71,7 +72,7 @@ public class TransformEnvelopedSignature
}
@Override
- public void setList(@SuppressWarnings("rawtypes") List list) throws XMLSecurityException {
+ public void setProperties(Map<String, Object> properties) throws XMLSecurityException {
}
@Override
@@ -126,7 +127,7 @@ public class TransformEnvelopedSignature
}
@Override
- public void setList(@SuppressWarnings("rawtypes") List list) throws XMLSecurityException {
+ public void setProperties(Map<String, Object> properties) throws XMLSecurityException {
}
@Override
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/transformer/TransformIdentityTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/transformer/TransformIdentityTest.java?rev=1540770&r1=1540769&r2=1540770&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/transformer/TransformIdentityTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/transformer/TransformIdentityTest.java Mon Nov 11 16:50:50 2013
@@ -40,6 +40,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
/**
* @author $Author$
@@ -73,7 +74,7 @@ public class TransformIdentityTest exten
}
@Override
- public void setList(@SuppressWarnings("rawtypes") List list) throws XMLSecurityException {
+ public void setProperties(Map<String, Object> properties) throws XMLSecurityException {
}
@Override
@@ -138,7 +139,7 @@ public class TransformIdentityTest exten
}
@Override
- public void setList(@SuppressWarnings("rawtypes") List list) throws XMLSecurityException {
+ public void setProperties(Map<String, Object> properties) throws XMLSecurityException {
}
@Override
@@ -249,7 +250,7 @@ public class TransformIdentityTest exten
}
@Override
- public void setList(@SuppressWarnings("rawtypes") List list) throws XMLSecurityException {
+ public void setProperties(Map<String, Object> properties) throws XMLSecurityException {
}
@Override
@@ -297,7 +298,7 @@ public class TransformIdentityTest exten
}
@Override
- public void setList(@SuppressWarnings("rawtypes") List list) throws XMLSecurityException {
+ public void setProperties(Map<String, Object> properties) throws XMLSecurityException {
}
@Override