diff options
author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2016-02-16 14:32:13 +0100 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2016-02-16 14:32:13 +0100 |
commit | ec99166bc7057eaa70aedcb183e0409ae0bee028 (patch) | |
tree | 74e020a64aabcfd238f2264e3e3563509dd5f4b4 | |
parent | 1a75185a668d84084f3be83837891db158eb8ef1 (diff) | |
download | pdf-as-4-ec99166bc7057eaa70aedcb183e0409ae0bee028.tar.gz pdf-as-4-ec99166bc7057eaa70aedcb183e0409ae0bee028.tar.bz2 pdf-as-4-ec99166bc7057eaa70aedcb183e0409ae0bee028.zip |
configurable signature buffer size
-rw-r--r-- | pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java | 5 | ||||
-rw-r--r-- | pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java | 12 |
2 files changed, 16 insertions, 1 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 c1fd4fe5..a73a4846 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 @@ -96,4 +96,9 @@ public interface IConfigurationConstants { public static final String SL_REQUEST_TYPE = "sl.request.type"; public static final String SL_REQUEST_TYPE_BASE64 = "b64"; public static final String SL_REQUEST_TYPE_UPLOAD = "upload"; + + /** + * Signature object Prefix + */ + public static final String SIG_RESERVED_SIZE = "signatureSize"; } 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()) { |