aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-cli/src/main/java
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-11-12 12:26:10 +0100
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-11-12 12:26:10 +0100
commit7b2e2b640b0f392183f7927f692936950d3fabfc (patch)
treeffd4acccb62f2679ff613bf0cd8cd0850186b465 /pdf-as-cli/src/main/java
parentdd43264f702c5e0351cc63835862c55f3e847634 (diff)
downloadpdf-as-4-7b2e2b640b0f392183f7927f692936950d3fabfc.tar.gz
pdf-as-4-7b2e2b640b0f392183f7927f692936950d3fabfc.tar.bz2
pdf-as-4-7b2e2b640b0f392183f7927f692936950d3fabfc.zip
SecurityLayer commands included
Diffstat (limited to 'pdf-as-cli/src/main/java')
-rw-r--r--pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/DeveloperMain.java15
-rw-r--r--pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java7
2 files changed, 14 insertions, 8 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 8087da19..b30e1be2 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
@@ -18,7 +18,10 @@ import at.gv.egiz.pdfas.lib.api.sign.IPlainSigner;
import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter;
import at.gv.egiz.pdfas.lib.impl.VerifyParameterImpl;
+import at.gv.egiz.pdfas.lib.impl.signing.pdfbox.PADESPDFBOXSigner;
+import at.gv.egiz.pdfas.sigs.pades.PAdESSigner;
import at.gv.egiz.pdfas.sigs.pkcs7detached.PKCS7DetachedSigner;
+import at.gv.egiz.sl.util.BKUSLConnector;
public class DeveloperMain {
@@ -37,13 +40,13 @@ public class DeveloperMain {
byte[] data;
try {
IPlainSigner signer = new PKCS7DetachedSigner(keyStoreFile, keyAlias, keyStorePass, keyPass, keyStoreType);
- data = StreamUtils.inputStreamToByteArray(new FileInputStream("/home/afitzek/devel/pdfas_neu/simple.pdf"));
+ data = StreamUtils.inputStreamToByteArray(new FileInputStream("/home/afitzek/devel/pdfas_neu/simple_out2.pdf"));
SignParameter parameter = PdfAsFactory.createSignParameter(config, new ByteArrayDataSource(data));
ByteArrayDataSink bads = new ByteArrayDataSink();
parameter.setSignatureProfileId("SIGNATURBLOCK_DE_NEU");
parameter.setOutput(bads);
- parameter.setPlainSigner(signer);
-
+ parameter.setPlainSigner(new PAdESSigner(new BKUSLConnector(config)));
+ /*
StatusRequest request = pdfas.startSign(parameter);
if(request.needCertificate()) {
@@ -58,7 +61,7 @@ public class DeveloperMain {
FileOutputStream fos2 = new FileOutputStream("/home/afitzek/devel/pdfas_neu/sign1.pdf");
fos2.write(request.getSignatureData());
fos2.close();
- request.setSigature(signer.sign(request.getSignatureData()));
+ request.setSigature(signer.sign(request.getSignatureData(), request.getSignatureDataByteRange()));
} else {
throw new Exception("Invalid status");
}
@@ -70,9 +73,9 @@ public class DeveloperMain {
} else {
throw new Exception("Invalid status");
}
-
+ */
pdfas.sign(parameter);
- FileOutputStream fos = new FileOutputStream("/home/afitzek/devel/pdfas_neu/simple_out.pdf");
+ FileOutputStream fos = new FileOutputStream("/home/afitzek/devel/pdfas_neu/simple_out3.pdf");
fos.write(bads.getData());
fos.close();
diff --git a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java
index 09f0f9ce..05fbbf67 100644
--- a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java
+++ b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java
@@ -27,6 +27,8 @@ import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
import at.gv.egiz.pdfas.lib.api.sign.SignResult;
import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter;
import at.gv.egiz.pdfas.lib.api.verify.VerifyResult;
+import at.gv.egiz.pdfas.sigs.pades.PAdESSigner;
+import at.gv.egiz.sl.util.BKUSLConnector;
public class Main {
@@ -55,7 +57,7 @@ public class Main {
public static final String CLI_ARG_VERIFY_WHICH = "verify_which";
public static final String STANDARD_CONFIG_LOCATION = System
- .getProperty("user.home") + "/.pdfas/cfg/";
+ .getProperty("user.home") + "/.pdfas/";
public static final String STANDARD_POSITION_STRING = "x:auto;y:auto;w:auto;p:auto;f:0";
@@ -148,6 +150,7 @@ public class Main {
System.exit(-1);
} catch (Exception e) {
System.err.println("PDF-AS Error: " + e.getMessage());
+ e.printStackTrace(System.err);
System.exit(-1);
}
}
@@ -202,7 +205,7 @@ public class Main {
configuration, dataSource);
signParameter.setOutput(dataSink);
-
+ signParameter.setPlainSigner(new PAdESSigner(new BKUSLConnector(configuration)));
signParameter.setDataSource(dataSource);
signParameter.setSignaturePosition(positionString);
signParameter.setSignatureProfileId(profilID);