aboutsummaryrefslogtreecommitdiff
path: root/DocumentService/src/eu/stork/documentservice/tests/EncryptionTests.java
diff options
context:
space:
mode:
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();
- }
- }
-}