use of org.apache.xml.security.test.dom.utils.resolver.OfflineResolver in project santuario-java by apache.
the class IAIKTest method test_signatureAlgorithms_signatures_hMACSignature.
/**
* Method test_signatureAlgorithms_signatures_hMACSignature
*
* @throws Exception
*/
@org.junit.Test
public void test_signatureAlgorithms_signatures_hMACSignature() throws Exception {
String filename = gregorsDir + "signatureAlgorithms/signatures/hMACSignature.xml";
ResourceResolverSpi resolver = new OfflineResolver();
boolean followManifests = false;
byte[] hmacKey = "secret".getBytes(StandardCharsets.US_ASCII);
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);
}
use of org.apache.xml.security.test.dom.utils.resolver.OfflineResolver in project santuario-java by apache.
the class IAIKTest method test_coreFeatures_signatures_signatureTypesSignature.
/**
* Method test_coreFeatures_signatures_signatureTypesSignature
*
* @throws Exception
*/
@org.junit.Test
public void test_coreFeatures_signatures_signatureTypesSignature() throws Exception {
String filename = gregorsDir + "coreFeatures/signatures/signatureTypesSignature.xml";
ResourceResolverSpi resolver = new OfflineResolver();
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("Verification failed for " + filename, verify);
}
use of org.apache.xml.security.test.dom.utils.resolver.OfflineResolver 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());
}
}
}
Aggregations