From 9a513d43b310f2e6283fa195a8aa11493a7dcb2c Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Fri, 30 Sep 2022 14:24:16 +0200 Subject: kill off pdfover-signator --- .../main/java/at/asit/pdfover/commons/BKUs.java | 34 ++++ pdf-over-gui/pom.xml | 5 - .../at/asit/pdfover/gui/bku/LocalBKUConnector.java | 11 +- .../asit/pdfover/gui/bku/MobileBKUConnector.java | 6 +- .../asit/pdfover/gui/bku/mobile/ATrustHandler.java | 10 +- .../asit/pdfover/gui/cliarguments/BKUArgument.java | 2 +- .../gui/composites/BKUSelectionComposite.java | 2 +- .../pdfover/gui/composites/OutputComposite.java | 2 +- .../gui/composites/PositioningComposite.java | 2 +- .../AdvancedConfigurationComposite.java | 2 +- .../SimpleConfigurationComposite.java | 2 +- .../asit/pdfover/gui/utils/FileUploadSource.java | 2 +- .../java/at/asit/pdfover/gui/workflow/Status.java | 6 +- .../workflow/config/ConfigurationDataInMemory.java | 2 +- .../gui/workflow/config/ConfigurationManager.java | 2 +- .../gui/workflow/states/BKUSelectionState.java | 2 +- .../asit/pdfover/gui/workflow/states/KSState.java | 2 +- .../gui/workflow/states/MobileBKUState.java | 2 +- .../pdfover/gui/workflow/states/OpenState.java | 2 +- .../gui/workflow/states/PositioningState.java | 4 +- .../workflow/states/PrepareConfigurationState.java | 2 +- .../gui/workflow/states/PrepareSigningState.java | 4 +- .../pdfover/gui/workflow/states/SigningState.java | 2 +- .../main/resources/installer-windows/PDF-Over.aip | 1 - pdf-over-signator/pom.xml | 40 ----- .../main/java/at/asit/pdfover/signator/BKUs.java | 34 ---- .../at/asit/pdfover/signator/BkuSlConnector.java | 30 ---- .../pdfover/signator/ByteArrayDocumentSource.java | 55 ------ .../at/asit/pdfover/signator/DocumentSource.java | 44 ----- .../main/java/at/asit/pdfover/signator/Emblem.java | 200 --------------------- .../pdfover/signator/PDFFileDocumentSource.java | 88 --------- .../java/at/asit/pdfover/signator/SignResult.java | 65 ------- .../asit/pdfover/signator/SignatureException.java | 62 ------- .../asit/pdfover/signator/SignaturePosition.java | 124 ------------- pdf-over-signer/pom.xml | 5 - .../at/asit/pdfover/signer/BkuSlConnector.java | 32 ++++ .../pdfover/signer/ByteArrayDocumentSource.java | 55 ++++++ .../at/asit/pdfover/signer/DocumentSource.java | 44 +++++ .../main/java/at/asit/pdfover/signer/Emblem.java | 200 +++++++++++++++++++++ .../asit/pdfover/signer/PDFFileDocumentSource.java | 88 +++++++++ .../java/at/asit/pdfover/signer/SignResult.java | 65 +++++++ .../at/asit/pdfover/signer/SignatureException.java | 62 +++++++ .../at/asit/pdfover/signer/SignaturePosition.java | 124 +++++++++++++ .../pdfover/signer/pdfas/PdfAs4BKUSLConnector.java | 4 +- .../at/asit/pdfover/signer/pdfas/PdfAs4Helper.java | 2 +- .../asit/pdfover/signer/pdfas/PdfAs4SLRequest.java | 3 +- .../signer/pdfas/PdfAs4SignatureParameter.java | 8 +- .../at/asit/pdfover/signer/pdfas/PdfAs4Signer.java | 8 +- .../pdfover/signer/pdfas/PdfAs4SigningState.java | 4 +- pom.xml | 1 - 50 files changed, 753 insertions(+), 805 deletions(-) create mode 100644 pdf-over-commons/src/main/java/at/asit/pdfover/commons/BKUs.java delete mode 100644 pdf-over-signator/pom.xml delete mode 100644 pdf-over-signator/src/main/java/at/asit/pdfover/signator/BKUs.java delete mode 100644 pdf-over-signator/src/main/java/at/asit/pdfover/signator/BkuSlConnector.java delete mode 100644 pdf-over-signator/src/main/java/at/asit/pdfover/signator/ByteArrayDocumentSource.java delete mode 100644 pdf-over-signator/src/main/java/at/asit/pdfover/signator/DocumentSource.java delete mode 100644 pdf-over-signator/src/main/java/at/asit/pdfover/signator/Emblem.java delete mode 100644 pdf-over-signator/src/main/java/at/asit/pdfover/signator/PDFFileDocumentSource.java delete mode 100644 pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignResult.java delete mode 100644 pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureException.java delete mode 100644 pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignaturePosition.java create mode 100644 pdf-over-signer/src/main/java/at/asit/pdfover/signer/BkuSlConnector.java create mode 100644 pdf-over-signer/src/main/java/at/asit/pdfover/signer/ByteArrayDocumentSource.java create mode 100644 pdf-over-signer/src/main/java/at/asit/pdfover/signer/DocumentSource.java create mode 100644 pdf-over-signer/src/main/java/at/asit/pdfover/signer/Emblem.java create mode 100644 pdf-over-signer/src/main/java/at/asit/pdfover/signer/PDFFileDocumentSource.java create mode 100644 pdf-over-signer/src/main/java/at/asit/pdfover/signer/SignResult.java create mode 100644 pdf-over-signer/src/main/java/at/asit/pdfover/signer/SignatureException.java create mode 100644 pdf-over-signer/src/main/java/at/asit/pdfover/signer/SignaturePosition.java diff --git a/pdf-over-commons/src/main/java/at/asit/pdfover/commons/BKUs.java b/pdf-over-commons/src/main/java/at/asit/pdfover/commons/BKUs.java new file mode 100644 index 00000000..bcba609e --- /dev/null +++ b/pdf-over-commons/src/main/java/at/asit/pdfover/commons/BKUs.java @@ -0,0 +1,34 @@ +/* + * Copyright 2012 by A-SIT, Secure Information Technology Center Austria + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://joinup.ec.europa.eu/software/page/eupl + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + */ +package at.asit.pdfover.commons; + +/** + * Enumeration of available BKU types + * + */ +public enum BKUs { + /** Local BKU */ + LOCAL, + + /** Mobile BKU */ + MOBILE, + + /** KeyStore */ + KS, + + /** No BKU */ + NONE +} diff --git a/pdf-over-gui/pom.xml b/pdf-over-gui/pom.xml index 671f2967..ed0e5c82 100644 --- a/pdf-over-gui/pom.xml +++ b/pdf-over-gui/pom.xml @@ -26,11 +26,6 @@ logback-classic 1.2.10 - - at.a-sit - pdf-over-signator - ${project.parent.version} - at.a-sit pdf-over-signer diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java index 5aeea741..ffd924f6 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/LocalBKUConnector.java @@ -32,8 +32,8 @@ import org.slf4j.LoggerFactory; import at.asit.pdfover.commons.Constants; import at.asit.pdfover.gui.utils.FileUploadSource; -import at.asit.pdfover.signator.BkuSlConnector; -import at.asit.pdfover.signator.SignatureException; +import at.asit.pdfover.signer.BkuSlConnector; +import at.asit.pdfover.signer.SignatureException; import at.asit.pdfover.signer.pdfas.PdfAs4SLRequest; /** @@ -69,15 +69,14 @@ public class LocalBKUConnector implements BkuSlConnector { HttpClient client = BKUHelper.getHttpClient(); PostMethod method = new PostMethod(Constants.LOCAL_BKU_URL); - String sl_request = request.getRequest(); - if (request.getSignatureData() == null) { + String sl_request = request.request; + if (request.signatureData == null) { method.addParameter("XMLRequest", sl_request); } else { StringPart xmlpart = new StringPart( "XMLRequest", sl_request, "UTF-8"); - FilePart filepart = new FilePart("fileupload", - new FileUploadSource(request.getSignatureData())); + FilePart filepart = new FilePart("fileupload", new FileUploadSource(request.signatureData)); Part[] parts = { xmlpart, filepart }; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java index 2fa5a8e5..c17451ed 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java @@ -23,8 +23,8 @@ import at.asit.pdfover.commons.Constants; import at.asit.pdfover.gui.bku.mobile.ATrustHandler; import at.asit.pdfover.gui.bku.mobile.ATrustStatus; import at.asit.pdfover.gui.workflow.states.MobileBKUState; -import at.asit.pdfover.signator.BkuSlConnector; -import at.asit.pdfover.signator.SignatureException; +import at.asit.pdfover.signer.BkuSlConnector; +import at.asit.pdfover.signer.SignatureException; import at.asit.pdfover.signer.pdfas.PdfAs4SLRequest; import at.asit.pdfover.signer.pdfas.PdfAs4SigningState; @@ -48,7 +48,7 @@ public class MobileBKUConnector implements BkuSlConnector { } /** (non-Javadoc) - * @see at.asit.pdfover.signator.BkuSlConnector#handleSLRequest(java.lang.String) + * @see at.asit.pdfover.signer.BkuSlConnector#handleSLRequest(java.lang.String) */ @Override public String handleSLRequest(PdfAs4SLRequest request) throws SignatureException { diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java index e639323d..8697399d 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java @@ -293,21 +293,21 @@ public class ATrustHandler { PostMethod post = new PostMethod(mobileBKUUrl); String sl_request; - if (request.getSignatureData() != null) { - sl_request = request.getRequest(); + if (request.signatureData != null) { + sl_request = request.request; StringPart xmlpart = new StringPart( "XMLRequest", sl_request, "UTF-8"); FilePart filepart = new FilePart("fileupload", - new FileUploadSource(request.getSignatureData()), + new FileUploadSource(request.signatureData), "application/pdf", "UTF-8"); Part[] parts = { xmlpart, filepart }; post.setRequestEntity(new MultipartRequestEntity(parts, post .getParams())); - } else { /* TODO is this ever false? */ - sl_request = request.getRequest(); + } else { + sl_request = request.request; post.addParameter("XMLRequest", sl_request); } log.trace("SL Request: " + sl_request); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/BKUArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/BKUArgument.java index 689462b2..e69383f7 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/BKUArgument.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/BKUArgument.java @@ -16,8 +16,8 @@ package at.asit.pdfover.gui.cliarguments; import at.asit.pdfover.gui.exceptions.InitializationException; +import at.asit.pdfover.commons.BKUs; import at.asit.pdfover.commons.Messages; -import at.asit.pdfover.signator.BKUs; /** * CLI Argument to set the BKU to use diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java index 58d2ee43..5c1dad35 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/BKUSelectionComposite.java @@ -30,11 +30,11 @@ import org.eclipse.swt.widgets.Composite; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.commons.BKUs; import at.asit.pdfover.commons.Constants; import at.asit.pdfover.gui.controls.ClickableCanvas; import at.asit.pdfover.gui.utils.SWTUtils; import at.asit.pdfover.gui.workflow.states.State; -import at.asit.pdfover.signator.BKUs; /** * Composite for BKU selection diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java index ceb0b7bb..12fe2cb9 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java @@ -49,7 +49,7 @@ import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.utils.SWTUtils; import at.asit.pdfover.commons.Messages; import at.asit.pdfover.gui.workflow.states.State; -import at.asit.pdfover.signator.DocumentSource; +import at.asit.pdfover.signer.DocumentSource; /** * GUI component for Output State diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java index 7a08f12c..1953a035 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java @@ -44,7 +44,7 @@ import org.slf4j.LoggerFactory; import at.asit.pdfover.commons.Constants; import at.asit.pdfover.gui.utils.SWTUtils; import at.asit.pdfover.gui.workflow.states.State; -import at.asit.pdfover.signator.SignaturePosition; +import at.asit.pdfover.signer.SignaturePosition; /** * Composite which allows to position the signature on a preview of the document diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java index dd2275ec..20c8fdfd 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java @@ -39,6 +39,7 @@ import org.eclipse.swt.widgets.Text; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.commons.BKUs; import at.asit.pdfover.commons.Constants; import at.asit.pdfover.commons.Messages; import at.asit.pdfover.commons.Profile; @@ -53,7 +54,6 @@ import at.asit.pdfover.gui.utils.SWTUtils; import at.asit.pdfover.gui.workflow.config.ConfigurationManager; import at.asit.pdfover.gui.workflow.config.ConfigurationDataInMemory; import at.asit.pdfover.gui.workflow.states.State; -import at.asit.pdfover.signator.BKUs; /** * Composite for advanced configuration diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java index 964966da..8437dbc3 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java @@ -63,7 +63,7 @@ import at.asit.pdfover.gui.utils.SWTUtils; import at.asit.pdfover.gui.workflow.config.ConfigurationDataInMemory; import at.asit.pdfover.gui.workflow.config.ConfigurationManager; import at.asit.pdfover.gui.workflow.states.State; -import at.asit.pdfover.signator.Emblem; +import at.asit.pdfover.signer.Emblem; import at.asit.pdfover.signer.pdfas.PdfAs4SignatureParameter; import at.asit.pdfover.signer.pdfas.PdfAs4SignaturePlaceholder; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/FileUploadSource.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/FileUploadSource.java index d556ccae..b0ff16ea 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/FileUploadSource.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/FileUploadSource.java @@ -21,7 +21,7 @@ import java.io.InputStream; import org.apache.commons.httpclient.methods.multipart.PartSource; -import at.asit.pdfover.signator.DocumentSource; +import at.asit.pdfover.signer.DocumentSource; /** * diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Status.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Status.java index a6e6c28a..ba5e5fd5 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Status.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Status.java @@ -21,11 +21,11 @@ import java.io.File; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.commons.BKUs; import at.asit.pdfover.gui.MainWindowBehavior; import at.asit.pdfover.gui.workflow.states.State; -import at.asit.pdfover.signator.BKUs; -import at.asit.pdfover.signator.SignResult; -import at.asit.pdfover.signator.SignaturePosition; +import at.asit.pdfover.signer.SignResult; +import at.asit.pdfover.signer.SignaturePosition; import at.asit.pdfover.signer.pdfas.PdfAs4SigningState; public class Status { diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationDataInMemory.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationDataInMemory.java index 98a858d1..71cf5567 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationDataInMemory.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationDataInMemory.java @@ -28,11 +28,11 @@ import org.eclipse.swt.widgets.Display; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.commons.BKUs; import at.asit.pdfover.commons.Constants; import at.asit.pdfover.gui.bku.mobile.MobileBKUHelper; import at.asit.pdfover.gui.exceptions.InvalidEmblemFile; import at.asit.pdfover.gui.exceptions.InvalidPortException; -import at.asit.pdfover.signator.BKUs; /** * Implementation of the configuration container diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java index 51a01420..ada3970f 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationManager.java @@ -30,6 +30,7 @@ import org.eclipse.swt.graphics.Point; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.commons.BKUs; import at.asit.pdfover.commons.Constants; import at.asit.pdfover.gui.bku.mobile.MobileBKUs; import at.asit.pdfover.gui.exceptions.InvalidEmblemFile; @@ -37,7 +38,6 @@ import at.asit.pdfover.gui.exceptions.InvalidPortException; import at.asit.pdfover.gui.utils.LocaleSerializer; import at.asit.pdfover.gui.workflow.config.ConfigurationDataInMemory.KeyStorePassStorageType; import at.asit.pdfover.commons.Messages; -import at.asit.pdfover.signator.BKUs; /** * Implementation of the configuration provider and manipulator diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java index 3d2d95b7..a86e68b3 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java @@ -23,11 +23,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.MainWindow.Buttons; +import at.asit.pdfover.commons.BKUs; import at.asit.pdfover.gui.MainWindowBehavior; import at.asit.pdfover.gui.composites.BKUSelectionComposite; import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; -import at.asit.pdfover.signator.BKUs; /** * Decides which BKU to use (preconfigured or let user choose) diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java index 1d2074c7..54730b10 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java @@ -36,7 +36,7 @@ import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; import at.asit.pdfover.gui.workflow.config.ConfigurationManager; import at.asit.pdfover.gui.workflow.config.ConfigurationDataInMemory.KeyStorePassStorageType; -import at.asit.pdfover.signator.SignatureException; +import at.asit.pdfover.signer.SignatureException; import at.asit.pdfover.signer.pdfas.PdfAs4SigningState; /** diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java index 2d443185..d84d5a50 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java @@ -23,7 +23,7 @@ import java.util.TimerTask; // Imports import at.asit.pdfover.gui.exceptions.ATrustConnectionException; -import at.asit.pdfover.signator.SignatureException; +import at.asit.pdfover.signer.SignatureException; import at.asit.pdfover.signer.pdfas.PdfAs4SigningState; import org.eclipse.swt.SWT; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java index 22a93246..082f7277 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java @@ -42,7 +42,7 @@ import at.asit.pdfover.commons.Messages; import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; import at.asit.pdfover.gui.workflow.config.ConfigurationManager; -import at.asit.pdfover.signator.SignaturePosition; +import at.asit.pdfover.signer.SignaturePosition; import at.gv.egiz.pdfas.lib.impl.placeholder.SignaturePlaceholderData; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java index e3ab559c..13b83999 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java @@ -34,8 +34,8 @@ import at.asit.pdfover.commons.Messages; import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; import at.asit.pdfover.gui.workflow.config.ConfigurationManager; -import at.asit.pdfover.signator.Emblem; -import at.asit.pdfover.signator.SignaturePosition; +import at.asit.pdfover.signer.Emblem; +import at.asit.pdfover.signer.SignaturePosition; import at.asit.pdfover.signer.pdfas.PdfAs4SignatureParameter; import at.asit.pdfover.signer.pdfas.PdfAs4SignaturePlaceholder; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java index 0d006e82..87693c19 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java @@ -44,7 +44,7 @@ import at.asit.pdfover.gui.utils.Zipper; import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; import at.asit.pdfover.gui.workflow.config.ConfigurationManager; -import at.asit.pdfover.signator.SignaturePosition; +import at.asit.pdfover.signer.SignaturePosition; /** * Starting state of workflow proccess diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java index 59cb79ba..132a134b 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java @@ -32,8 +32,8 @@ import at.asit.pdfover.commons.Messages; import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; import at.asit.pdfover.gui.workflow.config.ConfigurationManager; -import at.asit.pdfover.signator.Emblem; -import at.asit.pdfover.signator.PDFFileDocumentSource; +import at.asit.pdfover.signer.Emblem; +import at.asit.pdfover.signer.PDFFileDocumentSource; import at.asit.pdfover.signer.pdfas.PdfAs4SignatureParameter; import at.asit.pdfover.signer.pdfas.PdfAs4Signer; import at.asit.pdfover.signer.pdfas.PdfAs4SigningState; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java index 03afde02..b9bdc917 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java @@ -29,7 +29,7 @@ import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.commons.Messages; import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; -import at.asit.pdfover.signator.SignatureException; +import at.asit.pdfover.signer.SignatureException; import at.asit.pdfover.signer.pdfas.PdfAs4Signer; /** diff --git a/pdf-over-gui/src/main/resources/installer-windows/PDF-Over.aip b/pdf-over-gui/src/main/resources/installer-windows/PDF-Over.aip index b8e619bb..b1cea354 100644 --- a/pdf-over-gui/src/main/resources/installer-windows/PDF-Over.aip +++ b/pdf-over-gui/src/main/resources/installer-windows/PDF-Over.aip @@ -607,7 +607,6 @@ - diff --git a/pdf-over-signator/pom.xml b/pdf-over-signator/pom.xml deleted file mode 100644 index 0641f889..00000000 --- a/pdf-over-signator/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ - - 4.0.0 - - pdf-over - at.a-sit - 4.4.3-SNAPSHOT - .. - - pdf-over-signator - PDF-Over Signator - - ${project.basedir}/.. - - - - ch.qos.logback - logback-classic - 1.2.10 - - - commons-codec - commons-codec - - - javax.activation - activation - - - org.glassfish.jaxb - jaxb-runtime - 2.4.0-b180830.0438 - - - at.a-sit - pdf-over-commons - ${project.parent.version} - compile - - - diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/BKUs.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/BKUs.java deleted file mode 100644 index be3eec4f..00000000 --- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/BKUs.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2012 by A-SIT, Secure Information Technology Center Austria - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://joinup.ec.europa.eu/software/page/eupl - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - */ -package at.asit.pdfover.signator; - -/** - * Enumeration of available BKU types - * - */ -public enum BKUs { - /** Local BKU */ - LOCAL, - - /** Mobile BKU */ - MOBILE, - - /** KeyStore */ - KS, - - /** No BKU */ - NONE -} diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/BkuSlConnector.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/BkuSlConnector.java deleted file mode 100644 index 002c457c..00000000 --- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/BkuSlConnector.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2012 by A-SIT, Secure Information Technology Center Austria - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://joinup.ec.europa.eu/software/page/eupl - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - */ -package at.asit.pdfover.signator; - -// Imports - -/** - * - */ -public interface BkuSlConnector { - /** - * @param request - * @return SL Response - * @throws SignatureException - */ - public String handleSLRequest(PdfAs4SLRequest request) throws SignatureException; -} diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/ByteArrayDocumentSource.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/ByteArrayDocumentSource.java deleted file mode 100644 index d0fb6cfe..00000000 --- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/ByteArrayDocumentSource.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2012 by A-SIT, Secure Information Technology Center Austria - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://joinup.ec.europa.eu/software/page/eupl - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - */ -package at.asit.pdfover.signator; - -//Imports -import java.io.ByteArrayInputStream; -import java.io.InputStream; - -/** - * A DocumentSource using a byte[] to store the document content - */ -public class ByteArrayDocumentSource implements DocumentSource { - - /** - * Document content - */ - protected byte[] data; - - /** - * Constructor with byte[] content - * @param data the document content - */ - public ByteArrayDocumentSource(byte[] data) { - this.data = data; - } - - @Override - public InputStream getInputStream() { - return new ByteArrayInputStream(this.data); - } - - @Override - public int getLength() { - return this.data.length; - } - - @Override - public byte[] getByteArray() { - return this.data; - } - -} diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/DocumentSource.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/DocumentSource.java deleted file mode 100644 index 3c94f104..00000000 --- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/DocumentSource.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2012 by A-SIT, Secure Information Technology Center Austria - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://joinup.ec.europa.eu/software/page/eupl - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - */ -package at.asit.pdfover.signator; - -import java.io.IOException; -import java.io.InputStream; - -/** - * A Document Source - */ -public interface DocumentSource { - - /** - * Gets the InputStream for this Document - * @return InputStream for the document - * @throws IOException - */ - public InputStream getInputStream() throws IOException; - - /** - * Get Length of document - * @return length of the document - */ - public int getLength(); - - /** - * Get Document as byte[] - * @return byte[] of the Document - */ - public byte[] getByteArray(); -} diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Emblem.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Emblem.java deleted file mode 100644 index 7f2e305c..00000000 --- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Emblem.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright 2012 by A-SIT, Secure Information Technology Center Austria - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://joinup.ec.europa.eu/software/page/eupl - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - */ -package at.asit.pdfover.signator; - -// Imports -import at.asit.pdfover.commons.Constants; -import at.asit.pdfover.commons.utils.ImageUtil; - -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.Properties; - -import javax.imageio.ImageIO; - -import org.apache.commons.codec.digest.DigestUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * TODO all of this caching business is a bit of a mess - */ -public class Emblem { - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory.getLogger(Emblem.class); - - private static final String CACHE_DIR = Constants.CONFIG_DIRECTORY; - private static final String CACHE_IMG_FILENAME = ".emblem.png"; - private static final String CACHE_IMG_FORMAT = "png"; - private static final String CACHE_PROPS_FILENAME = ".emblem.properties"; - - private static final String PROPKEY_ORIG_PATH = "IMG"; - private static final String PROPKEY_ORIG_DIGEST = "HSH"; - private static final int MAX_EMBLEM_WIDTH = 480; - private static final int MAX_EMBLEM_HEIGHT = 600; - - private String originalFileName = null; - private String originalFileHash = null; - private Image image = null; /* image data, if we have it */ - - private void lazyLoadImage() { - if (this.image != null) return; - - String filename = getCachedFileName(); - if (this.image != null) return; /* getCachedFileName may have re-generated the cache and populated this.image */ - - try { - this.image = ImageUtil.readImageWithEXIFRotation(new File(filename)); - } catch (IOException e) { - log.warn("Failed to load Emblem image"); - } - } - - public int getWidth() { if (image == null) lazyLoadImage(); return (image != null) ? image.getWidth(null) : 0; } - public int getHeight() { if (image == null) lazyLoadImage(); return (image != null) ? image.getHeight(null) : 0; } - - /** - * Constructor - * @param filename - */ - public Emblem(String filename) { - this.originalFileName = filename; - } - - private String getFileHash(String filename) throws IOException { - InputStream is = Files.newInputStream(Path.of(filename)); - return DigestUtils.md5Hex(is); - } - - private static BufferedImage reduceImageSizeIfNecessary(BufferedImage img, int maxWidth, int maxHeight) { - int oheight = img.getHeight(); - int owidth = img.getWidth(); - - double ratio = (double)owidth/(double)oheight; - - int height = oheight; - int width = owidth; - if (height > maxHeight) { - height = maxHeight; - width = (int) (maxHeight * ratio); - } - if (width > maxWidth) { - width = maxWidth; - height = (int) (maxWidth / ratio); - } - BufferedImage result = img; - if (width != owidth || height != oheight) { - //scale image - log.debug("Scaling emblem: " + owidth + "x" + oheight + " to " + width + "x" + height); - result = new BufferedImage(width, height, img.getType() == 0 ? BufferedImage.TYPE_INT_ARGB : img.getType()); - Graphics2D g = result.createGraphics(); - g.drawImage(img, 0, 0, width, height, null); - g.dispose(); - } - return result; - } - - /* (non-Javadoc) - * @see at.asit.pdfover.signator.Emblem#getFileName() - */ - public String getCachedFileName() { - String emblemImg = this.originalFileName; - String emblemHsh = null; - String cachedEmblemFileName = CACHE_DIR + File.separator + CACHE_IMG_FILENAME; - - if (emblemImg == null || !(new File(emblemImg).exists())) - return null; - - Properties emblemProps = new Properties(); - // compare cache, try to load if match - try { - File cacheProps = new File(CACHE_DIR, CACHE_PROPS_FILENAME); - if (cacheProps.exists()) { - InputStream in = new FileInputStream(cacheProps); - emblemProps.load(in); - if (emblemImg.equals(emblemProps.getProperty(PROPKEY_ORIG_PATH))) { - emblemHsh = getFileHash(emblemImg); - if (emblemHsh.equals(emblemProps.getProperty(PROPKEY_ORIG_DIGEST))) { - log.debug("Emblem cache hit: " + cachedEmblemFileName); - return cachedEmblemFileName; - } - } - } - log.debug("Emblem cache miss"); - } catch (Exception e) { - log.warn("Can't load emblem cache", e); - } - - try { - // create new cache - if (emblemHsh == null) - emblemHsh = getFileHash(emblemImg); - emblemProps.setProperty(PROPKEY_ORIG_PATH, emblemImg); - emblemProps.setProperty(PROPKEY_ORIG_DIGEST, emblemHsh); - File imgFile = new File(emblemImg); - - BufferedImage img = ImageUtil.readImageWithEXIFRotation(imgFile); - img = reduceImageSizeIfNecessary(img, MAX_EMBLEM_WIDTH, MAX_EMBLEM_HEIGHT); - - File file = new File(CACHE_DIR, CACHE_IMG_FILENAME); - ImageIO.write(img, CACHE_IMG_FORMAT, file); // ignore returned boolean - this.image = img; - OutputStream out = new FileOutputStream(new File(CACHE_DIR, CACHE_PROPS_FILENAME)); - emblemProps.store(out, null); - } catch (IOException e) { - log.error("Can't save emblem cache", e); - return this.originalFileName; - } - return cachedEmblemFileName; - } - - /** - * Return the original filename - * @return the original filename - */ - public String getOriginalFileName() { - return this.originalFileName; - } - - /** - * Return the original filename - * @return the original filename - */ - public String getOriginalFileHash() { - if (this.originalFileHash == null) { - if (this.originalFileName == null || !(new File(this.originalFileName).exists())) { - this.originalFileHash = ""; - } else try { - this.originalFileHash = getFileHash(this.originalFileName); - } catch (IOException e) { - log.debug("Error getting file hash", e); - this.originalFileHash = ""; - } - } - return this.originalFileHash; - } -} diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/PDFFileDocumentSource.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/PDFFileDocumentSource.java deleted file mode 100644 index ea9fe5fb..00000000 --- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/PDFFileDocumentSource.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2012 by A-SIT, Secure Information Technology Center Austria - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://joinup.ec.europa.eu/software/page/eupl - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - */ -package at.asit.pdfover.signator; - -// Imports -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - */ -public class PDFFileDocumentSource implements DocumentSource { - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory.getLogger(PDFFileDocumentSource.class); - - private File file; - - private byte[] data = null; - - private int len = 0; - - /** - * Default constructor - * @param file - */ - public PDFFileDocumentSource(File file) { - this.file = file; - } - - /* (non-Javadoc) - * @see at.asit.pdfover.signator.DocumentSource#getInputStream() - */ - @Override - public InputStream getInputStream() throws IOException { - return new FileInputStream(this.file); - } - - /* (non-Javadoc) - * @see at.asit.pdfover.signator.DocumentSource#getLength() - */ - @Override - public int getLength() { - if(this.file.length() > Integer.MAX_VALUE) { - log.error("File size to big!" + this.file.length()); - } - this.len = (int) this.file.length(); - return this.len; - } - - /* (non-Javadoc) - * @see at.asit.pdfover.signator.DocumentSource#getByteArray() - */ - @Override - public byte[] getByteArray() { - if(this.data == null) { - try { - InputStream stream = this.getInputStream(); - this.data = new byte[this.getLength()]; - stream.read(this.data); - stream.close(); - } catch(IOException ex) { - log.error("Failed to read file!", ex); - } - } - return this.data; - } - -} diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignResult.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignResult.java deleted file mode 100644 index 91bce421..00000000 --- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignResult.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2012 by A-SIT, Secure Information Technology Center Austria - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://joinup.ec.europa.eu/software/page/eupl - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - */ -package at.asit.pdfover.signator; - -//Imports -import java.security.cert.X509Certificate; - -/** - * The result of a signature operation - */ -public class SignResult { - - private SignaturePosition position; - private DocumentSource source; - private X509Certificate certificate; - - public SignaturePosition getSignaturePosition() { - return this.position; - } - - public DocumentSource getSignedDocument() { - return this.source; - } - - public X509Certificate getSignerCertificate() { - return this.certificate; - } - - /** - * Set the signer certificate - * @param x509Certificate the signer certificate - */ - public void setSignerCertificate(X509Certificate x509Certificate) { - this.certificate = x509Certificate; - } - - /** - * Set the signature position - * @param postion the signature position - */ - public void setSignaturePosition(SignaturePosition postion) { - this.position = postion; - } - - /** - * Set the signed document - * @param source DocumentSource containing the signed document - */ - public void setSignedDocument(DocumentSource source) { - this.source = source; - } -} diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureException.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureException.java deleted file mode 100644 index 0ac6534b..00000000 --- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureException.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2012 by A-SIT, Secure Information Technology Center Austria - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://joinup.ec.europa.eu/software/page/eupl - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - */ -package at.asit.pdfover.signator; - -//Imports - -/** - * Base class for signature exceptions - */ -public class SignatureException extends Exception { - - /** - * - */ - private static final long serialVersionUID = 711578398780816710L; - - - /** - * Empty constructor - */ - public SignatureException() { - super(); - } - - /** - * Constructor with causing exception - * @param cause the cause - */ - public SignatureException(Throwable cause) { - super(cause); - } - - /** - * Constructor with message - * @param msg the message - */ - public SignatureException(String msg) { - super(msg); - } - - /** - * Constructor with message and causing exception - * @param message the message - * @param cause the cause - */ - public SignatureException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignaturePosition.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignaturePosition.java deleted file mode 100644 index 5d0f0457..00000000 --- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignaturePosition.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright 2012 by A-SIT, Secure Information Technology Center Austria - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://joinup.ec.europa.eu/software/page/eupl - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - */ -package at.asit.pdfover.signator; - -//Imports - -/** - * Represents the position of a visible signature block - */ -public class SignaturePosition { - - /** - * The x value of the position - */ - protected float x = 0; - - /** - * The y value of the position - */ - protected float y = 0; - - /** - * The page value of the position - */ - protected int page = 0; - - /** - * Whether automatic positioning is used - */ - protected boolean autoPositioning; - - /** - * Default constructor - * No position given, hence automatic positioning will be used - */ - public SignaturePosition() { - this.autoPositioning = true; - } - - /** - * X - Y Constructor (Page = 0) - * @param x The x value of the position - * @param y The y value of the position - */ - public SignaturePosition(float x, float y) { - this.autoPositioning = false; - setPosition(x, y); - } - - /** - * Constructor - * @param x The x value of the signature position - * @param y The y value of the signature position - * @param page The page value of the signature position - */ - public SignaturePosition(float x, float y, int page) { - this.autoPositioning = false; - setPosition(x, y); - setPage(page); - } - - /** - * Sets new position - * @param x the new x value - * @param y the new y value - */ - public void setPosition(float x, float y) { - this.x = x; - this.y = y; - } - - /** - * Gets the X value of the position - * @return float the x value of the position - */ - public float getX() { - return this.x; - } - - /** - * Gets the Y value of the position - * @return float the y value of the position - */ - public float getY() { - return this.y; - } - - /** - * Sets Page value of position - * @param page the new page value - */ - public void setPage(int page) { - this.page = page; - } - - /** - * Gets the Page value of the position - * @return int the page value of the position - */ - public int getPage() { - return this.page; - } - - /** - * Gets whether automatic positioning is used - * @return true if the signature position is determined automatically - */ - public boolean useAutoPositioning() { - return this.autoPositioning; - } -} diff --git a/pdf-over-signer/pom.xml b/pdf-over-signer/pom.xml index 0988ada4..cf277d74 100644 --- a/pdf-over-signer/pom.xml +++ b/pdf-over-signer/pom.xml @@ -13,11 +13,6 @@ 4.2.1-snapshot - - at.a-sit - pdf-over-signator - ${project.version} - at.gv.egiz.pdfas pdf-as-lib diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/BkuSlConnector.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/BkuSlConnector.java new file mode 100644 index 00000000..d91e8466 --- /dev/null +++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/BkuSlConnector.java @@ -0,0 +1,32 @@ +/* + * Copyright 2012 by A-SIT, Secure Information Technology Center Austria + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://joinup.ec.europa.eu/software/page/eupl + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + */ +package at.asit.pdfover.signer; + +import at.asit.pdfover.signer.pdfas.PdfAs4SLRequest; + +// Imports + +/** + * + */ +public interface BkuSlConnector { + /** + * @param request + * @return SL Response + * @throws SignatureException + */ + public String handleSLRequest(PdfAs4SLRequest request) throws SignatureException; +} diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/ByteArrayDocumentSource.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/ByteArrayDocumentSource.java new file mode 100644 index 00000000..024722cc --- /dev/null +++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/ByteArrayDocumentSource.java @@ -0,0 +1,55 @@ +/* + * Copyright 2012 by A-SIT, Secure Information Technology Center Austria + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://joinup.ec.europa.eu/software/page/eupl + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + */ +package at.asit.pdfover.signer; + +//Imports +import java.io.ByteArrayInputStream; +import java.io.InputStream; + +/** + * A DocumentSource using a byte[] to store the document content + */ +public class ByteArrayDocumentSource implements DocumentSource { + + /** + * Document content + */ + protected byte[] data; + + /** + * Constructor with byte[] content + * @param data the document content + */ + public ByteArrayDocumentSource(byte[] data) { + this.data = data; + } + + @Override + public InputStream getInputStream() { + return new ByteArrayInputStream(this.data); + } + + @Override + public int getLength() { + return this.data.length; + } + + @Override + public byte[] getByteArray() { + return this.data; + } + +} diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/DocumentSource.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/DocumentSource.java new file mode 100644 index 00000000..2276c257 --- /dev/null +++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/DocumentSource.java @@ -0,0 +1,44 @@ +/* + * Copyright 2012 by A-SIT, Secure Information Technology Center Austria + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://joinup.ec.europa.eu/software/page/eupl + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + */ +package at.asit.pdfover.signer; + +import java.io.IOException; +import java.io.InputStream; + +/** + * A Document Source + */ +public interface DocumentSource { + + /** + * Gets the InputStream for this Document + * @return InputStream for the document + * @throws IOException + */ + public InputStream getInputStream() throws IOException; + + /** + * Get Length of document + * @return length of the document + */ + public int getLength(); + + /** + * Get Document as byte[] + * @return byte[] of the Document + */ + public byte[] getByteArray(); +} diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/Emblem.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/Emblem.java new file mode 100644 index 00000000..c045169a --- /dev/null +++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/Emblem.java @@ -0,0 +1,200 @@ +/* + * Copyright 2012 by A-SIT, Secure Information Technology Center Austria + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://joinup.ec.europa.eu/software/page/eupl + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + */ +package at.asit.pdfover.signer; + +// Imports +import at.asit.pdfover.commons.Constants; +import at.asit.pdfover.commons.utils.ImageUtil; + +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Properties; + +import javax.imageio.ImageIO; + +import org.apache.commons.codec.digest.DigestUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * TODO all of this caching business is a bit of a mess + */ +public class Emblem { + /** + * SLF4J Logger instance + **/ + private static final Logger log = LoggerFactory.getLogger(Emblem.class); + + private static final String CACHE_DIR = Constants.CONFIG_DIRECTORY; + private static final String CACHE_IMG_FILENAME = ".emblem.png"; + private static final String CACHE_IMG_FORMAT = "png"; + private static final String CACHE_PROPS_FILENAME = ".emblem.properties"; + + private static final String PROPKEY_ORIG_PATH = "IMG"; + private static final String PROPKEY_ORIG_DIGEST = "HSH"; + private static final int MAX_EMBLEM_WIDTH = 480; + private static final int MAX_EMBLEM_HEIGHT = 600; + + private String originalFileName = null; + private String originalFileHash = null; + private Image image = null; /* image data, if we have it */ + + private void lazyLoadImage() { + if (this.image != null) return; + + String filename = getCachedFileName(); + if (this.image != null) return; /* getCachedFileName may have re-generated the cache and populated this.image */ + + try { + this.image = ImageUtil.readImageWithEXIFRotation(new File(filename)); + } catch (IOException e) { + log.warn("Failed to load Emblem image"); + } + } + + public int getWidth() { if (image == null) lazyLoadImage(); return (image != null) ? image.getWidth(null) : 0; } + public int getHeight() { if (image == null) lazyLoadImage(); return (image != null) ? image.getHeight(null) : 0; } + + /** + * Constructor + * @param filename + */ + public Emblem(String filename) { + this.originalFileName = filename; + } + + private String getFileHash(String filename) throws IOException { + InputStream is = Files.newInputStream(Path.of(filename)); + return DigestUtils.md5Hex(is); + } + + private static BufferedImage reduceImageSizeIfNecessary(BufferedImage img, int maxWidth, int maxHeight) { + int oheight = img.getHeight(); + int owidth = img.getWidth(); + + double ratio = (double)owidth/(double)oheight; + + int height = oheight; + int width = owidth; + if (height > maxHeight) { + height = maxHeight; + width = (int) (maxHeight * ratio); + } + if (width > maxWidth) { + width = maxWidth; + height = (int) (maxWidth / ratio); + } + BufferedImage result = img; + if (width != owidth || height != oheight) { + //scale image + log.debug("Scaling emblem: " + owidth + "x" + oheight + " to " + width + "x" + height); + result = new BufferedImage(width, height, img.getType() == 0 ? BufferedImage.TYPE_INT_ARGB : img.getType()); + Graphics2D g = result.createGraphics(); + g.drawImage(img, 0, 0, width, height, null); + g.dispose(); + } + return result; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.signator.Emblem#getFileName() + */ + public String getCachedFileName() { + String emblemImg = this.originalFileName; + String emblemHsh = null; + String cachedEmblemFileName = CACHE_DIR + File.separator + CACHE_IMG_FILENAME; + + if (emblemImg == null || !(new File(emblemImg).exists())) + return null; + + Properties emblemProps = new Properties(); + // compare cache, try to load if match + try { + File cacheProps = new File(CACHE_DIR, CACHE_PROPS_FILENAME); + if (cacheProps.exists()) { + InputStream in = new FileInputStream(cacheProps); + emblemProps.load(in); + if (emblemImg.equals(emblemProps.getProperty(PROPKEY_ORIG_PATH))) { + emblemHsh = getFileHash(emblemImg); + if (emblemHsh.equals(emblemProps.getProperty(PROPKEY_ORIG_DIGEST))) { + log.debug("Emblem cache hit: " + cachedEmblemFileName); + return cachedEmblemFileName; + } + } + } + log.debug("Emblem cache miss"); + } catch (Exception e) { + log.warn("Can't load emblem cache", e); + } + + try { + // create new cache + if (emblemHsh == null) + emblemHsh = getFileHash(emblemImg); + emblemProps.setProperty(PROPKEY_ORIG_PATH, emblemImg); + emblemProps.setProperty(PROPKEY_ORIG_DIGEST, emblemHsh); + File imgFile = new File(emblemImg); + + BufferedImage img = ImageUtil.readImageWithEXIFRotation(imgFile); + img = reduceImageSizeIfNecessary(img, MAX_EMBLEM_WIDTH, MAX_EMBLEM_HEIGHT); + + File file = new File(CACHE_DIR, CACHE_IMG_FILENAME); + ImageIO.write(img, CACHE_IMG_FORMAT, file); // ignore returned boolean + this.image = img; + OutputStream out = new FileOutputStream(new File(CACHE_DIR, CACHE_PROPS_FILENAME)); + emblemProps.store(out, null); + } catch (IOException e) { + log.error("Can't save emblem cache", e); + return this.originalFileName; + } + return cachedEmblemFileName; + } + + /** + * Return the original filename + * @return the original filename + */ + public String getOriginalFileName() { + return this.originalFileName; + } + + /** + * Return the original filename + * @return the original filename + */ + public String getOriginalFileHash() { + if (this.originalFileHash == null) { + if (this.originalFileName == null || !(new File(this.originalFileName).exists())) { + this.originalFileHash = ""; + } else try { + this.originalFileHash = getFileHash(this.originalFileName); + } catch (IOException e) { + log.debug("Error getting file hash", e); + this.originalFileHash = ""; + } + } + return this.originalFileHash; + } +} diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/PDFFileDocumentSource.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/PDFFileDocumentSource.java new file mode 100644 index 00000000..7dc5ef6a --- /dev/null +++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/PDFFileDocumentSource.java @@ -0,0 +1,88 @@ +/* + * Copyright 2012 by A-SIT, Secure Information Technology Center Austria + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://joinup.ec.europa.eu/software/page/eupl + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + */ +package at.asit.pdfover.signer; + +// Imports +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + */ +public class PDFFileDocumentSource implements DocumentSource { + /** + * SLF4J Logger instance + **/ + private static final Logger log = LoggerFactory.getLogger(PDFFileDocumentSource.class); + + private File file; + + private byte[] data = null; + + private int len = 0; + + /** + * Default constructor + * @param file + */ + public PDFFileDocumentSource(File file) { + this.file = file; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.signator.DocumentSource#getInputStream() + */ + @Override + public InputStream getInputStream() throws IOException { + return new FileInputStream(this.file); + } + + /* (non-Javadoc) + * @see at.asit.pdfover.signator.DocumentSource#getLength() + */ + @Override + public int getLength() { + if(this.file.length() > Integer.MAX_VALUE) { + log.error("File size to big!" + this.file.length()); + } + this.len = (int) this.file.length(); + return this.len; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.signator.DocumentSource#getByteArray() + */ + @Override + public byte[] getByteArray() { + if(this.data == null) { + try { + InputStream stream = this.getInputStream(); + this.data = new byte[this.getLength()]; + stream.read(this.data); + stream.close(); + } catch(IOException ex) { + log.error("Failed to read file!", ex); + } + } + return this.data; + } + +} diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/SignResult.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/SignResult.java new file mode 100644 index 00000000..d9aa5075 --- /dev/null +++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/SignResult.java @@ -0,0 +1,65 @@ +/* + * Copyright 2012 by A-SIT, Secure Information Technology Center Austria + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://joinup.ec.europa.eu/software/page/eupl + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + */ +package at.asit.pdfover.signer; + +//Imports +import java.security.cert.X509Certificate; + +/** + * The result of a signature operation + */ +public class SignResult { + + private SignaturePosition position; + private DocumentSource source; + private X509Certificate certificate; + + public SignaturePosition getSignaturePosition() { + return this.position; + } + + public DocumentSource getSignedDocument() { + return this.source; + } + + public X509Certificate getSignerCertificate() { + return this.certificate; + } + + /** + * Set the signer certificate + * @param x509Certificate the signer certificate + */ + public void setSignerCertificate(X509Certificate x509Certificate) { + this.certificate = x509Certificate; + } + + /** + * Set the signature position + * @param postion the signature position + */ + public void setSignaturePosition(SignaturePosition postion) { + this.position = postion; + } + + /** + * Set the signed document + * @param source DocumentSource containing the signed document + */ + public void setSignedDocument(DocumentSource source) { + this.source = source; + } +} diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/SignatureException.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/SignatureException.java new file mode 100644 index 00000000..87b37dfe --- /dev/null +++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/SignatureException.java @@ -0,0 +1,62 @@ +/* + * Copyright 2012 by A-SIT, Secure Information Technology Center Austria + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://joinup.ec.europa.eu/software/page/eupl + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + */ +package at.asit.pdfover.signer; + +//Imports + +/** + * Base class for signature exceptions + */ +public class SignatureException extends Exception { + + /** + * + */ + private static final long serialVersionUID = 711578398780816710L; + + + /** + * Empty constructor + */ + public SignatureException() { + super(); + } + + /** + * Constructor with causing exception + * @param cause the cause + */ + public SignatureException(Throwable cause) { + super(cause); + } + + /** + * Constructor with message + * @param msg the message + */ + public SignatureException(String msg) { + super(msg); + } + + /** + * Constructor with message and causing exception + * @param message the message + * @param cause the cause + */ + public SignatureException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/SignaturePosition.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/SignaturePosition.java new file mode 100644 index 00000000..81871506 --- /dev/null +++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/SignaturePosition.java @@ -0,0 +1,124 @@ +/* + * Copyright 2012 by A-SIT, Secure Information Technology Center Austria + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://joinup.ec.europa.eu/software/page/eupl + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + */ +package at.asit.pdfover.signer; + +//Imports + +/** + * Represents the position of a visible signature block + */ +public class SignaturePosition { + + /** + * The x value of the position + */ + protected float x = 0; + + /** + * The y value of the position + */ + protected float y = 0; + + /** + * The page value of the position + */ + protected int page = 0; + + /** + * Whether automatic positioning is used + */ + protected boolean autoPositioning; + + /** + * Default constructor + * No position given, hence automatic positioning will be used + */ + public SignaturePosition() { + this.autoPositioning = true; + } + + /** + * X - Y Constructor (Page = 0) + * @param x The x value of the position + * @param y The y value of the position + */ + public SignaturePosition(float x, float y) { + this.autoPositioning = false; + setPosition(x, y); + } + + /** + * Constructor + * @param x The x value of the signature position + * @param y The y value of the signature position + * @param page The page value of the signature position + */ + public SignaturePosition(float x, float y, int page) { + this.autoPositioning = false; + setPosition(x, y); + setPage(page); + } + + /** + * Sets new position + * @param x the new x value + * @param y the new y value + */ + public void setPosition(float x, float y) { + this.x = x; + this.y = y; + } + + /** + * Gets the X value of the position + * @return float the x value of the position + */ + public float getX() { + return this.x; + } + + /** + * Gets the Y value of the position + * @return float the y value of the position + */ + public float getY() { + return this.y; + } + + /** + * Sets Page value of position + * @param page the new page value + */ + public void setPage(int page) { + this.page = page; + } + + /** + * Gets the Page value of the position + * @return int the page value of the position + */ + public int getPage() { + return this.page; + } + + /** + * Gets whether automatic positioning is used + * @return true if the signature position is determined automatically + */ + public boolean useAutoPositioning() { + return this.autoPositioning; + } +} diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4BKUSLConnector.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4BKUSLConnector.java index 4c87542d..533a0487 100644 --- a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4BKUSLConnector.java +++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4BKUSLConnector.java @@ -22,8 +22,8 @@ import javax.xml.bind.JAXBException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import at.asit.pdfover.signator.BkuSlConnector; -import at.asit.pdfover.signator.SignatureException; +import at.asit.pdfover.signer.BkuSlConnector; +import at.asit.pdfover.signer.SignatureException; import at.asit.pdfover.signer.pdfas.exceptions.PdfAs4SLRequestException; import at.gv.egiz.pdfas.common.exceptions.PDFIOException; import at.gv.egiz.pdfas.common.exceptions.PdfAsException; diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Helper.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Helper.java index a41f2378..45dc2724 100644 --- a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Helper.java +++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Helper.java @@ -21,7 +21,7 @@ import java.io.File; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import at.asit.pdfover.signator.SignatureException; +import at.asit.pdfover.signer.SignatureException; import at.gv.egiz.pdfas.lib.api.PdfAs; import at.gv.egiz.pdfas.lib.api.PdfAsFactory; diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SLRequest.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SLRequest.java index 20c919f2..785d6089 100644 --- a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SLRequest.java +++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SLRequest.java @@ -15,8 +15,7 @@ */ package at.asit.pdfover.signer.pdfas; -// Imports -import at.asit.pdfover.signator.ByteArrayDocumentSource; +import at.asit.pdfover.signer.ByteArrayDocumentSource; import at.asit.pdfover.signer.pdfas.exceptions.PdfAs4SLRequestException; /** diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java index 745f10ea..e45de3fa 100644 --- a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java +++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java @@ -28,14 +28,14 @@ import java.util.Locale; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import at.asit.pdfover.signator.BKUs; -import at.asit.pdfover.signator.DocumentSource; -import at.asit.pdfover.signator.Emblem; -import at.asit.pdfover.signator.SignaturePosition; +import at.asit.pdfover.signer.DocumentSource; +import at.asit.pdfover.signer.Emblem; +import at.asit.pdfover.signer.SignaturePosition; import at.gv.egiz.pdfas.lib.api.Configuration; import at.gv.egiz.pdfas.lib.api.PdfAs; import at.gv.egiz.pdfas.lib.api.PdfAsFactory; import at.gv.egiz.pdfas.lib.api.sign.SignParameter; +import at.asit.pdfover.commons.BKUs; import at.asit.pdfover.commons.Constants; import at.asit.pdfover.commons.Profile; diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java index e0790dfc..80a7e14d 100644 --- a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java +++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java @@ -7,10 +7,10 @@ import javax.activation.DataSource; import at.asit.pdfover.commons.Constants; import at.asit.pdfover.commons.Profile; -import at.asit.pdfover.signator.ByteArrayDocumentSource; -import at.asit.pdfover.signator.SignResult; -import at.asit.pdfover.signator.SignatureException; -import at.asit.pdfover.signator.SignaturePosition; +import at.asit.pdfover.signer.ByteArrayDocumentSource; +import at.asit.pdfover.signer.SignResult; +import at.asit.pdfover.signer.SignatureException; +import at.asit.pdfover.signer.SignaturePosition; import at.gv.egiz.pdfas.common.exceptions.PDFASError; import at.gv.egiz.pdfas.common.exceptions.PdfAsException; import at.gv.egiz.pdfas.lib.api.ByteArrayDataSource; diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SigningState.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SigningState.java index 2192f380..3ff0f75a 100644 --- a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SigningState.java +++ b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SigningState.java @@ -18,8 +18,8 @@ package at.asit.pdfover.signer.pdfas; //Imports import java.io.ByteArrayOutputStream; -import at.asit.pdfover.signator.BkuSlConnector; -import at.asit.pdfover.signator.SignatureException; +import at.asit.pdfover.signer.BkuSlConnector; +import at.asit.pdfover.signer.SignatureException; import at.gv.egiz.pdfas.common.exceptions.PDFASError; import at.gv.egiz.pdfas.lib.api.sign.IPlainSigner; import at.gv.egiz.pdfas.lib.api.sign.SignParameter; diff --git a/pom.xml b/pom.xml index 3b373236..1038d658 100644 --- a/pom.xml +++ b/pom.xml @@ -83,7 +83,6 @@ pdf-over-commons pdf-over-gui - pdf-over-signator pdf-over-signer -- cgit v1.2.3