aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/at/gv/egiz/moazs
diff options
context:
space:
mode:
authorChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-08-19 15:47:42 +0200
committerChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-08-19 16:29:06 +0200
commit631af9a4ab6b75e11ab369c3a7d9ab22e60341e8 (patch)
treec48216e148073dd1e2f1eda612efac95eb1b7ff0 /src/test/java/at/gv/egiz/moazs
parent5364b724171b242510d2ccb5788b458d9c47f980 (diff)
downloadmoa-zs-631af9a4ab6b75e11ab369c3a7d9ab22e60341e8.tar.gz
moa-zs-631af9a4ab6b75e11ab369c3a7d9ab22e60341e8.tar.bz2
moa-zs-631af9a4ab6b75e11ab369c3a7d9ab22e60341e8.zip
Add Two "VerifySignature" Testcases
Diffstat (limited to 'src/test/java/at/gv/egiz/moazs')
-rw-r--r--src/test/java/at/gv/egiz/moazs/ITSignatureVerifierTest.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/test/java/at/gv/egiz/moazs/ITSignatureVerifierTest.java b/src/test/java/at/gv/egiz/moazs/ITSignatureVerifierTest.java
index 592b108..af958a5 100644
--- a/src/test/java/at/gv/egiz/moazs/ITSignatureVerifierTest.java
+++ b/src/test/java/at/gv/egiz/moazs/ITSignatureVerifierTest.java
@@ -2,14 +2,20 @@ package at.gv.egiz.moazs;
import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.api.ISignatureVerificationService;
import at.gv.egiz.moazs.backend.SignatureVerifier;
+import at.gv.egiz.moazs.scheme.SOAPUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.test.context.junit4.SpringRunner;
+import org.xml.sax.SAXException;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
@@ -19,6 +25,8 @@ import java.nio.file.Files;
@SpringBootTest
public class ITSignatureVerifierTest {
+ private static final Logger log = LoggerFactory.getLogger(ITSignatureVerifierTest.class);
+
private final String resourcesPath = "src/test/resources/at/gv/egiz/moazs/ITSignatureVerifierTest/";
@TestConfiguration
@@ -62,4 +70,34 @@ import java.nio.file.Files;
verifier.accept(signature);
}
+
+ @Test
+ public void acceptValidSoapedDeliveryNotification() throws IOException, ParserConfigurationException, SAXException, TransformerException {
+
+ var path = resourcesPath + "valid-signed-soaped-notification.xml";
+ var soapedNotificationBytes = Files.readAllBytes(new File(path).toPath());
+
+ var soapUtils = new SOAPUtils();
+ var soapedNotification = soapUtils.toDOM(soapedNotificationBytes);
+ var deliveryNotificationNode = soapUtils.getChildElementOfSoapBody(soapedNotification);
+ var notificationBytes = soapUtils.toBytes(deliveryNotificationNode);
+
+ verifier.accept(notificationBytes);
+ }
+
+ //shuffled means that the <dsig:Signature> was moved from it's original
+ //place to a different place.
+ @Test
+ public void acceptValidShuffledSoapedDeliveryNotification() throws IOException, ParserConfigurationException, SAXException, TransformerException {
+
+ var path = resourcesPath + "valid-signed-shuffled-soaped-notification.xml";
+ var soapedNotificationBytes = Files.readAllBytes(new File(path).toPath());
+
+ var soapUtils = new SOAPUtils();
+ var soapedNotification = soapUtils.toDOM(soapedNotificationBytes);
+ var deliveryNotificationNode = soapUtils.getChildElementOfSoapBody(soapedNotification);
+ var notificationBytes = soapUtils.toBytes(deliveryNotificationNode);
+
+ verifier.accept(notificationBytes);
+ }
}