aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-cli/src/main
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-10-02 10:28:30 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-10-02 10:28:30 +0200
commit0876981fd70fdab07f7c3e1666cf77071b5fe03d (patch)
tree0661571d1d757383fee936d1c4648d2c31b43ddb /pdf-as-cli/src/main
parentadd4460d9619f3586a02ae0d8c028f01903494bc (diff)
downloadpdf-as-4-0876981fd70fdab07f7c3e1666cf77071b5fe03d.tar.gz
pdf-as-4-0876981fd70fdab07f7c3e1666cf77071b5fe03d.tar.bz2
pdf-as-4-0876981fd70fdab07f7c3e1666cf77071b5fe03d.zip
+ added PKCS7 detached siganture standard via keystore
+ added simple verification implementation
Diffstat (limited to 'pdf-as-cli/src/main')
-rw-r--r--pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/DeveloperMain.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/DeveloperMain.java b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/DeveloperMain.java
index 4b9a4e33..0e114eae 100644
--- a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/DeveloperMain.java
+++ b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/DeveloperMain.java
@@ -15,8 +15,9 @@ import at.gv.egiz.pdfas.lib.api.PdfAs;
import at.gv.egiz.pdfas.lib.api.PdfAsFactory;
import at.gv.egiz.pdfas.lib.api.sign.IPlainSigner;
import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
-import at.gv.egiz.pdfas.lib.impl.signing.IPdfSigner;
-import at.gv.egiz.pdfas.lib.impl.signing.sig_interface.JKSSigner;
+import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter;
+import at.gv.egiz.pdfas.lib.impl.VerifyParameterImpl;
+import at.gv.egiz.pdfas.sigs.pkcs7detached.PKCS7DetachedSigner;
public class DeveloperMain {
@@ -34,7 +35,7 @@ public class DeveloperMain {
Configuration config = pdfas.getConfiguration();
byte[] data;
try {
- IPlainSigner signer = new JKSSigner(keyStoreFile, keyAlias, keyStorePass, keyPass, keyStoreType);
+ IPlainSigner signer = new PKCS7DetachedSigner(keyStoreFile, keyAlias, keyStorePass, keyPass, keyStoreType);
data = StreamUtils.inputStreamToByteArray(new FileInputStream("/home/afitzek/devel/pdfas_neu/simple.pdf"));
SignParameter parameter = PdfAsFactory.createSignParameter(config, new ByteArrayDataSource(data));
ByteArrayDataSink bads = new ByteArrayDataSink();
@@ -45,6 +46,10 @@ public class DeveloperMain {
FileOutputStream fos = new FileOutputStream("/home/afitzek/devel/pdfas_neu/simple_out.pdf");
fos.write(bads.getData());
fos.close();
+
+ VerifyParameter verify = new VerifyParameterImpl(config, new ByteArrayDataSource(bads.getData()));
+ pdfas.verify(verify);
+
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();