diff options
5 files changed, 27 insertions, 8 deletions
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 c2d35c40..47d06576 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 @@ -26,8 +26,10 @@ package at.gv.egiz.pdfas.cli; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Map.Entry; import java.util.UUID; @@ -432,6 +434,13 @@ public class Main { System.out.println("Starting signature for " + pdfFile); System.out.println("Selected signature Profile " + profilID); + //TODO get values from CLI + Map<String, String> test = new HashMap<>(); + test.put("schoolName", "EGIZ testschule"); + + test.put("subject","bbDbb"); + signParameter.setDynamicSignatureBlockArguments(test); + SignResult result = null; try { result = pdfAs.sign(signParameter); diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsParameter.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsParameter.java index 11a1941b..6303c0a0 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsParameter.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsParameter.java @@ -82,10 +82,16 @@ public interface PdfAsParameter { public void setPreprocessorArguments(Map<String, String> map); /** - * Sets the dynamic signatur block values. + * Sets the dynamic signature-block values. * * @param map the map */ public void setDynamicSignatureBlockArguments(Map<String, String> map); + /** + * Gets the dynamic signature-block values. + * + * @return the dynamic signature-block values + */ + public Map<String, String> getDynamicSignatureBlockArguments(); } diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java index 324712cb..55891bb2 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java @@ -23,6 +23,7 @@ ******************************************************************************/ package at.gv.egiz.pdfas.lib.impl; +import at.gv.egiz.pdfas.lib.impl.status.PDFObject; import iaik.x509.X509Certificate; import java.awt.Image; @@ -144,7 +145,11 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants, IPdfSigner signer = backend.getPdfSigner(); - status.setPdfObject(signer.buildPDFObject(status)); + + PDFObject pdfObject = signer.buildPDFObject(status); + //TODO verify map??? + pdfObject.getStatus().getRequestParameters().putAll(status.getSignParamter().getDynamicSignatureBlockArguments()); + status.setPdfObject(pdfObject); // set Original PDF Document Data status.getPdfObject() diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsParameterImpl.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsParameterImpl.java index f3e1c301..d6161f2c 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsParameterImpl.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsParameterImpl.java @@ -82,4 +82,9 @@ protected Configuration configuration; public void setDynamicSignatureBlockArguments(Map<String, String> map) { this.dynamicSignatureBlockArgumentsMap = map; } + + @Override + public Map<String, String> getDynamicSignatureBlockArguments() { + return this.dynamicSignatureBlockArgumentsMap; + } } diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java index 2481c77b..ab118857 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java @@ -63,12 +63,6 @@ public class ValueResolver implements IProfileConstants, IResolver { private IResolver internalResolver; public ValueResolver(ICertificateProvider certProvider, OperationStatus operationStatus) { -// Map<String, String> test = new HashMap<>(); -// test.put("schoolNameRand", RandomStringUtils.randomAlphabetic(5)); -// test.put("schoolName", "EGIZ testschule"); -// -// test.put("subject","bbBbb"); -// internalRequestParameterResolver = new RequestParameterResolver(test); internalResolver = new CertificateAndRequestParameterResolver(certProvider.getCertificate(), operationStatus); } |