aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorknowcenter <knowcenter@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2007-05-16 19:58:30 +0000
committerknowcenter <knowcenter@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2007-05-16 19:58:30 +0000
commit133a3fc5c68b11c5ed03438e409d6dc49cbd6771 (patch)
treeb3652d90cbe6fcd91392c93d5bb71e2bafa39a66 /src
parent2a65bbd2650a79cf02df438de82ce7fdda8dfdaa (diff)
downloadpdf-as-3-133a3fc5c68b11c5ed03438e409d6dc49cbd6771.tar.gz
pdf-as-3-133a3fc5c68b11c5ed03438e409d6dc49cbd6771.tar.bz2
pdf-as-3-133a3fc5c68b11c5ed03438e409d6dc49cbd6771.zip
enveloping connectors
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@79 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src')
-rw-r--r--src/test/java/test/at/knowcenter/wag/egov/egiz/TestNeu.java80
1 files changed, 75 insertions, 5 deletions
diff --git a/src/test/java/test/at/knowcenter/wag/egov/egiz/TestNeu.java b/src/test/java/test/at/knowcenter/wag/egov/egiz/TestNeu.java
index 84fda4c..c35d640 100644
--- a/src/test/java/test/at/knowcenter/wag/egov/egiz/TestNeu.java
+++ b/src/test/java/test/at/knowcenter/wag/egov/egiz/TestNeu.java
@@ -22,9 +22,12 @@ import at.knowcenter.wag.egov.egiz.exceptions.SignatureException;
import at.knowcenter.wag.egov.egiz.sig.SignatureData;
import at.knowcenter.wag.egov.egiz.sig.SignatureObject;
import at.knowcenter.wag.egov.egiz.sig.SignatureResponse;
+import at.knowcenter.wag.egov.egiz.sig.connectors.Connector;
import at.knowcenter.wag.egov.egiz.sig.connectors.bku.DetachedMultipartBKUConnector;
+import at.knowcenter.wag.egov.egiz.sig.connectors.bku.EnvelopedBase64BKUConnector;
import at.knowcenter.wag.egov.egiz.sig.connectors.bku.SignSignatureObject;
-import at.knowcenter.wag.egov.egiz.tools.FileHelper;
+import at.knowcenter.wag.egov.egiz.sig.connectors.moa.DetachedLocRefMOAConnector;
+import at.knowcenter.wag.egov.egiz.sig.connectors.moa.EnvelopingBase64MOAConnector;
/**
* @author wprinz
@@ -35,9 +38,8 @@ public class TestNeu
private static Log logger = LogFactory.getLog(TestNeu.class);
protected static String TEXT = "Test 123 äöüß"; //$NON-NLS-1$
-
- protected static File PDF = new File("C:\\wprinz\\Filer\\egiz\\docs\\document4.pdf"); //$NON-NLS-1$
+ protected static File PDF = new File("C:\\wprinz\\Filer\\egiz\\docs\\document4.pdf"); //$NON-NLS-1$
/**
* @param args
@@ -48,7 +50,13 @@ public class TestNeu
SettingsReader.initializeForCommandLine();
PropertyConfigurator.configure(SettingsReader.CONFIG_PATH + "log4j.properties"); //$NON-NLS-1$
- testDetachedMultipartBKUConnector();
+ //testEnvelopingBase64BKUConnector();
+
+ testEnvelopingBase64MOAConnector();
+
+ // testDetachedLocRefMOAConnector ();
+
+ // testDetachedMultipartBKUConnector();
// testTexMOA();
@@ -63,6 +71,68 @@ public class TestNeu
logger.info("finished.");
}
+ public static void testEnvelopingBase64BKUConnector() throws Exception
+ {
+ Connector c = new EnvelopedBase64BKUConnector("CIO-BUND2"); //$NON-NLS-1$
+
+ SignatureData data = new TextSignatureData();
+
+ {
+ SignSignatureObject so = c.doSign(data);
+
+ FileOutputStream fos = new FileOutputStream("C:\\wprinz\\Filer\\egiz2\\SignatureObject.bin");
+ ObjectOutputStream oos = new ObjectOutputStream(fos);
+ oos.writeObject(so);
+ oos.close();
+ }
+
+ {
+ FileInputStream fis = new FileInputStream("C:\\wprinz\\Filer\\egiz2\\SignatureObject.bin");
+ ObjectInputStream ois = new ObjectInputStream(fis);
+ SignSignatureObject so = (SignSignatureObject) ois.readObject();
+ ois.close();
+
+ SignatureResponse sr = c.doVerify(data, so);
+ logger.debug("sr = " + sr);
+ }
+ }
+
+ public static void testEnvelopingBase64MOAConnector() throws Exception
+ {
+ Connector c = new EnvelopingBase64MOAConnector("CIO-BUND2"); //$NON-NLS-1$
+
+ SignatureData data = new TextSignatureData();
+
+ {
+ SignSignatureObject so = c.doSign(data);
+
+ FileOutputStream fos = new FileOutputStream("C:\\wprinz\\Filer\\egiz2\\SignatureObject.bin");
+ ObjectOutputStream oos = new ObjectOutputStream(fos);
+ oos.writeObject(so);
+ oos.close();
+ }
+
+ {
+ FileInputStream fis = new FileInputStream("C:\\wprinz\\Filer\\egiz2\\SignatureObject.bin");
+ ObjectInputStream ois = new ObjectInputStream(fis);
+ SignSignatureObject so = (SignSignatureObject) ois.readObject();
+ ois.close();
+
+ SignatureResponse sr = c.doVerify(data, so);
+ logger.debug("sr = " + sr);
+ }
+ }
+
+ public static void testDetachedLocRefMOAConnector() throws Exception
+ {
+ DetachedLocRefMOAConnector c = new DetachedLocRefMOAConnector("CIO-BUND2"); //$NON-NLS-1$
+
+ SignatureData data = new TextSignatureData();
+
+ SignSignatureObject so = c.doSign(data);
+
+ }
+
public static void testDetachedMultipartBKUConnector() throws Exception
{
DetachedMultipartBKUConnector c = new DetachedMultipartBKUConnector("CIO-BUND2"); //$NON-NLS-1$
@@ -234,7 +304,7 @@ public class TestNeu
byte[] data = new byte[(int) PDF.length()];
fis.read(data);
fis.close();
-
+
return data;
}
catch (Exception e)