aboutsummaryrefslogtreecommitdiff
path: root/DocumentService/src/eu/stork/documentservice/tests/EncryptionTests.java
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2016-02-17 07:00:09 +0100
committerThomas Lenz <tlenz@iaik.tugraz.at>2016-02-17 07:00:09 +0100
commit07c6114a266a67abd404bac8703c1a17e035d69d (patch)
tree893d8a4873566b2bf3d4dc8d35d02e636a9d38cd /DocumentService/src/eu/stork/documentservice/tests/EncryptionTests.java
parent274a85e53fa8c06a869f2bb3a7bd24300ee9b3fd (diff)
downloadmoa-id-spss-07c6114a266a67abd404bac8703c1a17e035d69d.tar.gz
moa-id-spss-07c6114a266a67abd404bac8703c1a17e035d69d.tar.bz2
moa-id-spss-07c6114a266a67abd404bac8703c1a17e035d69d.zip
remove STORK code --> MOA-ID >= 3.2 only supports eIDAS protocol
Diffstat (limited to 'DocumentService/src/eu/stork/documentservice/tests/EncryptionTests.java')
-rw-r--r--DocumentService/src/eu/stork/documentservice/tests/EncryptionTests.java63
1 files changed, 0 insertions, 63 deletions
diff --git a/DocumentService/src/eu/stork/documentservice/tests/EncryptionTests.java b/DocumentService/src/eu/stork/documentservice/tests/EncryptionTests.java
deleted file mode 100644
index 9ac0862cf..000000000
--- a/DocumentService/src/eu/stork/documentservice/tests/EncryptionTests.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package eu.stork.documentservice.tests;
-
-import static org.junit.Assert.*;
-
-import java.util.Arrays;
-
-import org.junit.Test;
-
-import eu.stork.documentservice.exceptions.EncryptionException;
-import eu.stork.documentservice.utils.EncryptionHelper;
-import eu.stork.documentservice.utils.Utils;
-
-public class EncryptionTests {
-
- private String pdfLoc = "C:/Temp/temp.pdf";
- private String certLocation = "C:/Temp/testcert.pem";
- private static String encKey;
- private static String encIv;
-
- @Test
- //Test encrypting some data
- public void test1() {
- try {
- EncryptionHelper enc = new EncryptionHelper();
- byte[] data = (Utils.readData(pdfLoc));
- byte[] encdata = enc.encrypt(data);
- assertNotNull(encdata);
- } catch (EncryptionException e) {
- e.printStackTrace();
- }
- }
-
- @Test
- //Test encrypting and decrypting some data
- public void test2() {
- try {
- EncryptionHelper enc = new EncryptionHelper();
- byte[] data = (Utils.readData(pdfLoc));
- byte[] encdata = enc.encrypt(data);
- encKey = enc.getKey();
- encIv = enc.getIv();
-
- EncryptionHelper enc1 = new EncryptionHelper(encKey, encIv);
- byte[] decdata = enc1.decrypt(encdata);
- assertTrue(Arrays.equals(data, decdata));
- } catch (EncryptionException e) {
- e.printStackTrace();
- }
- }
-
- @Test
- //Test encrypting with a certificate
- public void test3() {
- try {
- EncryptionHelper enc = new EncryptionHelper(encKey, encIv);
- String certString = Utils.readString(certLocation);
- String secret = enc.encryptWithCert(certString, encKey);
- assertTrue((secret != null && !secret.isEmpty()));
- } catch (EncryptionException e) {
- e.printStackTrace();
- }
- }
-}