Search in sources :

Example 36 with ResourceResolverSpi

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

the class IAIKTest method test_coreFeatures_signatures_manifestSignature_manifest.

/**
 * Method test_coreFeatures_signatures_manifestSignature_manifest
 *
 * @throws Exception
 */
@org.junit.Test
public void test_coreFeatures_signatures_manifestSignature_manifest() throws Exception {
    String filename = gregorsDir + "coreFeatures/signatures/manifestSignature.xml";
    ResourceResolverSpi resolver = null;
    boolean followManifests = true;
    boolean verify = false;
    try {
        verify = this.verify(filename, resolver, followManifests, false);
    } catch (RuntimeException ex) {
        LOG.error("Verification crashed for " + filename);
        throw ex;
    }
    if (!verify) {
        LOG.error("Following the ds:Manifest failed for " + filename);
    }
    assertTrue("Following the ds:Manifest failed for " + filename, verify);
}
Also used : ResourceResolverSpi(org.apache.xml.security.utils.resolver.ResourceResolverSpi)

Example 37 with ResourceResolverSpi

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

the class IAIKTest method test_transforms_signatures_base64DecodeSignature.

/**
 * Method test_transforms_signatures_base64DecodeSignature
 *
 * @throws Exception
 */
@org.junit.Test
public void test_transforms_signatures_base64DecodeSignature() throws Exception {
    String filename = gregorsDir + "transforms/signatures/base64DecodeSignature.xml";
    ResourceResolverSpi resolver = null;
    boolean followManifests = false;
    boolean verify = false;
    try {
        verify = this.verify(filename, resolver, followManifests, false);
    } 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)

Example 38 with ResourceResolverSpi

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

the class IAIKTest method test_signatureAlgorithms_signatures_hMACShortSignature.

/**
 * Method test_signatureAlgorithms_signatures_hMACShortSignature
 *
 * @throws Exception
 */
@org.junit.Test
public void test_signatureAlgorithms_signatures_hMACShortSignature() throws Exception {
    String filename = gregorsDir + "signatureAlgorithms/signatures/hMACShortSignature.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 39 with ResourceResolverSpi

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

the class IAIKTest method test_signatureAlgorithms_signatures_dSASignature.

/**
 * Method test_signatureAlgorithms_signatures_dSASignature
 *
 * @throws Exception
 */
@org.junit.Test
public void test_signatureAlgorithms_signatures_dSASignature() throws Exception {
    String filename = gregorsDir + "signatureAlgorithms/signatures/dSASignature.xml";
    ResourceResolverSpi resolver = null;
    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)

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