From ec99166bc7057eaa70aedcb183e0409ae0bee028 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Tue, 16 Feb 2016 14:32:13 +0100 Subject: configurable signature buffer size --- .../pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'pdf-as-pdfbox/src/main/java/at') diff --git a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java index 8556ae9f..c853ee17 100644 --- a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java +++ b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java @@ -209,7 +209,17 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { signer.setPDSignature(signature); - options.setPreferedSignatureSize(0x1000); + int signatureSize = 0x1000; + try { + String reservedSignatureSizeString = pdfObject.getStatus().getSettings().getValue(SIG_RESERVED_SIZE); + if(reservedSignatureSizeString != null) { + signatureSize = Integer.parseInt(reservedSignatureSizeString); + } + logger.debug("Reserving {} bytes for signature", signatureSize); + } catch(NumberFormatException e) { + logger.warn("Invalid configuration value: {} should be a number using 0x1000", SIG_RESERVED_SIZE); + } + options.setPreferedSignatureSize(signatureSize); // Is visible Signature if (requestedSignature.isVisual()) { -- cgit v1.2.3