Search in sources :

Example 1 with OfflineResolver

use of org.apache.xml.security.test.dom.utils.resolver.OfflineResolver in project santuario-java by apache.

the class BaltimoreTest method test_fifteen_enveloped_dsa.

/**
 * Method test_fifteen_enveloped_dsa
 *
 * @throws Exception
 */
@org.junit.Test
public void test_fifteen_enveloped_dsa() throws Exception {
    String filename = merlinsDir15 + "signature-enveloped-dsa.xml";
    ResourceResolverSpi resolver = new OfflineResolver();
    boolean followManifests = false;
    boolean verify = false;
    try {
        verify = this.verify(filename, resolver, followManifests);
    } catch (RuntimeException ex) {
        LOG.error("Verification crashed for " + filename);
        throw ex;
    }
    if (!verify) {
        LOG.error("Verification failed for " + filename);
    }
    assertTrue(filename, verify);
}
Also used : ResourceResolverSpi(org.apache.xml.security.utils.resolver.ResourceResolverSpi) OfflineResolver(org.apache.xml.security.test.dom.utils.resolver.OfflineResolver)

Example 2 with OfflineResolver

use of org.apache.xml.security.test.dom.utils.resolver.OfflineResolver in project santuario-java by apache.

the class BaltimoreTest method test_twenty_three_external_b64_dsa.

/**
 * Method test_twenty_three_external_b64_dsa
 *
 * @throws Exception
 */
@org.junit.Test
public void test_twenty_three_external_b64_dsa() throws Exception {
    String filename = merlinsDir23 + "signature-external-b64-dsa.xml";
    ResourceResolverSpi resolver = new OfflineResolver();
    boolean followManifests = false;
    boolean verify = false;
    try {
        verify = this.verify(filename, resolver, followManifests);
    } catch (RuntimeException ex) {
        LOG.error("Verification crashed for " + filename);
        throw ex;
    }
    if (!verify) {
        LOG.error("Verification failed for " + filename);
    }
    assertTrue(filename, verify);
}
Also used : ResourceResolverSpi(org.apache.xml.security.utils.resolver.ResourceResolverSpi) OfflineResolver(org.apache.xml.security.test.dom.utils.resolver.OfflineResolver)

Example 3 with OfflineResolver

use of org.apache.xml.security.test.dom.utils.resolver.OfflineResolver in project santuario-java by apache.

the class BaltimoreTest method test_sixteen_bad_signature.

/**
 * Method test_sixteen_bad_signature. This tests make sure that an
 * invalid signature is not valid. This is validating merlin's 16
 * signature but some of the referenced content has been modified so
 * some of the references should be invalid.
 *
 * @throws Exception
 */
@org.junit.Test
public void test_sixteen_bad_signature() throws Exception {
    String filename = merlinsDir16 + "/bad-signature.xml";
    ResourceResolverSpi resolver = new OfflineResolver();
    boolean followManifests = false;
    boolean verify = false;
    try {
        verify = this.verify(filename, resolver, followManifests);
    } catch (RuntimeException ex) {
        LOG.error("Verification crashed for " + filename);
        throw ex;
    }
    if (verify) {
        LOG.error("Verification passed (should have failed) for " + filename);
    }
    assertFalse(filename, verify);
}
Also used : ResourceResolverSpi(org.apache.xml.security.utils.resolver.ResourceResolverSpi) OfflineResolver(org.apache.xml.security.test.dom.utils.resolver.OfflineResolver)

Example 4 with OfflineResolver

use of org.apache.xml.security.test.dom.utils.resolver.OfflineResolver in project santuario-java by apache.

the class BaltimoreTest method test_twenty_three_external_dsa_2.

/**
 * Method test_twenty_three_external_dsa_2
 *
 * @throws Exception
 */
@org.junit.Test
public void test_twenty_three_external_dsa_2() throws Exception {
    String filename = merlinsDir23 + "signature.xml";
    ResourceResolverSpi resolver = new OfflineResolver();
    boolean followManifests = false;
    boolean verify = false;
    try {
        verify = this.verify(filename, resolver, followManifests);
    } catch (RuntimeException ex) {
        LOG.error("Verification crashed for " + filename);
        throw ex;
    }
    if (!verify) {
        LOG.error("Verification failed for " + filename);
    }
    assertTrue(filename, verify);
}
Also used : ResourceResolverSpi(org.apache.xml.security.utils.resolver.ResourceResolverSpi) OfflineResolver(org.apache.xml.security.test.dom.utils.resolver.OfflineResolver)

Example 5 with OfflineResolver

use of org.apache.xml.security.test.dom.utils.resolver.OfflineResolver in project santuario-java by apache.

the class IBMTest method test_enveloping_hmac.

/**
 * Method test_enveloping_hmac
 *
 * @throws Exception
 */
@org.junit.Test
public void test_enveloping_hmac() throws Exception {
    if (!runTests) {
        return;
    }
    String filename = kentsDir + "enveloping-hmac.sig";
    ResourceResolverSpi resolver = new OfflineResolver();
    boolean followManifests = false;
    byte[] hmacKey = JavaUtils.getBytesFromFile(kentsDir + "enveloping-hmac.key");
    boolean verify = false;
    try {
        verify = this.verifyHMAC(filename, resolver, followManifests, hmacKey);
    } catch (RuntimeException ex) {
        LOG.error("Verification crashed for " + filename);
        throw ex;
    }
    if (!verify) {
        LOG.error("Verification failed for " + filename);
    }
    assertTrue(filename, verify);
}
Also used : ResourceResolverSpi(org.apache.xml.security.utils.resolver.ResourceResolverSpi) OfflineResolver(org.apache.xml.security.test.dom.utils.resolver.OfflineResolver)

Aggregations

OfflineResolver (org.apache.xml.security.test.dom.utils.resolver.OfflineResolver)23 ResourceResolverSpi (org.apache.xml.security.utils.resolver.ResourceResolverSpi)21 XMLSignatureException (org.apache.xml.security.signature.XMLSignatureException)3