diff options
author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2014-08-19 11:07:20 +0200 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2014-08-19 11:07:20 +0200 |
commit | e1b810ee9221f6247c575c669bff2ba98552c65e (patch) | |
tree | 32ddf763ccffe68e03d1a89f3b0c67f24417cab1 /pdf-as-lib/src/main/java/at/gv/egiz/pdfas | |
parent | 5b455cba0b88255f58d1f9e00ab41770678b8828 (diff) | |
download | pdf-as-4-e1b810ee9221f6247c575c669bff2ba98552c65e.tar.gz pdf-as-4-e1b810ee9221f6247c575c669bff2ba98552c65e.tar.bz2 pdf-as-4-e1b810ee9221f6247c575c669bff2ba98552c65e.zip |
Web config changes
Diffstat (limited to 'pdf-as-lib/src/main/java/at/gv/egiz/pdfas')
-rw-r--r-- | pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java | 7 | ||||
-rw-r--r-- | pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java | 48 |
2 files changed, 33 insertions, 22 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java index 96c31348..4b3eefb2 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java @@ -45,6 +45,8 @@ public interface IConfigurationConstants { public static final String PLACEHOLDER_SEARCH_ENABLED = "enable_placeholder_search"; public static final String DEFAULT_SIGNATURE_PROFILE = SIG_OBJECT + SEPERATOR + TYPE + SEPERATOR + DEFAULT; + public static final String CONFIG_BKU_URL = "bku.sign.url"; + /** * Signature object Prefix */ @@ -66,6 +68,8 @@ public interface IConfigurationConstants { */ public static final String MOA_TRUSTPROFILE_ID = "moa.verify.TrustProfileID"; + public static final String MOA_SIGN_KEY_ID = MOA_SS_KEY_IDENTIFIER; + public static final String MOA_SIGN_CERTIFICATE = MOA_SS_KEY_CERTIFICATE; /** * MOA Verify URL configuration Key @@ -78,4 +82,7 @@ public interface IConfigurationConstants { */ public static final String MOA_SIGN_URL = "moa.sign.url"; + public static final String MOC_SIGN_URL = "moc.sign.url"; + public static final String MOBILE_SIGN_URL = "mobile.sign.url"; + } diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java index c8c4eeb4..af32aaa5 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java @@ -42,6 +42,8 @@ import org.apache.pdfbox.pdmodel.PDDocumentCatalog; import org.apache.pdfbox.pdmodel.PDPage; import org.apache.pdfbox.pdmodel.PDPageNode; import org.apache.pdfbox.pdmodel.PDResources; +import org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDStructureElement; +import org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDStructureTreeRoot; import org.apache.pdfbox.pdmodel.graphics.color.PDOutputIntent; import org.apache.pdfbox.pdmodel.graphics.xobject.PDJpeg; import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceCharacteristicsDictionary; @@ -73,6 +75,7 @@ import at.gv.egiz.pdfas.lib.impl.stamping.TableFactory; import at.gv.egiz.pdfas.lib.impl.stamping.ValueResolver; import at.gv.egiz.pdfas.lib.impl.stamping.pdfbox.PDFAsVisualSignatureProperties; import at.gv.egiz.pdfas.lib.impl.stamping.pdfbox.PdfBoxVisualObject; +import at.gv.egiz.pdfas.lib.impl.stamping.pdfbox.tagging.PDFBoxTaggingUtils; import at.gv.egiz.pdfas.lib.impl.status.PDFObject; import at.gv.egiz.pdfas.lib.impl.status.RequestedSignature; import at.gv.egiz.pdfas.lib.util.SignatureUtils; @@ -137,7 +140,7 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { signer.setPDSignature(signature); SignatureOptions options = new SignatureOptions(); - + // Is visible Signature if (requestedSignature.isVisual()) { logger.info("Creating visual siganture block"); @@ -231,14 +234,14 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { position.setWidth(visualObject.getWidth()); requestedSignature.setSignaturePosition(position); - + PDFAsVisualSignatureProperties properties = new PDFAsVisualSignatureProperties( pdfObject.getStatus().getSettings(), pdfObject, (PdfBoxVisualObject) visualObject, positioningInstruction); properties.buildSignature(); - + /* * ByteArrayOutputStream sigbos = new ByteArrayOutputStream(); * sigbos.write(StreamUtils.inputStreamToByteArray(properties @@ -314,36 +317,37 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { } } - /* - * if(signatureProfileSettings.isPDFA()) { // Check for PDF-UA - * PDDocumentCatalog root = doc.getDocumentCatalog(); - * PDStructureTreeRoot treeRoot = root.getStructureTreeRoot(); - * if(treeRoot != null) { // Handle as PDF-UA - * logger.info("Tree Root: {}", treeRoot.toString()); - * PDStructureElement docElement = - * PDFBoxTaggingUtils.getDocumentElement(treeRoot); - * PDStructureElement sigBlock = new PDStructureElement("Table", - * docElement); root.getCOSObject().setNeedToBeUpdate(true); - * docElement.getCOSObject().setNeedToBeUpdate(true); - * treeRoot.getCOSObject().setNeedToBeUpdate(true); - * sigBlock.setTitle("Signature Table"); } } - */ +// if (signatureProfileSettings.isPDFA()) { // Check for PDF-UA +// PDDocumentCatalog root = doc.getDocumentCatalog(); +// PDStructureTreeRoot treeRoot = root.getStructureTreeRoot(); +// if (treeRoot != null) { // Handle as PDF-UA +// logger.info("Tree Root: {}", treeRoot.toString()); +// PDStructureElement docElement = PDFBoxTaggingUtils +// .getDocumentElement(treeRoot); +// PDStructureElement sigBlock = new PDStructureElement( +// "Table", docElement); +// root.getCOSObject().setNeedToBeUpdate(true); +// docElement.getCOSObject().setNeedToBeUpdate(true); +// treeRoot.getCOSObject().setNeedToBeUpdate(true); +// sigBlock.setTitle("Signature Table"); +// } +// } options.setPreferedSignatureSize(0x1000); options.setPage(positioningInstruction.getPage()); options.setVisualSignature(properties.getVisibleSignature()); } - + doc.addSignature(signature, signer, options); - + String sigFieldName = signatureProfileSettings.getSignFieldValue(); if (sigFieldName == null) { sigFieldName = "PDF-AS Signatur"; } - + int count = SignatureUtils.countSignatures(doc, sigFieldName); - + sigFieldName = sigFieldName + count; PDAcroForm acroFormm = doc.getDocumentCatalog().getAcroForm(); @@ -372,7 +376,7 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { } else { logger.warn("Failed to name Signature Field! [Cannot find acroForm!]"); } - + if (requestedSignature.isVisual()) { // if(requestedSignature.getSignaturePosition().) |