Search in sources :

Example 21 with ResourceResolverSpi

use of org.apache.xml.security.utils.resolver.ResourceResolverSpi in project santuario-java by apache.

the class BaltimoreTest method test_twenty_three_enveloping_hmac_sha1_40.

/**
 * Method test_twenty_three_enveloping_hmac_sha1_40
 *
 * @throws Exception
 */
@org.junit.Test
public void test_twenty_three_enveloping_hmac_sha1_40() throws Exception {
    String filename = merlinsDir23 + "signature-enveloping-hmac-sha1-40.xml";
    ResourceResolverSpi resolver = new OfflineResolver();
    boolean followManifests = false;
    byte[] hmacKey = "secret".getBytes(StandardCharsets.US_ASCII);
    try {
        this.verifyHMAC(filename, resolver, followManifests, hmacKey);
        fail("HMACOutputLength Exception not caught");
    } catch (RuntimeException ex) {
        LOG.error("Verification crashed for " + filename);
        throw ex;
    } catch (XMLSignatureException ex) {
        if (!ex.getMsgID().equals("algorithms.HMACOutputLengthMin")) {
            fail(ex.getMessage());
        }
    }
}
Also used : ResourceResolverSpi(org.apache.xml.security.utils.resolver.ResourceResolverSpi) OfflineResolver(org.apache.xml.security.test.dom.utils.resolver.OfflineResolver) XMLSignatureException(org.apache.xml.security.signature.XMLSignatureException)

Example 22 with ResourceResolverSpi

use of org.apache.xml.security.utils.resolver.ResourceResolverSpi in project santuario-java by apache.

the class BaltimoreTest method test_twenty_three_enveloped_dsa.

/**
 * Method test_twenty_three_enveloped_dsa
 *
 * @throws Exception
 */
@org.junit.Test
public void test_twenty_three_enveloped_dsa() throws Exception {
    String filename = merlinsDir23 + "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 23 with ResourceResolverSpi

use of org.apache.xml.security.utils.resolver.ResourceResolverSpi in project santuario-java by apache.

the class BaltimoreTest method test_fifteen_enveloping_rsa.

/**
 * Method test_fifteen_enveloping_rsa
 *
 * @throws Exception
 */
@org.junit.Test
public void test_fifteen_enveloping_rsa() throws Exception {
    String filename = merlinsDir15 + "signature-enveloping-rsa.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 24 with ResourceResolverSpi

use of org.apache.xml.security.utils.resolver.ResourceResolverSpi in project santuario-java by apache.

the class BaltimoreTest method test_sixteen_external_dsa.

/**
 * Method test_sixteen_external_dsa
 *
 * @throws Exception
 */
@org.junit.Test
public void test_sixteen_external_dsa() throws Exception {
    String filename = merlinsDir16 + "/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 25 with ResourceResolverSpi

use of org.apache.xml.security.utils.resolver.ResourceResolverSpi in project santuario-java by apache.

the class IBMTest method test_detached_dsa.

/**
 * Method test_detached_dsa
 *
 * @throws Exception
 */
@org.junit.Test
public void test_detached_dsa() throws Exception {
    if (!runTests) {
        return;
    }
    String filename = kentsDir + "detached-dsa.sig";
    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)

Aggregations

ResourceResolverSpi (org.apache.xml.security.utils.resolver.ResourceResolverSpi)39 OfflineResolver (org.apache.xml.security.test.dom.utils.resolver.OfflineResolver)21 XMLSignatureException (org.apache.xml.security.signature.XMLSignatureException)3 File (java.io.File)1 ResolverAnonymous (org.apache.xml.security.utils.resolver.implementations.ResolverAnonymous)1