summaryrefslogtreecommitdiff
path: root/bkucommon/src/test/java/at/gv
diff options
context:
space:
mode:
authorwbauer <wbauer@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-10-08 08:39:17 +0000
committerwbauer <wbauer@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-10-08 08:39:17 +0000
commit27d91275555207f9e152c2867d52fbbf83f92ba7 (patch)
tree27798cbea71918278dc04c9a3e4e309f05956888 /bkucommon/src/test/java/at/gv
parent35364f7492308692bd690c17f5527f4157eb583a (diff)
downloadmocca-27d91275555207f9e152c2867d52fbbf83f92ba7.tar.gz
mocca-27d91275555207f9e152c2867d52fbbf83f92ba7.tar.bz2
mocca-27d91275555207f9e152c2867d52fbbf83f92ba7.zip
changed ssl certificate validation, now using iaik_pki
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@83 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'bkucommon/src/test/java/at/gv')
-rw-r--r--bkucommon/src/test/java/at/gv/egiz/bku/conf/CertValidatorTest.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/conf/CertValidatorTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/conf/CertValidatorTest.java
new file mode 100644
index 00000000..7bc0daa5
--- /dev/null
+++ b/bkucommon/src/test/java/at/gv/egiz/bku/conf/CertValidatorTest.java
@@ -0,0 +1,32 @@
+package at.gv.egiz.bku.conf;
+
+import iaik.x509.X509Certificate;
+
+import java.io.File;
+import java.io.IOException;
+import java.security.cert.CertificateException;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class CertValidatorTest {
+
+ private CertValidator cv;
+
+ @Before
+ public void setUp() {
+ cv = new CertValidatorImpl();
+ String caDir = getClass().getClassLoader().getResource("at/gv/egiz/bku/conf/certs/CACerts").getPath();
+ String certDir = getClass().getClassLoader().getResource("at/gv/egiz/bku/conf/certs/certStore").getPath();
+ cv.init(new File(caDir), new File(certDir));
+ }
+
+ @Test
+ public void testValid() throws CertificateException, IOException {
+ X509Certificate cert = new X509Certificate(getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/conf/certs/testCerts/www.a-trust.at.der"));
+ assertTrue(cv.isCertificateValid("TID", new X509Certificate[]{cert}));
+ }
+
+}