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 2020/04/02 07:20:30 UTC
svn commit: r1876028 [2/3] - in /santuario/xml-security-java/trunk/src:
main/resources/ test/java/org/apache/xml/security/test/stax/signature/
test/java/org/apache/xml/security/test/stax/utils/ test/resources/
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/BaltimoreTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/BaltimoreTest.java?rev=1876028&r1=1876027&r2=1876028&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/BaltimoreTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/BaltimoreTest.java Thu Apr 2 07:20:30 2020
@@ -22,19 +22,15 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.math.BigInteger;
-import java.net.Proxy;
import java.nio.charset.StandardCharsets;
import java.security.Key;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PublicKey;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateFactory;
import java.security.spec.DSAPublicKeySpec;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;
import java.security.spec.RSAPublicKeySpec;
-
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import javax.xml.stream.XMLInputFactory;
@@ -49,7 +45,6 @@ import org.apache.xml.security.stax.conf
import org.apache.xml.security.stax.ext.InboundXMLSec;
import org.apache.xml.security.stax.ext.XMLSec;
import org.apache.xml.security.stax.ext.XMLSecurityProperties;
-import org.apache.xml.security.stax.impl.resourceResolvers.ResolverHttp;
import org.apache.xml.security.stax.impl.securityToken.KeyNameSecurityToken;
import org.apache.xml.security.stax.impl.securityToken.X509IssuerSerialSecurityToken;
import org.apache.xml.security.stax.impl.securityToken.X509SecurityToken;
@@ -59,13 +54,13 @@ import org.apache.xml.security.stax.secu
import org.apache.xml.security.stax.securityEvent.SecurityEventConstants;
import org.apache.xml.security.stax.securityEvent.X509TokenSecurityEvent;
import org.apache.xml.security.stax.securityToken.SecurityTokenConstants;
-import org.apache.xml.security.test.stax.utils.HttpRequestRedirectorProxy;
import org.apache.xml.security.test.stax.utils.StAX2DOM;
-import org.apache.xml.security.test.stax.utils.TestUtils;
import org.apache.xml.security.test.stax.utils.XMLSecEventAllocator;
import org.apache.xml.security.utils.XMLUtils;
+
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+
import org.w3c.dom.Document;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -120,7 +115,6 @@ public class BaltimoreTest {
xmlInputFactory.setEventAllocator(new XMLSecEventAllocator());
}
-
@Test
public void test_fifteen_enveloping_hmac_sha1() throws Exception {
// Read in plaintext document
@@ -336,107 +330,6 @@ public class BaltimoreTest {
SecurityTokenConstants.KeyIdentifier_KeyValue);
}
- // See SANTUARIO-319
- @Test
- public void test_fifteen_external_b64_dsa() throws Exception {
-
- Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
- try {
- ResolverHttp.setProxy(proxy);
-
- TestUtils.switchAllowNotSameDocumentReferences(true);
-
- // Read in plaintext document
- InputStream sourceDocument =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-fifteen/signature-external-b64-dsa.xml");
- Document document = XMLUtils.read(sourceDocument, false);
-
- // Set up the Key
- Key publicKey = getPublicKey("DSA", 15);
-
- // XMLUtils.outputDOM(document, System.out);
-
- // Convert Document to a Stream Reader
- javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- transformer.transform(new DOMSource(document), new StreamResult(baos));
-
- XMLStreamReader xmlStreamReader = null;
- try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
- xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
- }
-
- // Verify signature
- XMLSecurityProperties properties = new XMLSecurityProperties();
- properties.setSignatureVerificationKey(publicKey);
- InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
- TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
- XMLStreamReader securityStreamReader =
- inboundXMLSec.processInMessage(xmlStreamReader, null, securityEventListener);
-
- StAX2DOM.readDoc(securityStreamReader);
-
- // Check the SecurityEvents
- checkSignatureToken(securityEventListener, getPublicKey("DSA", 15),
- SecurityTokenConstants.KeyIdentifier_KeyValue);
- } finally {
- TestUtils.switchAllowNotSameDocumentReferences(false);
- HttpRequestRedirectorProxy.stopHttpEngine();
- }
- }
-
- // See SANTUARIO-319
- @Test
- public void test_fifteen_external_dsa() throws Exception {
-
- Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
-
- try {
- ResolverHttp.setProxy(proxy);
-
- TestUtils.switchAllowNotSameDocumentReferences(true);
-
- // Read in plaintext document
- InputStream sourceDocument =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-fifteen/signature-external-dsa.xml");
- Document document = XMLUtils.read(sourceDocument, false);
-
- // Set up the Key
- Key publicKey = getPublicKey("DSA", 15);
-
- // XMLUtils.outputDOM(document, System.out);
-
- // Convert Document to a Stream Reader
- javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- transformer.transform(new DOMSource(document), new StreamResult(baos));
-
- XMLStreamReader xmlStreamReader = null;
- try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
- xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
- }
-
- // Verify signature
- XMLSecurityProperties properties = new XMLSecurityProperties();
- properties.setSignatureVerificationKey(publicKey);
- InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
- TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
- XMLStreamReader securityStreamReader =
- inboundXMLSec.processInMessage(xmlStreamReader, null, securityEventListener);
-
- StAX2DOM.readDoc(securityStreamReader);
-
- // Check the SecurityEvents
- checkSignatureToken(securityEventListener, getPublicKey("DSA", 15),
- SecurityTokenConstants.KeyIdentifier_KeyValue);
- } finally {
- TestUtils.switchAllowNotSameDocumentReferences(false);
- HttpRequestRedirectorProxy.stopHttpEngine();
- }
- }
-
@Test
public void test_twenty_three_enveloping_hmac_sha1() throws Exception {
// Read in plaintext document
@@ -660,458 +553,6 @@ public class BaltimoreTest {
SecurityTokenConstants.KeyIdentifier_KeyValue);
}
- // See Santuario-319
- @Test
- public void test_twenty_three_external_b64_dsa() throws Exception {
-
- Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
-
- try {
- ResolverHttp.setProxy(proxy);
-
- TestUtils.switchAllowNotSameDocumentReferences(true);
-
- // Read in plaintext document
- InputStream sourceDocument =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-twenty-three/signature-external-b64-dsa.xml");
- Document document = XMLUtils.read(sourceDocument, false);
-
- // Set up the Key
- Key publicKey = getPublicKey("DSA", 23);
-
- // XMLUtils.outputDOM(document, System.out);
-
- // Convert Document to a Stream Reader
- javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- transformer.transform(new DOMSource(document), new StreamResult(baos));
-
- XMLStreamReader xmlStreamReader = null;
- try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
- xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
- }
-
- // Verify signature
- XMLSecurityProperties properties = new XMLSecurityProperties();
- properties.setSignatureVerificationKey(publicKey);
- InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
- TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
- XMLStreamReader securityStreamReader =
- inboundXMLSec.processInMessage(xmlStreamReader, null, securityEventListener);
-
- StAX2DOM.readDoc(securityStreamReader);
-
- // Check the SecurityEvents
- checkSignatureToken(securityEventListener, getPublicKey("RSA", 23),
- SecurityTokenConstants.KeyIdentifier_KeyValue);
- } finally {
- TestUtils.switchAllowNotSameDocumentReferences(false);
- HttpRequestRedirectorProxy.stopHttpEngine();
- }
- }
-
- // See SANTUARIO-319
- @Test
- public void test_twenty_three_external_dsa() throws Exception {
-
- Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
-
- try {
- ResolverHttp.setProxy(proxy);
-
- TestUtils.switchAllowNotSameDocumentReferences(true);
-
- // Read in plaintext document
- InputStream sourceDocument =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-twenty-three/signature-external-dsa.xml");
- Document document = XMLUtils.read(sourceDocument, false);
-
- // Set up the Key
- Key publicKey = getPublicKey("DSA", 23);
-
- // XMLUtils.outputDOM(document, System.out);
-
- // Convert Document to a Stream Reader
- javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- transformer.transform(new DOMSource(document), new StreamResult(baos));
-
- XMLStreamReader xmlStreamReader = null;
- try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
- xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
- }
-
- // Verify signature
- XMLSecurityProperties properties = new XMLSecurityProperties();
- properties.setSignatureVerificationKey(publicKey);
- InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
- TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
- XMLStreamReader securityStreamReader =
- inboundXMLSec.processInMessage(xmlStreamReader, null, securityEventListener);
-
- StAX2DOM.readDoc(securityStreamReader);
-
- // Check the SecurityEvents
- checkSignatureToken(securityEventListener, getPublicKey("RSA", 23),
- SecurityTokenConstants.KeyIdentifier_KeyValue);
- } finally {
- TestUtils.switchAllowNotSameDocumentReferences(false);
- HttpRequestRedirectorProxy.stopHttpEngine();
- }
- }
-
- // See SANTUARIO-319
- @Test
- public void test_signature_keyname() throws Exception {
-
- Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
-
- try {
- ResolverHttp.setProxy(proxy);
-
- TestUtils.switchAllowNotSameDocumentReferences(true);
-
- // Read in plaintext document
- InputStream sourceDocument =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-twenty-three/signature-keyname.xml");
- Document document = XMLUtils.read(sourceDocument, false);
-
- // Set up the Key
- CertificateFactory cf = CertificateFactory.getInstance("X509");
- InputStream sourceCert =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-twenty-three/certs/lugh.crt");
-
- Certificate cert = cf.generateCertificate(sourceCert);
-
- // XMLUtils.outputDOM(document, System.out);
-
- // Convert Document to a Stream Reader
- javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- transformer.transform(new DOMSource(document), new StreamResult(baos));
-
- XMLStreamReader xmlStreamReader = null;
- try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
- xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
- }
-
- // Verify signature
- XMLSecurityProperties properties = new XMLSecurityProperties();
- properties.setSignatureVerificationKey(cert.getPublicKey());
- InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
- TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
- XMLStreamReader securityStreamReader =
- inboundXMLSec.processInMessage(xmlStreamReader, null, securityEventListener);
-
- StAX2DOM.readDoc(securityStreamReader);
-
- // Check the SecurityEvents
- checkSignatureToken(securityEventListener, cert.getPublicKey(),
- SecurityTokenConstants.KeyIdentifier_KeyName);
- } finally {
- TestUtils.switchAllowNotSameDocumentReferences(false);
- HttpRequestRedirectorProxy.stopHttpEngine();
- }
- }
-
- // See SANTUARIO-319
- @Test
- public void test_signature_retrievalmethod_rawx509crt() throws Exception {
-
- Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
-
- try {
- ResolverHttp.setProxy(proxy);
-
- TestUtils.switchAllowNotSameDocumentReferences(true);
-
- // Read in plaintext document
- InputStream sourceDocument =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-twenty-three/signature-retrievalmethod-rawx509crt.xml");
- Document document = XMLUtils.read(sourceDocument, false);
-
- // Set up the Key
- CertificateFactory cf = CertificateFactory.getInstance("X509");
- InputStream sourceCert =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-twenty-three/certs/balor.crt");
-
- Certificate cert = cf.generateCertificate(sourceCert);
-
- // XMLUtils.outputDOM(document, System.out);
-
- // Convert Document to a Stream Reader
- javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- transformer.transform(new DOMSource(document), new StreamResult(baos));
-
- XMLStreamReader xmlStreamReader = null;
- try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
- xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
- }
-
- // Verify signature
- XMLSecurityProperties properties = new XMLSecurityProperties();
- properties.setSignatureVerificationKey(cert.getPublicKey());
- InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
- XMLStreamReader securityStreamReader = inboundXMLSec.processInMessage(xmlStreamReader);
-
- StAX2DOM.readDoc(securityStreamReader);
- } finally {
- TestUtils.switchAllowNotSameDocumentReferences(false);
- HttpRequestRedirectorProxy.stopHttpEngine();
- }
- }
-
- // See SANTUARIO-319
- @Test
- public void test_signature_x509_crt_crl() throws Exception {
-
- Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
-
- try {
- ResolverHttp.setProxy(proxy);
-
- TestUtils.switchAllowNotSameDocumentReferences(true);
-
- // Read in plaintext document
- InputStream sourceDocument =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-twenty-three/signature-x509-crt-crl.xml");
- Document document = XMLUtils.read(sourceDocument, false);
-
- // XMLUtils.outputDOM(document, System.out);
-
- // Convert Document to a Stream Reader
- javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- transformer.transform(new DOMSource(document), new StreamResult(baos));
-
- XMLStreamReader xmlStreamReader = null;
- try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
- xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
- }
-
- // Verify signature
- XMLSecurityProperties properties = new XMLSecurityProperties();
- InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
- XMLStreamReader securityStreamReader = inboundXMLSec.processInMessage(xmlStreamReader);
-
- StAX2DOM.readDoc(securityStreamReader);
- } finally {
- TestUtils.switchAllowNotSameDocumentReferences(false);
- HttpRequestRedirectorProxy.stopHttpEngine();
- }
- }
-
- // See SANTUARIO-319
- @Test
- public void test_signature_x509_crt() throws Exception {
-
- Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
-
- try {
- ResolverHttp.setProxy(proxy);
-
- TestUtils.switchAllowNotSameDocumentReferences(true);
-
- // Read in plaintext document
- InputStream sourceDocument =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-twenty-three/signature-x509-crt.xml");
- Document document = XMLUtils.read(sourceDocument, false);
-
- // XMLUtils.outputDOM(document, System.out);
-
- // Convert Document to a Stream Reader
- javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- transformer.transform(new DOMSource(document), new StreamResult(baos));
-
- XMLStreamReader xmlStreamReader = null;
- try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
- xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
- }
-
- // Verify signature
- XMLSecurityProperties properties = new XMLSecurityProperties();
- InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
- XMLStreamReader securityStreamReader = inboundXMLSec.processInMessage(xmlStreamReader);
-
- StAX2DOM.readDoc(securityStreamReader);
- } finally {
- TestUtils.switchAllowNotSameDocumentReferences(false);
- HttpRequestRedirectorProxy.stopHttpEngine();
- }
- }
-
- // See SANTUARIO-319
- @Test
- public void test_signature_x509_is() throws Exception {
-
- Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
-
- try {
- ResolverHttp.setProxy(proxy);
-
- TestUtils.switchAllowNotSameDocumentReferences(true);
-
- // Read in plaintext document
- InputStream sourceDocument =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-twenty-three/signature-x509-is.xml");
- Document document = XMLUtils.read(sourceDocument, false);
-
- // XMLUtils.outputDOM(document, System.out);
-
- // Set up the Key
- CertificateFactory cf = CertificateFactory.getInstance("X509");
- InputStream sourceCert =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-twenty-three/certs/macha.crt");
-
- Certificate cert = cf.generateCertificate(sourceCert);
-
- // Convert Document to a Stream Reader
- javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- transformer.transform(new DOMSource(document), new StreamResult(baos));
-
- XMLStreamReader xmlStreamReader = null;
- try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
- xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
- }
-
- // Verify signature
- XMLSecurityProperties properties = new XMLSecurityProperties();
- properties.setSignatureVerificationKey(cert.getPublicKey());
- InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
- TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
- XMLStreamReader securityStreamReader =
- inboundXMLSec.processInMessage(xmlStreamReader, null, securityEventListener);
-
- StAX2DOM.readDoc(securityStreamReader);
-
- // Check the SecurityEvents
- checkSignatureToken(securityEventListener, cert.getPublicKey(),
- SecurityTokenConstants.KeyIdentifier_IssuerSerial);
- } finally {
- TestUtils.switchAllowNotSameDocumentReferences(false);
- HttpRequestRedirectorProxy.stopHttpEngine();
- }
- }
-
- // See SANTUARIO-319
- @Test
- public void test_signature_x509_ski() throws Exception {
-
- Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
-
- try {
- ResolverHttp.setProxy(proxy);
-
- TestUtils.switchAllowNotSameDocumentReferences(true);
-
- // Read in plaintext document
- InputStream sourceDocument =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-twenty-three/signature-x509-ski.xml");
- Document document = XMLUtils.read(sourceDocument, false);
-
- // XMLUtils.outputDOM(document, System.out);
-
- // Set up the Key
- CertificateFactory cf = CertificateFactory.getInstance("X509");
- InputStream sourceCert =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-twenty-three/certs/nemain.crt");
-
- Certificate cert = cf.generateCertificate(sourceCert);
-
- // Convert Document to a Stream Reader
- javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- transformer.transform(new DOMSource(document), new StreamResult(baos));
-
- XMLStreamReader xmlStreamReader = null;
- try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
- xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
- }
-
- // Verify signature
- XMLSecurityProperties properties = new XMLSecurityProperties();
- properties.setSignatureVerificationKey(cert.getPublicKey());
- InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
- XMLStreamReader securityStreamReader = inboundXMLSec.processInMessage(xmlStreamReader);
-
- StAX2DOM.readDoc(securityStreamReader);
- } finally {
- TestUtils.switchAllowNotSameDocumentReferences(false);
- HttpRequestRedirectorProxy.stopHttpEngine();
- }
- }
-
- // See SANTUARIO-319
- @Test
- public void test_signature_x509_sn() throws Exception {
-
- Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
-
- try {
- ResolverHttp.setProxy(proxy);
-
- TestUtils.switchAllowNotSameDocumentReferences(true);
-
- // Read in plaintext document
- InputStream sourceDocument =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-twenty-three/signature-x509-sn.xml");
- Document document = XMLUtils.read(sourceDocument, false);
-
- // XMLUtils.outputDOM(document, System.out);
-
- // Set up the Key
- CertificateFactory cf = CertificateFactory.getInstance("X509");
- InputStream sourceCert =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-twenty-three/certs/badb.crt");
-
- Certificate cert = cf.generateCertificate(sourceCert);
-
- // Convert Document to a Stream Reader
- javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- transformer.transform(new DOMSource(document), new StreamResult(baos));
-
- XMLStreamReader xmlStreamReader = null;
- try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
- xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
- }
-
- // Verify signature
- XMLSecurityProperties properties = new XMLSecurityProperties();
- properties.setSignatureVerificationKey(cert.getPublicKey());
- InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
- TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
- XMLStreamReader securityStreamReader =
- inboundXMLSec.processInMessage(xmlStreamReader, null, securityEventListener);
-
- StAX2DOM.readDoc(securityStreamReader);
-
- // Check the SecurityEvents
- checkSignatureToken(securityEventListener, cert.getPublicKey(),
- SecurityTokenConstants.KeyIdentifier_X509SubjectName);
- } finally {
- TestUtils.switchAllowNotSameDocumentReferences(false);
- HttpRequestRedirectorProxy.stopHttpEngine();
- }
- }
-
@Test
public void testExcSignature() throws Exception {
// Read in plaintext document
@@ -1140,356 +581,6 @@ public class BaltimoreTest {
StAX2DOM.readDoc(securityStreamReader);
}
- @Test
- public void test_signature_keyname_18() throws Exception {
-
- Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
-
- try {
- ResolverHttp.setProxy(proxy);
-
- TestUtils.switchAllowNotSameDocumentReferences(true);
-
- // Read in plaintext document
- InputStream sourceDocument =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-eighteen/signature-keyname.xml");
- Document document = XMLUtils.read(sourceDocument, false);
-
- // Set up the Key
- CertificateFactory cf = CertificateFactory.getInstance("X509");
- InputStream sourceCert =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-eighteen/certs/lugh.crt");
-
- Certificate cert = cf.generateCertificate(sourceCert);
-
- // XMLUtils.outputDOM(document, System.out);
-
- // Convert Document to a Stream Reader
- javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- transformer.transform(new DOMSource(document), new StreamResult(baos));
-
- XMLStreamReader xmlStreamReader = null;
- try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
- xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
- }
-
- // Verify signature
- XMLSecurityProperties properties = new XMLSecurityProperties();
- properties.setSignatureVerificationKey(cert.getPublicKey());
- InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
- TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
- XMLStreamReader securityStreamReader =
- inboundXMLSec.processInMessage(xmlStreamReader, null, securityEventListener);
-
- StAX2DOM.readDoc(securityStreamReader);
-
- // Check the SecurityEvents
- checkSignatureToken(securityEventListener, cert.getPublicKey(),
- SecurityTokenConstants.KeyIdentifier_KeyName);
- } finally {
- TestUtils.switchAllowNotSameDocumentReferences(false);
- HttpRequestRedirectorProxy.stopHttpEngine();
- }
- }
-
- // See SANTUARIO-319
- @Test
- public void test_signature_retrievalmethod_rawx509crt_18() throws Exception {
-
- Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
-
- try {
- ResolverHttp.setProxy(proxy);
-
- TestUtils.switchAllowNotSameDocumentReferences(true);
-
- // Read in plaintext document
- InputStream sourceDocument =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-eighteen/signature-retrievalmethod-rawx509crt.xml");
- Document document = XMLUtils.read(sourceDocument, false);
-
- // Set up the Key
- CertificateFactory cf = CertificateFactory.getInstance("X509");
- InputStream sourceCert =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-eighteen/certs/balor.crt");
-
- Certificate cert = cf.generateCertificate(sourceCert);
-
- // XMLUtils.outputDOM(document, System.out);
-
- // Convert Document to a Stream Reader
- javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- transformer.transform(new DOMSource(document), new StreamResult(baos));
-
- XMLStreamReader xmlStreamReader = null;
- try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
- xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
- }
-
- // Verify signature
- XMLSecurityProperties properties = new XMLSecurityProperties();
- properties.setSignatureVerificationKey(cert.getPublicKey());
- InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
- XMLStreamReader securityStreamReader = inboundXMLSec.processInMessage(xmlStreamReader);
-
- StAX2DOM.readDoc(securityStreamReader);
- } finally {
- TestUtils.switchAllowNotSameDocumentReferences(false);
- HttpRequestRedirectorProxy.stopHttpEngine();
- }
- }
-
- // See SANTUARIO-319
- @Test
- public void test_signature_x509_crt_crl_18() throws Exception {
-
- Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
-
- try {
- ResolverHttp.setProxy(proxy);
-
- TestUtils.switchAllowNotSameDocumentReferences(true);
-
- // Read in plaintext document
- InputStream sourceDocument =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-eighteen/signature-x509-crt-crl.xml");
- Document document = XMLUtils.read(sourceDocument, false);
-
- // XMLUtils.outputDOM(document, System.out);
-
- // Convert Document to a Stream Reader
- javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- transformer.transform(new DOMSource(document), new StreamResult(baos));
-
- XMLStreamReader xmlStreamReader = null;
- try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
- xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
- }
-
- // Verify signature
- XMLSecurityProperties properties = new XMLSecurityProperties();
- InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
- XMLStreamReader securityStreamReader = inboundXMLSec.processInMessage(xmlStreamReader);
-
- StAX2DOM.readDoc(securityStreamReader);
- } finally {
- TestUtils.switchAllowNotSameDocumentReferences(false);
- HttpRequestRedirectorProxy.stopHttpEngine();
- }
- }
-
- // See SANTUARIO-319
- @Test
- public void test_signature_x509_crt_18() throws Exception {
-
- Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
-
- try {
- ResolverHttp.setProxy(proxy);
-
- TestUtils.switchAllowNotSameDocumentReferences(true);
-
- // Read in plaintext document
- InputStream sourceDocument =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-eighteen/signature-x509-crt.xml");
- Document document = XMLUtils.read(sourceDocument, false);
-
- // XMLUtils.outputDOM(document, System.out);
-
- // Convert Document to a Stream Reader
- javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- transformer.transform(new DOMSource(document), new StreamResult(baos));
-
- XMLStreamReader xmlStreamReader = null;
- try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
- xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
- }
-
- // Verify signature
- XMLSecurityProperties properties = new XMLSecurityProperties();
- InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
- XMLStreamReader securityStreamReader = inboundXMLSec.processInMessage(xmlStreamReader);
-
- StAX2DOM.readDoc(securityStreamReader);
- } finally {
- TestUtils.switchAllowNotSameDocumentReferences(false);
- HttpRequestRedirectorProxy.stopHttpEngine();
- }
- }
-
- // See SANTUARIO-319
- @Test
- public void test_signature_x509_is_18() throws Exception {
-
- Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
-
- try {
- ResolverHttp.setProxy(proxy);
-
- TestUtils.switchAllowNotSameDocumentReferences(true);
-
- // Read in plaintext document
- InputStream sourceDocument =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-eighteen/signature-x509-is.xml");
- Document document = XMLUtils.read(sourceDocument, false);
-
- // XMLUtils.outputDOM(document, System.out);
-
- // Set up the Key
- CertificateFactory cf = CertificateFactory.getInstance("X509");
- InputStream sourceCert =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-eighteen/certs/macha.crt");
-
- Certificate cert = cf.generateCertificate(sourceCert);
-
- // Convert Document to a Stream Reader
- javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- transformer.transform(new DOMSource(document), new StreamResult(baos));
-
- XMLStreamReader xmlStreamReader = null;
- try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
- xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
- }
-
- // Verify signature
- XMLSecurityProperties properties = new XMLSecurityProperties();
- properties.setSignatureVerificationKey(cert.getPublicKey());
- InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
- TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
- XMLStreamReader securityStreamReader =
- inboundXMLSec.processInMessage(xmlStreamReader, null, securityEventListener);
-
- StAX2DOM.readDoc(securityStreamReader);
-
- // Check the SecurityEvents
- checkSignatureToken(securityEventListener, cert.getPublicKey(),
- SecurityTokenConstants.KeyIdentifier_IssuerSerial);
- } finally {
- TestUtils.switchAllowNotSameDocumentReferences(false);
- HttpRequestRedirectorProxy.stopHttpEngine();
- }
- }
-
- // See SANTUARIO-319
- @Test
- public void test_signature_x509_ski_18() throws Exception {
-
- Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
-
- try {
- ResolverHttp.setProxy(proxy);
-
- TestUtils.switchAllowNotSameDocumentReferences(true);
-
- // Read in plaintext document
- InputStream sourceDocument =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-eighteen/signature-x509-ski.xml");
- Document document = XMLUtils.read(sourceDocument, false);
-
- // XMLUtils.outputDOM(document, System.out);
-
- // Set up the Key
- CertificateFactory cf = CertificateFactory.getInstance("X509");
- InputStream sourceCert =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-eighteen/certs/nemain.crt");
-
- Certificate cert = cf.generateCertificate(sourceCert);
-
- // Convert Document to a Stream Reader
- javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- transformer.transform(new DOMSource(document), new StreamResult(baos));
-
- XMLStreamReader xmlStreamReader = null;
- try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
- xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
- }
-
- // Verify signature
- XMLSecurityProperties properties = new XMLSecurityProperties();
- properties.setSignatureVerificationKey(cert.getPublicKey());
- InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
- XMLStreamReader securityStreamReader = inboundXMLSec.processInMessage(xmlStreamReader);
-
- StAX2DOM.readDoc(securityStreamReader);
- } finally {
- TestUtils.switchAllowNotSameDocumentReferences(false);
- HttpRequestRedirectorProxy.stopHttpEngine();
- }
- }
-
- // See SANTUARIO-319
- @Test
- public void test_signature_x509_sn_18() throws Exception {
-
- Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
-
- try {
- ResolverHttp.setProxy(proxy);
-
- TestUtils.switchAllowNotSameDocumentReferences(true);
-
- // Read in plaintext document
- InputStream sourceDocument =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-eighteen/signature-x509-sn.xml");
- Document document = XMLUtils.read(sourceDocument, false);
-
- // XMLUtils.outputDOM(document, System.out);
-
- // Set up the Key
- CertificateFactory cf = CertificateFactory.getInstance("X509");
- InputStream sourceCert =
- this.getClass().getClassLoader().getResourceAsStream(
- "ie/baltimore/merlin-examples/merlin-xmldsig-eighteen/certs/badb.crt");
-
- Certificate cert = cf.generateCertificate(sourceCert);
-
- // Convert Document to a Stream Reader
- javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- transformer.transform(new DOMSource(document), new StreamResult(baos));
-
- XMLStreamReader xmlStreamReader = null;
- try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
- xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
- }
-
- // Verify signature
- XMLSecurityProperties properties = new XMLSecurityProperties();
- properties.setSignatureVerificationKey(cert.getPublicKey());
- InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
- TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
- XMLStreamReader securityStreamReader =
- inboundXMLSec.processInMessage(xmlStreamReader, null, securityEventListener);
-
- StAX2DOM.readDoc(securityStreamReader);
-
- // Check the SecurityEvents
- checkSignatureToken(securityEventListener, cert.getPublicKey(),
- SecurityTokenConstants.KeyIdentifier_X509SubjectName);
- } finally {
- TestUtils.switchAllowNotSameDocumentReferences(false);
- HttpRequestRedirectorProxy.stopHttpEngine();
- }
- }
-
-
private static PublicKey getPublicKey(String algo, int number)
throws InvalidKeySpecException, NoSuchAlgorithmException {
KeyFactory kf = KeyFactory.getInstance(algo);
Added: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/IAIKRemoteReferenceTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/IAIKRemoteReferenceTest.java?rev=1876028&view=auto
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/IAIKRemoteReferenceTest.java (added)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/IAIKRemoteReferenceTest.java Thu Apr 2 07:20:30 2020
@@ -0,0 +1,213 @@
+/**
+ * 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.stax.signature;
+
+import java.math.BigInteger;
+import java.security.Key;
+import java.security.KeyFactory;
+import java.security.NoSuchAlgorithmException;
+import java.security.PublicKey;
+import java.security.spec.DSAPublicKeySpec;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.KeySpec;
+import java.security.spec.RSAPublicKeySpec;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.xml.security.exceptions.XMLSecurityException;
+import org.apache.xml.security.stax.config.Init;
+import org.apache.xml.security.stax.ext.InboundXMLSec;
+import org.apache.xml.security.stax.ext.XMLSec;
+import org.apache.xml.security.stax.ext.XMLSecurityProperties;
+import org.apache.xml.security.stax.impl.securityToken.KeyNameSecurityToken;
+import org.apache.xml.security.stax.impl.securityToken.X509IssuerSerialSecurityToken;
+import org.apache.xml.security.stax.impl.securityToken.X509SecurityToken;
+import org.apache.xml.security.stax.impl.securityToken.X509SubjectNameSecurityToken;
+import org.apache.xml.security.stax.securityEvent.DefaultTokenSecurityEvent;
+import org.apache.xml.security.stax.securityEvent.KeyNameTokenSecurityEvent;
+import org.apache.xml.security.stax.securityEvent.SecurityEventConstants;
+import org.apache.xml.security.stax.securityEvent.X509TokenSecurityEvent;
+import org.apache.xml.security.stax.securityToken.SecurityTokenConstants;
+import org.apache.xml.security.test.stax.utils.StAX2DOM;
+import org.apache.xml.security.test.stax.utils.XMLSecEventAllocator;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+
+/**
+ * This test is to ensure interoperability with the examples provided by the IAIK
+ * XML Signature implementation. Thanks to Gregor Karlinger who provided these
+ * test vectors. They are located in the directory <CODE>data/at/iaik/ixsil/</CODE>.
+ *
+ * These are separated out from IAIKTest as we have to change the default configuration to set
+ * "AllowNotSameDocumentReferences" to "true".
+ */
+public class IAIKRemoteReferenceTest {
+
+ // Define the Keys
+ private static final String DSA_Y =
+ "33765117117947274661410382382650381161343617353664210170104406353610701044610078240124960165589268013959628883158481521066490826259260800878347905093229352801096566573507150438307560047568318507187154066482564350264253492725510108330786058643267447097509233135065057837400865193836500518383366090134577741053";
+ private static final String DSA_P =
+ "91634265413269728335373456840902298947347457680573446480385884712203252882476860316549099567586720335306748578940814977769093940974266715233397005957274714637390846659304524279579796384844387472915589310715455237001400834751102257352922064898227481939437670342534515495271294497038496656824770631295812638999";
+ private static final String DSA_Q =
+ "1429042367422631366787309673414805238266287675163";
+ private static final String DSA_G =
+ "55996752437939033808848513898546387171938363874894496914563143236312388388575433783546897866725079197988900114055877651265845210275099560192808554894952746896447422004598952101382809226581856515647962078133491799837520059128557664983865646964858235956075258101815411978037059289614937207339691043148996572947";
+
+ private static final String RSA_MOD =
+ "123741519167989388559377626745542702486926628431631931688706922056140679850039257167520167484412112276535334078519003803614712993739893643126140460918237455879023461779027296599477635539211426788386258873478147007239191180574000289143927884425647619290073015083375160571949522764083669597074190296532088216887";
+ private static final String RSA_PUB =
+ "3";
+
+ private XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
+
+ @BeforeAll
+ public static void setUp() throws Exception {
+ XMLSec.init();
+ Init.init(IAIKRemoteReferenceTest.class.getClassLoader().getResource("security-config-allow-same-doc.xml").toURI(),
+ IAIKRemoteReferenceTest.class);
+ org.apache.xml.security.Init.init();
+ }
+
+ public IAIKRemoteReferenceTest() throws Exception {
+ xmlInputFactory.setEventAllocator(new XMLSecEventAllocator());
+ }
+
+ // See SANTUARIO-322
+ @Test
+ public void test_transforms_signatures_base64DecodeSignature() throws Exception {
+ // Set up the Key
+ Key publicKey = getPublicKey("RSA");
+
+ final XMLStreamReader xmlStreamReader =
+ xmlInputFactory.createXMLStreamReader(
+ new StreamSource(
+ this.getClass().getClassLoader().getResource(
+ "at/iaik/ixsil/transforms/signatures/base64DecodeSignature.xml").toExternalForm()
+ )
+ );
+
+ // Verify signature
+ XMLSecurityProperties properties = new XMLSecurityProperties();
+ properties.setSignatureVerificationKey(publicKey);
+ InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
+ TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
+ XMLStreamReader securityStreamReader =
+ inboundXMLSec.processInMessage(xmlStreamReader, null, securityEventListener);
+
+ StAX2DOM.readDoc(securityStreamReader);
+
+ // Check the SecurityEvents
+ checkSignatureToken(securityEventListener, getPublicKey("RSA"),
+ SecurityTokenConstants.KeyIdentifier_KeyValue);
+ }
+
+ // See SANTUARIO-322
+ @Test
+ public void test_transforms_signatures_c14nSignature() throws Exception {
+ // Set up the Key
+ Key publicKey = getPublicKey("RSA");
+
+ final XMLStreamReader xmlStreamReader =
+ xmlInputFactory.createXMLStreamReader(
+ new StreamSource(
+ this.getClass().getClassLoader().getResource(
+ "at/iaik/ixsil/transforms/signatures/c14nSignature.xml").toExternalForm()
+ )
+ );
+
+ // Verify signature
+ XMLSecurityProperties properties = new XMLSecurityProperties();
+ properties.setSignatureVerificationKey(publicKey);
+ InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
+ TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
+ XMLStreamReader securityStreamReader =
+ inboundXMLSec.processInMessage(xmlStreamReader, null, securityEventListener);
+
+ StAX2DOM.readDoc(securityStreamReader);
+
+ // Check the SecurityEvents
+ checkSignatureToken(securityEventListener, getPublicKey("RSA"),
+ SecurityTokenConstants.KeyIdentifier_KeyValue);
+ }
+
+ private static PublicKey getPublicKey(String algo)
+ throws InvalidKeySpecException, NoSuchAlgorithmException {
+ KeyFactory kf = KeyFactory.getInstance(algo);
+ KeySpec kspec = null;
+ if ("DSA".equalsIgnoreCase(algo)) {
+ kspec = new DSAPublicKeySpec(new BigInteger(DSA_Y),
+ new BigInteger(DSA_P),
+ new BigInteger(DSA_Q),
+ new BigInteger(DSA_G));
+ } else if ("RSA".equalsIgnoreCase(algo)) {
+ kspec = new RSAPublicKeySpec(new BigInteger(RSA_MOD),
+ new BigInteger(RSA_PUB));
+ } else {
+ throw new RuntimeException("Unsupported key algorithm " + algo);
+ }
+ return kf.generatePublic(kspec);
+ }
+
+ private void checkSignatureToken(
+ TestSecurityEventListener securityEventListener,
+ Key key,
+ SecurityTokenConstants.KeyIdentifier keyIdentifier
+ ) throws XMLSecurityException {
+ if (SecurityTokenConstants.KeyIdentifier_KeyValue.equals(keyIdentifier)) { //NOPMD
+
+ } else if (SecurityTokenConstants.KeyIdentifier_NoKeyInfo.equals(keyIdentifier)) {
+ DefaultTokenSecurityEvent tokenEvent =
+ (DefaultTokenSecurityEvent)securityEventListener.getSecurityEvent(SecurityEventConstants.DefaultToken);
+ assertNotNull(tokenEvent);
+ Key processedKey = tokenEvent.getSecurityToken().getSecretKey().values().iterator().next();
+ assertEquals(processedKey, key);
+ } else if (SecurityTokenConstants.KeyIdentifier_KeyName.equals(keyIdentifier)) {
+ KeyNameTokenSecurityEvent tokenEvent =
+ (KeyNameTokenSecurityEvent)securityEventListener.getSecurityEvent(SecurityEventConstants.KeyNameToken);
+ assertNotNull(tokenEvent);
+ Key processedKey = tokenEvent.getSecurityToken().getSecretKey().values().iterator().next();
+ assertEquals(processedKey, key);
+ assertNotNull(((KeyNameSecurityToken)tokenEvent.getSecurityToken()).getKeyName());
+ } else {
+ X509TokenSecurityEvent tokenEvent =
+ (X509TokenSecurityEvent)securityEventListener.getSecurityEvent(SecurityEventConstants.X509Token);
+ assertNotNull(tokenEvent);
+ X509SecurityToken x509SecurityToken =
+ (X509SecurityToken)tokenEvent.getSecurityToken();
+ assertNotNull(x509SecurityToken);
+ if (SecurityTokenConstants.KeyIdentifier_X509SubjectName.equals(keyIdentifier)) {
+ Key processedKey = x509SecurityToken.getPublicKey();
+ assertEquals(processedKey, key);
+ assertNotNull(((X509SubjectNameSecurityToken)x509SecurityToken).getSubjectName());
+ } else if (SecurityTokenConstants.KeyIdentifier_IssuerSerial.equals(keyIdentifier)) {
+ Key processedKey = x509SecurityToken.getPublicKey();
+ assertEquals(processedKey, key);
+ assertNotNull(((X509IssuerSerialSecurityToken)x509SecurityToken).getIssuerName());
+ assertNotNull(((X509IssuerSerialSecurityToken)x509SecurityToken).getSerialNumber());
+ }
+ }
+
+ }
+}
\ No newline at end of file
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/IAIKTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/IAIKTest.java?rev=1876028&r1=1876027&r2=1876028&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/IAIKTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/IAIKTest.java Thu Apr 2 07:20:30 2020
@@ -40,7 +40,6 @@ import javax.xml.stream.XMLStreamReader;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
import org.apache.xml.security.exceptions.XMLSecurityException;
import org.apache.xml.security.stax.config.Init;
@@ -57,7 +56,6 @@ import org.apache.xml.security.stax.secu
import org.apache.xml.security.stax.securityEvent.X509TokenSecurityEvent;
import org.apache.xml.security.stax.securityToken.SecurityTokenConstants;
import org.apache.xml.security.test.stax.utils.StAX2DOM;
-import org.apache.xml.security.test.stax.utils.TestUtils;
import org.apache.xml.security.test.stax.utils.XMLSecEventAllocator;
import org.apache.xml.security.utils.XMLUtils;
import org.junit.jupiter.api.BeforeEach;
@@ -245,74 +243,6 @@ public class IAIKTest {
// Check the SecurityEvents
checkSignatureToken(securityEventListener, getPublicKey("RSA"),
- SecurityTokenConstants.KeyIdentifier_KeyValue);
- }
-
- // See SANTUARIO-322
- @Test
- public void test_transforms_signatures_base64DecodeSignature() throws Exception {
- // Set up the Key
- Key publicKey = getPublicKey("RSA");
-
- final XMLStreamReader xmlStreamReader =
- xmlInputFactory.createXMLStreamReader(
- new StreamSource(
- this.getClass().getClassLoader().getResource(
- "at/iaik/ixsil/transforms/signatures/base64DecodeSignature.xml").toExternalForm()
- )
- );
-
- // Verify signature
- XMLSecurityProperties properties = new XMLSecurityProperties();
- properties.setSignatureVerificationKey(publicKey);
- InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
- TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
- XMLStreamReader securityStreamReader =
- inboundXMLSec.processInMessage(xmlStreamReader, null, securityEventListener);
-
- try {
- TestUtils.switchAllowNotSameDocumentReferences(true);
- StAX2DOM.readDoc(securityStreamReader);
- } finally {
- TestUtils.switchAllowNotSameDocumentReferences(false);
- }
-
- // Check the SecurityEvents
- checkSignatureToken(securityEventListener, getPublicKey("RSA"),
- SecurityTokenConstants.KeyIdentifier_KeyValue);
- }
-
- // See SANTUARIO-322
- @Test
- public void test_transforms_signatures_c14nSignature() throws Exception {
- // Set up the Key
- Key publicKey = getPublicKey("RSA");
-
- final XMLStreamReader xmlStreamReader =
- xmlInputFactory.createXMLStreamReader(
- new StreamSource(
- this.getClass().getClassLoader().getResource(
- "at/iaik/ixsil/transforms/signatures/c14nSignature.xml").toExternalForm()
- )
- );
-
- // Verify signature
- XMLSecurityProperties properties = new XMLSecurityProperties();
- properties.setSignatureVerificationKey(publicKey);
- InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
- TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
- XMLStreamReader securityStreamReader =
- inboundXMLSec.processInMessage(xmlStreamReader, null, securityEventListener);
-
- try {
- TestUtils.switchAllowNotSameDocumentReferences(true);
- StAX2DOM.readDoc(securityStreamReader);
- } finally {
- TestUtils.switchAllowNotSameDocumentReferences(false);
- }
-
- // Check the SecurityEvents
- checkSignatureToken(securityEventListener, getPublicKey("RSA"),
SecurityTokenConstants.KeyIdentifier_KeyValue);
}
Added: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/PhaosRemoteReferenceTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/PhaosRemoteReferenceTest.java?rev=1876028&view=auto
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/PhaosRemoteReferenceTest.java (added)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/PhaosRemoteReferenceTest.java Thu Apr 2 07:20:30 2020
@@ -0,0 +1,201 @@
+/**
+ * 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.stax.signature;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.net.Proxy;
+import java.nio.charset.StandardCharsets;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.xml.security.stax.config.Init;
+import org.apache.xml.security.stax.ext.InboundXMLSec;
+import org.apache.xml.security.stax.ext.XMLSec;
+import org.apache.xml.security.stax.ext.XMLSecurityProperties;
+import org.apache.xml.security.stax.impl.resourceResolvers.ResolverHttp;
+import org.apache.xml.security.test.stax.utils.HttpRequestRedirectorProxy;
+import org.apache.xml.security.test.stax.utils.StAX2DOM;
+import org.apache.xml.security.test.stax.utils.XMLSecEventAllocator;
+import org.apache.xml.security.utils.XMLUtils;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import org.w3c.dom.Document;
+
+
+/**
+ * This is a testcase to validate all "phaos-xmldsig-three"
+ * testcases from Phaos
+ *
+ * These are separated out from PhaosTest as we have to change the default configuration to set
+ * "AllowNotSameDocumentReferences" to "true".
+ */
+public class PhaosRemoteReferenceTest {
+
+ private XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
+ private TransformerFactory transformerFactory = TransformerFactory.newInstance();
+
+ @BeforeAll
+ public static void setUp() throws Exception {
+ XMLSec.init();
+ Init.init(PhaosRemoteReferenceTest.class.getClassLoader()
+ .getResource("security-config-allow-same-doc.xml").toURI(),
+ PhaosRemoteReferenceTest.class);
+ org.apache.xml.security.Init.init();
+ }
+
+ public PhaosRemoteReferenceTest() throws Exception {
+ xmlInputFactory.setEventAllocator(new XMLSecEventAllocator());
+ }
+
+ // See SANTUARIO-319
+ @Test
+ public void test_signature_dsa_detached() throws Exception {
+
+ Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
+
+ try {
+ ResolverHttp.setProxy(proxy);
+
+ // Read in plaintext document
+ InputStream sourceDocument =
+ this.getClass().getClassLoader().getResourceAsStream(
+ "com/phaos/phaos-xmldsig-three/signature-dsa-detached.xml");
+ Document document = XMLUtils.read(sourceDocument, false);
+
+ // XMLUtils.outputDOM(document, System.out);
+
+ // Convert Document to a Stream Reader
+ javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ transformer.transform(new DOMSource(document), new StreamResult(baos));
+
+ XMLStreamReader xmlStreamReader = null;
+ try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
+ xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
+ }
+
+ // Verify signature
+ XMLSecurityProperties properties = new XMLSecurityProperties();
+ InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
+ TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
+ XMLStreamReader securityStreamReader =
+ inboundXMLSec.processInMessage(xmlStreamReader, null, securityEventListener);
+
+ StAX2DOM.readDoc(securityStreamReader);
+ } finally {
+ HttpRequestRedirectorProxy.stopHttpEngine();
+ }
+ }
+
+ // See SANTUARIO-319
+ @Test
+ public void test_signature_hmac_sha1_exclusive_c14n_comments_detached() throws Exception {
+
+ Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
+
+ try {
+ ResolverHttp.setProxy(proxy);
+
+ // Read in plaintext document
+ InputStream sourceDocument =
+ this.getClass().getClassLoader().getResourceAsStream(
+ "com/phaos/phaos-xmldsig-three/signature-hmac-sha1-exclusive-c14n-comments-detached.xml");
+ Document document = XMLUtils.read(sourceDocument, false);
+
+ // Set up the key
+ byte[] hmacKey = "test".getBytes(StandardCharsets.US_ASCII);
+ SecretKey key = new SecretKeySpec(hmacKey, "http://www.w3.org/2000/09/xmldsig#hmac-sha1");
+
+ // XMLUtils.outputDOM(document, System.out);
+
+ // Convert Document to a Stream Reader
+ javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ transformer.transform(new DOMSource(document), new StreamResult(baos));
+
+ XMLStreamReader xmlStreamReader = null;
+ try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
+ xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
+ }
+
+ // Verify signature
+ XMLSecurityProperties properties = new XMLSecurityProperties();
+ properties.setSignatureVerificationKey(key);
+ InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
+ TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
+ XMLStreamReader securityStreamReader =
+ inboundXMLSec.processInMessage(xmlStreamReader, null, securityEventListener);
+
+ StAX2DOM.readDoc(securityStreamReader);
+ } finally {
+ HttpRequestRedirectorProxy.stopHttpEngine();
+ }
+ }
+
+ // See SANTUARIO-319
+ @Test
+ public void test_signature_rsa_detached() throws Exception {
+
+ Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
+
+ try {
+ ResolverHttp.setProxy(proxy);
+
+ // Read in plaintext document
+ InputStream sourceDocument =
+ this.getClass().getClassLoader().getResourceAsStream(
+ "com/phaos/phaos-xmldsig-three/signature-rsa-detached.xml");
+ Document document = XMLUtils.read(sourceDocument, false);
+
+ // XMLUtils.outputDOM(document, System.out);
+
+ // Convert Document to a Stream Reader
+ javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ transformer.transform(new DOMSource(document), new StreamResult(baos));
+
+ XMLStreamReader xmlStreamReader = null;
+ try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
+ xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
+ }
+
+ // Verify signature
+ XMLSecurityProperties properties = new XMLSecurityProperties();
+ InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
+ TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
+ XMLStreamReader securityStreamReader =
+ inboundXMLSec.processInMessage(xmlStreamReader, null, securityEventListener);
+
+ StAX2DOM.readDoc(securityStreamReader);
+ } finally {
+ HttpRequestRedirectorProxy.stopHttpEngine();
+ }
+ }
+
+
+}
\ No newline at end of file
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/PhaosTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/PhaosTest.java?rev=1876028&r1=1876027&r2=1876028&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/PhaosTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/stax/signature/PhaosTest.java Thu Apr 2 07:20:30 2020
@@ -23,8 +23,6 @@ import org.apache.xml.security.stax.conf
import org.apache.xml.security.stax.ext.InboundXMLSec;
import org.apache.xml.security.stax.ext.XMLSec;
import org.apache.xml.security.stax.ext.XMLSecurityProperties;
-import org.apache.xml.security.stax.impl.resourceResolvers.ResolverHttp;
-import org.apache.xml.security.test.stax.utils.HttpRequestRedirectorProxy;
import org.apache.xml.security.test.stax.utils.StAX2DOM;
import org.apache.xml.security.test.stax.utils.TestUtils;
import org.apache.xml.security.test.stax.utils.XMLSecEventAllocator;
@@ -45,7 +43,6 @@ import javax.xml.transform.stream.Stream
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
-import java.net.Proxy;
import java.nio.charset.StandardCharsets;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -72,50 +69,6 @@ public class PhaosTest {
xmlInputFactory.setEventAllocator(new XMLSecEventAllocator());
}
-
- // See SANTUARIO-319
- @Test
- public void test_signature_dsa_detached() throws Exception {
-
- Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
-
- try {
- ResolverHttp.setProxy(proxy);
-
- TestUtils.switchAllowNotSameDocumentReferences(true);
-
- // Read in plaintext document
- InputStream sourceDocument =
- this.getClass().getClassLoader().getResourceAsStream(
- "com/phaos/phaos-xmldsig-three/signature-dsa-detached.xml");
- Document document = XMLUtils.read(sourceDocument, false);
-
- // XMLUtils.outputDOM(document, System.out);
-
- // Convert Document to a Stream Reader
- javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- transformer.transform(new DOMSource(document), new StreamResult(baos));
-
- XMLStreamReader xmlStreamReader = null;
- try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
- xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
- }
-
- // Verify signature
- XMLSecurityProperties properties = new XMLSecurityProperties();
- InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
- TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
- XMLStreamReader securityStreamReader =
- inboundXMLSec.processInMessage(xmlStreamReader, null, securityEventListener);
-
- StAX2DOM.readDoc(securityStreamReader);
- } finally {
- TestUtils.switchAllowNotSameDocumentReferences(false);
- HttpRequestRedirectorProxy.stopHttpEngine();
- }
- }
-
// See Santuario-320
@Test
public void test_signature_dsa_enveloped() throws Exception {
@@ -177,54 +130,6 @@ public class PhaosTest {
StAX2DOM.readDoc(securityStreamReader);
}
- // See SANTUARIO-319
- @Test
- public void test_signature_hmac_sha1_exclusive_c14n_comments_detached() throws Exception {
-
- Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
-
- try {
- ResolverHttp.setProxy(proxy);
-
- TestUtils.switchAllowNotSameDocumentReferences(true);
-
- // Read in plaintext document
- InputStream sourceDocument =
- this.getClass().getClassLoader().getResourceAsStream(
- "com/phaos/phaos-xmldsig-three/signature-hmac-sha1-exclusive-c14n-comments-detached.xml");
- Document document = XMLUtils.read(sourceDocument, false);
-
- // Set up the key
- byte[] hmacKey = "test".getBytes(StandardCharsets.US_ASCII);
- SecretKey key = new SecretKeySpec(hmacKey, "http://www.w3.org/2000/09/xmldsig#hmac-sha1");
-
- // XMLUtils.outputDOM(document, System.out);
-
- // Convert Document to a Stream Reader
- javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- transformer.transform(new DOMSource(document), new StreamResult(baos));
-
- XMLStreamReader xmlStreamReader = null;
- try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
- xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
- }
-
- // Verify signature
- XMLSecurityProperties properties = new XMLSecurityProperties();
- properties.setSignatureVerificationKey(key);
- InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
- TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
- XMLStreamReader securityStreamReader =
- inboundXMLSec.processInMessage(xmlStreamReader, null, securityEventListener);
-
- StAX2DOM.readDoc(securityStreamReader);
- } finally {
- TestUtils.switchAllowNotSameDocumentReferences(false);
- HttpRequestRedirectorProxy.stopHttpEngine();
- }
- }
-
// See Santuario-320
@Test
public void test_signature_hmac_sha1_exclusive_c14n_enveloped() throws Exception {
@@ -301,49 +206,6 @@ public class PhaosTest {
}
}
- // See SANTUARIO-319
- @Test
- public void test_signature_rsa_detached() throws Exception {
-
- Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();
-
- try {
- ResolverHttp.setProxy(proxy);
-
- TestUtils.switchAllowNotSameDocumentReferences(true);
-
- // Read in plaintext document
- InputStream sourceDocument =
- this.getClass().getClassLoader().getResourceAsStream(
- "com/phaos/phaos-xmldsig-three/signature-rsa-detached.xml");
- Document document = XMLUtils.read(sourceDocument, false);
-
- // XMLUtils.outputDOM(document, System.out);
-
- // Convert Document to a Stream Reader
- javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- transformer.transform(new DOMSource(document), new StreamResult(baos));
-
- XMLStreamReader xmlStreamReader = null;
- try (InputStream is = new ByteArrayInputStream(baos.toByteArray())) {
- xmlStreamReader = xmlInputFactory.createXMLStreamReader(is);
- }
-
- // Verify signature
- XMLSecurityProperties properties = new XMLSecurityProperties();
- InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
- TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
- XMLStreamReader securityStreamReader =
- inboundXMLSec.processInMessage(xmlStreamReader, null, securityEventListener);
-
- StAX2DOM.readDoc(securityStreamReader);
- } finally {
- TestUtils.switchAllowNotSameDocumentReferences(false);
- HttpRequestRedirectorProxy.stopHttpEngine();
- }
- }
-
// See Santuario-320
@Test
public void test_signature_rsa_enveloped_bad_digest_val() throws Exception {