diff options
author | Christof Rabensteiner <christof.rabensteiner@iaik.tugraz.at> | 2019-06-19 11:07:11 +0200 |
---|---|---|
committer | Christof Rabensteiner <christof.rabensteiner@iaik.tugraz.at> | 2019-06-19 11:07:11 +0200 |
commit | a867ca9950c6bf670407b366ee2980eb747358f2 (patch) | |
tree | 48646b2f2853050295da92561e08a9283f26d1c2 /src/test/java/at/gv | |
parent | 5d183fd9535d80e5066647e0501da881bcac4d58 (diff) | |
download | moa-zs-a867ca9950c6bf670407b366ee2980eb747358f2.tar.gz moa-zs-a867ca9950c6bf670407b366ee2980eb747358f2.tar.bz2 moa-zs-a867ca9950c6bf670407b366ee2980eb747358f2.zip |
Add Testcase: Reject Invalid Delivery Response Signature
Diffstat (limited to 'src/test/java/at/gv')
-rw-r--r-- | src/test/java/at/gv/egiz/moazs/MoaSPSSSignatureVerifierTest.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/test/java/at/gv/egiz/moazs/MoaSPSSSignatureVerifierTest.java b/src/test/java/at/gv/egiz/moazs/MoaSPSSSignatureVerifierTest.java index afa817f..7d3e9d1 100644 --- a/src/test/java/at/gv/egiz/moazs/MoaSPSSSignatureVerifierTest.java +++ b/src/test/java/at/gv/egiz/moazs/MoaSPSSSignatureVerifierTest.java @@ -5,8 +5,6 @@ import at.gv.egiz.moazs.verify.MoaSPSSSignatureVerifier; import at.gv.egiz.moazs.verify.SignatureVerifier; 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; @@ -17,6 +15,7 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; +//Note: Certificate that signed these delivery responses expires in 2023-09-27. @RunWith(SpringRunner.class) @SpringBootTest public class MoaSPSSSignatureVerifierTest { @@ -36,7 +35,6 @@ import java.nio.file.Files; @Autowired private SignatureVerifier verifier; - //TODO make sure that testcase does not depend on runtime because it's certificate expires in 2023-09-27. @Test public void acceptValidSignedDeliveryResponse() throws IOException { @@ -46,4 +44,13 @@ import java.nio.file.Files; verifier.verify(signature); } + @Test(expected = MoaZSException.class) + public void rejectInvalidSignedDeliveryResponse() throws IOException { + + var path = resourcesPath + "invalid-signed-delivery-response.xml"; + var signature = Files.readAllBytes(new File(path).toPath()); + + verifier.verify(signature); + } + } |