diff options
Diffstat (limited to 'pdf-as-lib/src/main/java/at/gv')
5 files changed, 37 insertions, 34 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().) diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BKUSLConnector.java b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BKUSLConnector.java index 204fd727..bffb2974 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BKUSLConnector.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BKUSLConnector.java @@ -57,8 +57,6 @@ public class BKUSLConnector extends BaseSLConnector { private static final Logger logger = LoggerFactory .getLogger(BKUSLConnector.class); - public static final String CONFIG_BKU_URL = "bku.sign.url"; - private String bkuUrl; public BKUSLConnector(Configuration config) { diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BaseSLConnector.java b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BaseSLConnector.java index 99cdb9f8..a5036005 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BaseSLConnector.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BaseSLConnector.java @@ -30,14 +30,11 @@ import org.slf4j.LoggerFactory; import at.gv.egiz.pdfas.common.exceptions.PDFIOException; import at.gv.egiz.pdfas.common.utils.PDFUtils; +import at.gv.egiz.pdfas.lib.api.IConfigurationConstants; import at.gv.egiz.pdfas.lib.api.sign.SignParameter; import at.gv.egiz.sl.schema.Base64OptRefContentType; -import at.gv.egiz.sl.schema.Base64XMLLocRefContentType; -import at.gv.egiz.sl.schema.Base64XMLLocRefOptRefContentType; -import at.gv.egiz.sl.schema.CMSDataObjectOptionalMetaType; import at.gv.egiz.sl.schema.CMSDataObjectRequiredMetaType; import at.gv.egiz.sl.schema.CreateCMSSignatureRequestType; -import at.gv.egiz.sl.schema.DataObjectInfoType; import at.gv.egiz.sl.schema.ExcludedByteRangeType; import at.gv.egiz.sl.schema.InfoboxReadParamsAssocArrayType; import at.gv.egiz.sl.schema.InfoboxReadParamsAssocArrayType.ReadValue; @@ -45,7 +42,7 @@ import at.gv.egiz.sl.schema.InfoboxReadRequestType; import at.gv.egiz.sl.schema.MetaInfoType; import at.gv.egiz.sl.schema.ObjectFactory; -public abstract class BaseSLConnector implements ISLConnector { +public abstract class BaseSLConnector implements ISLConnector, IConfigurationConstants { private static final Logger logger = LoggerFactory .getLogger(BaseSLConnector.class); diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/MOAConnector.java b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/MOAConnector.java index 70b40876..7970b567 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/MOAConnector.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/MOAConnector.java @@ -60,22 +60,19 @@ import at.gv.egiz.pdfas.common.exceptions.PdfAsWrappedIOException; import at.gv.egiz.pdfas.common.settings.ISettings; import at.gv.egiz.pdfas.common.utils.StreamUtils; import at.gv.egiz.pdfas.lib.api.Configuration; +import at.gv.egiz.pdfas.lib.api.IConfigurationConstants; import at.gv.egiz.pdfas.lib.api.sign.SignParameter; import at.gv.egiz.pdfas.lib.api.verify.VerifyResult; import at.gv.egiz.pdfas.lib.impl.status.RequestedSignature; import at.gv.egiz.pdfas.lib.util.SignatureUtils; -public class MOAConnector implements ISignatureConnector { +public class MOAConnector implements ISignatureConnector, IConfigurationConstants { private static final Logger logger = LoggerFactory .getLogger(MOAConnector.class); private static final Logger moalogger = LoggerFactory.getLogger("at.knowcenter.wag.egov.egiz.sig.connectors.MOASSRepsonseLogger"); - public static final String MOA_SIGN_URL = "moa.sign.url"; - public static final String MOA_SIGN_KEY_ID = "moa.sign.KeyIdentifier"; - public static final String MOA_SIGN_CERTIFICATE = "moa.sign.Certificate"; - public static final String KEY_ID_PATTERN = "##KEYID##"; public static final String CONTENT_PATTERN = "##CONTENT##"; |