summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java32
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java11
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java26
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java11
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java45
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/PDFSigner.java59
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachine.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java1
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java3
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java5
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java15
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java6
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/Signator.java86
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/Signer.java48
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignerFactory.java28
-rw-r--r--pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java15
-rw-r--r--pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignerFactory.java31
18 files changed, 26 insertions, 402 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java
index 013d084f..a8e5ff8e 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java
@@ -41,7 +41,6 @@ import at.asit.pdfover.gui.composites.configuration.SimpleConfigurationComposite
import at.asit.pdfover.gui.controls.ErrorDialog;
import at.asit.pdfover.gui.exceptions.ResumableException;
import at.asit.pdfover.commons.Messages;
-import at.asit.pdfover.gui.workflow.PDFSigner;
import at.asit.pdfover.gui.workflow.config.ConfigurationManager;
import at.asit.pdfover.gui.workflow.config.ConfigurationDataInMemory;
import at.asit.pdfover.gui.workflow.states.State;
@@ -52,11 +51,6 @@ import at.asit.pdfover.gui.workflow.states.State;
public class ConfigurationComposite extends StateComposite {
/**
- * The PDF Signer used to produce signature block preview
- */
- protected PDFSigner signer;
-
- /**
* SLF4J Logger instance
**/
static final Logger log = LoggerFactory.getLogger(ConfigurationComposite.class);
@@ -124,13 +118,6 @@ public class ConfigurationComposite extends StateComposite {
private Button btnAbbrechen;
/**
- * @return the signer
- */
- public PDFSigner getSigner() {
- return this.signer;
- }
-
- /**
* Create the composite.
*
* @param parent
@@ -251,25 +238,6 @@ public class ConfigurationComposite extends StateComposite {
this.doLayout();
}
- /**
- * @param signer
- * the signer to set
- */
- public void setSigner(PDFSigner signer) {
- this.signer = signer;
- if (this.simpleConfigComposite != null) {
- this.simpleConfigComposite.setSigner(getSigner());
- }
- if (this.advancedConfigComposite != null) {
- // not needed at the moment
- this.advancedConfigComposite.setSigner(getSigner());
- }
- if (this.keystoreConfigComposite != null) {
- // not needed at the moment
- this.keystoreConfigComposite.setSigner(getSigner());
- }
- }
-
private boolean keystoreInitialized = false;
/**
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java
index fe3442a0..1f1cc1ba 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java
@@ -132,10 +132,6 @@ public class AboutComposite extends ConfigurationCompositeBase {
this.btnOpenLogDirectory.setText(Messages.getString("config.ShowLogDirectory"));
}
-
- @Override
- protected void signerChanged() {}
-
@Override
public void initConfiguration(ConfigurationManager provider) {}
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 31a10b01..e9776846 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
@@ -455,17 +455,6 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase {
AdvancedConfigurationComposite.this.txtSaveFilePostFix.setText(postfix);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * at.asit.pdfover.gui.composites.BaseConfigurationComposite#signerChanged()
- */
- @Override
- protected void signerChanged() {
- // Nothing to do here (yet)
- }
-
void performOutputFolderChanged(String foldername) {
log.debug("Selected Output folder: {}", foldername);
this.configurationContainer.outputFolder = foldername;
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java
index 16dcd366..54207292 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java
@@ -19,7 +19,6 @@ package at.asit.pdfover.gui.composites.configuration;
import org.eclipse.swt.widgets.Composite;
import at.asit.pdfover.gui.composites.StateComposite;
-import at.asit.pdfover.gui.workflow.PDFSigner;
import at.asit.pdfover.gui.workflow.config.ConfigurationManager;
import at.asit.pdfover.gui.workflow.config.ConfigurationDataInMemory;
import at.asit.pdfover.gui.workflow.states.State;
@@ -35,31 +34,6 @@ public abstract class ConfigurationCompositeBase extends StateComposite {
protected ConfigurationDataInMemory configurationContainer;
/**
- * The PDF Signer used to produce signature block preview
- */
- protected PDFSigner signer;
-
- /**
- * @return the signer
- */
- public PDFSigner getSigner() {
- return this.signer;
- }
-
- /**
- * @param signer the signer to set
- */
- public void setSigner(PDFSigner signer) {
- this.signer = signer;
- this.signerChanged();
- }
-
- /**
- * Called when the signer is changed!
- */
- protected abstract void signerChanged();
-
- /**
* @param parent
* @param style
* @param state
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java
index 74d3d62b..14100128 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java
@@ -430,17 +430,6 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase {
/*
* (non-Javadoc)
*
- * @see
- * at.asit.pdfover.gui.composites.BaseConfigurationComposite#signerChanged()
- */
- @Override
- protected void signerChanged() {
- // Nothing to do here (yet)
- }
-
- /*
- * (non-Javadoc)
- *
* @see at.asit.pdfover.gui.composites.StateComposite#doLayout()
*/
@Override
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 2de930bf..c5ad6f5a 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
@@ -68,6 +68,7 @@ import at.asit.pdfover.gui.workflow.config.ConfigurationDataInMemory;
import at.asit.pdfover.gui.workflow.states.State;
import at.asit.pdfover.signator.CachedFileNameEmblem;
import at.asit.pdfover.signator.SignatureParameter;
+import at.asit.pdfover.signer.pdfas.PdfAs4Signer;
/**
*
@@ -440,22 +441,20 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase {
ImageData logo = null;
try {
- if (this.signer != null) {
- SignatureParameter param = this.signer.getPDFSigner().newParameter();
- if(this.configurationContainer.signatureNote != null && !this.configurationContainer.signatureNote.isEmpty()) {
- param.setProperty("SIG_NOTE", this.configurationContainer.signatureNote);
- }
+ SignatureParameter param = PdfAs4Signer.newParameter();
+ if(this.configurationContainer.signatureNote != null && !this.configurationContainer.signatureNote.isEmpty()) {
+ param.setProperty("SIG_NOTE", this.configurationContainer.signatureNote);
+ }
- param.setSignatureLanguage(this.configurationContainer.signatureLocale.getLanguage());
- param.setSignaturePdfACompat(this.configurationContainer.signaturePDFACompat);
- if (image != null && !image.trim().isEmpty()) {
- logo = new ImageData(image);
- param.setEmblem(new CachedFileNameEmblem(image));
- }
- //TODO deactivated the placeholder preview
- //TODO display accurate placeholder preview -> now its only standard placeholder shown
- //img = SignaturePlaceholderCache.getSWTPlaceholder(param);
+ param.setSignatureLanguage(this.configurationContainer.signatureLocale.getLanguage());
+ param.setSignaturePdfACompat(this.configurationContainer.signaturePDFACompat);
+ if (image != null && !image.trim().isEmpty()) {
+ logo = new ImageData(image);
+ param.setEmblem(new CachedFileNameEmblem(image));
}
+ //TODO deactivated the placeholder preview
+ //TODO display accurate placeholder preview -> now its only standard placeholder shown
+ //img = SignaturePlaceholderCache.getSWTPlaceholder(param);
} catch (Exception e) {
log.error("Failed to load image for display...", e);
}
@@ -555,12 +554,8 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase {
}
void setSignatureProfileSetting(){
- if (this.signer == null){
- log.debug("In setSignatureProfileSettings: Signer was null");
- return;
- }
try {
- SignatureParameter param = this.signer.getPDFSigner().newParameter();
+ SignatureParameter param = PdfAs4Signer.newParameter();
param.setSignatureProfile(this.configurationContainer.getSignatureProfile().name());
} catch (Exception e){
@@ -568,18 +563,6 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase {
}
}
- /*
- * (non-Javadoc)
- *
- * @see
- * at.asit.pdfover.gui.composites.BaseConfigurationComposite#signerChanged()
- */
- @Override
- protected void signerChanged() {
- this.setVisibleImage();
- this.setSignatureProfileSetting();
- }
-
private void plainMobileNumberSetter() {
String number = this.txtMobileNumber.getText();
this.configurationContainer.setMobileNumber(number);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/PDFSigner.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/PDFSigner.java
deleted file mode 100644
index 2f670556..00000000
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/PDFSigner.java
+++ /dev/null
@@ -1,59 +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.gui.workflow;
-
-// Imports
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import at.asit.pdfover.signator.Signator;
-import at.asit.pdfover.signator.Signator.Signers;
-import at.asit.pdfover.signator.Signer;
-
-/**
- *
- */
-public class PDFSigner {
- /**
- * SLF4J Logger instance
- **/
- @SuppressWarnings("unused")
- private static final Logger log = LoggerFactory.getLogger(PDFSigner.class);
-
- private Signers signer = Signator.Signers.PDFAS4;
-
- public Signers getUsedPDFSignerLibrary() {
- return this.signer;
- }
-
- public void setUsedPDFSignerLibrary(Signers signer) {
- if(signer != this.signer) {
- // TYPE CHANGE remove cached signer!
- this.signerLib = null;
- }
- this.signer = signer;
- }
-
- private Signer signerLib;
-
- public Signer getPDFSigner() {
- if(this.signerLib == null) {
- this.signerLib = Signator.getSigner(getUsedPDFSignerLibrary());
- }
- return this.signerLib;
- }
-
-}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachine.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachine.java
index 17a8d56f..f60393a8 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachine.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachine.java
@@ -41,7 +41,6 @@ public class StateMachine implements GUIProvider {
private static final Logger log = LoggerFactory.getLogger(StateMachine.class);
public final Status status;
- public final PDFSigner pdfSigner;
public final ConfigurationManager configProvider;
public final String[] cmdLineArgs;
@@ -53,7 +52,6 @@ public class StateMachine implements GUIProvider {
public StateMachine(String[] cmdLineArgs) {
this.status = new Status();
this.status.setCurrentState(new PrepareConfigurationState(this));
- this.pdfSigner = new PDFSigner();
this.configProvider = new ConfigurationManager();
this.cmdLineArgs = cmdLineArgs;
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java
index 9e7f2d42..1f63e760 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java
@@ -45,7 +45,6 @@ public class ConfigurationUIState extends State {
this.configurationComposite =
getStateMachine().createComposite(ConfigurationComposite.class, SWT.RESIZE, this);
this.configurationComposite.setConfigProvider(getStateMachine().configProvider);
- this.configurationComposite.setSigner(getStateMachine().pdfSigner);
}
return this.configurationComposite;
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 3383b11b..142e3965 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
@@ -39,6 +39,7 @@ import at.asit.pdfover.signator.CachedFileNameEmblem;
import at.asit.pdfover.signator.Emblem;
import at.asit.pdfover.signator.SignatureParameter;
import at.asit.pdfover.signator.SignaturePosition;
+import at.asit.pdfover.signer.pdfas.PdfAs4Signer;
/**
* Decides where to position the signature block
@@ -107,7 +108,7 @@ public class PositioningState extends State {
}
// Update possibly changed values
ConfigurationManager config = stateMachine.configProvider;
- SignatureParameter param = stateMachine.pdfSigner.getPDFSigner().newParameter();
+ SignatureParameter param = PdfAs4Signer.newParameter();
Emblem emblem = new CachedFileNameEmblem(config.getDefaultEmblem());
param.setEmblem(emblem);
if(config.getSignatureNote() != null && !config.getSignatureNote().isEmpty()) {
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 f50f171d..1a3fd8b5 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
@@ -51,7 +51,6 @@ import at.asit.pdfover.gui.workflow.GUIProvider;
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.Signator;
import at.asit.pdfover.signator.SignaturePosition;
/**
@@ -342,10 +341,6 @@ public class PrepareConfigurationState extends State {
}).start();
}
- // Set usedSignerLib ...
- stateMachine.pdfSigner.setUsedPDFSignerLibrary(
- Signator.Signers.PDFAS4);
-
// Create PDF Signer
Status status = stateMachine.status;
status.bku = getStateMachine().configProvider.getDefaultBKU();
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 3eef7504..7964fe40 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
@@ -35,7 +35,7 @@ import at.asit.pdfover.gui.workflow.config.ConfigurationManager;
import at.asit.pdfover.signator.CachedFileNameEmblem;
import at.asit.pdfover.signator.PDFFileDocumentSource;
import at.asit.pdfover.signator.SignatureParameter;
-import at.asit.pdfover.signator.Signer;
+import at.asit.pdfover.signer.pdfas.PdfAs4Signer;
/**
* User waiting state, wait for PDF Signator library to prepare document for
@@ -122,12 +122,9 @@ public class PrepareSigningState extends State {
}
});
}
- if (this.state.signer == null) {
- this.state.signer = this.state.getStateMachine().pdfSigner.getPDFSigner();
- }
if (this.state.signatureParameter == null) {
- this.state.signatureParameter = this.state.signer.newParameter();
+ this.state.signatureParameter = PdfAs4Signer.newParameter();
}
this.state.signatureParameter.setInputDocument(new PDFFileDocumentSource(status.document));
@@ -154,7 +151,7 @@ public class PrepareSigningState extends State {
this.state.signatureParameter.setSignatureProfile(configuration.getSignatureProfile());
- this.state.signingState = this.state.signer.prepare(this.state.signatureParameter);
+ this.state.signingState = PdfAs4Signer.prepare(this.state.signatureParameter);
} catch (Exception e) {
log.error("PrepareDocumentThread: ", e);
@@ -185,8 +182,6 @@ public class PrepareSigningState extends State {
at.asit.pdfover.signator.SigningState signingState = null;
- Signer signer;
-
Exception threadException = null;
@Override
@@ -195,12 +190,10 @@ public class PrepareSigningState extends State {
getStateMachine().display(waiting);
- this.signer = getStateMachine().pdfSigner.getPDFSigner();
-
Status status = getStateMachine().status;
if (this.signatureParameter == null) {
- this.signatureParameter = this.signer.newParameter();
+ this.signatureParameter = PdfAs4Signer.newParameter();
}
if (this.signingState == null && this.threadException == null) {
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 82cdb31c..03afde02 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
@@ -30,7 +30,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.signator.SignatureException;
-import at.asit.pdfover.signator.Signer;
+import at.asit.pdfover.signer.pdfas.PdfAs4Signer;
/**
* Logical state for signing process, usually show BKU Dialog during this state.
@@ -54,10 +54,8 @@ public class SigningState extends State {
@Override
public void run() {
try {
- Signer signer = this.state.getStateMachine().pdfSigner.getPDFSigner();
Status status = this.state.getStateMachine().status;
-
- status.signResult = signer.sign(status.signingState);
+ status.signResult = PdfAs4Signer.sign(status.signingState);
} catch(Exception e) {
this.state.threadException = e;
} finally {
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Signator.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Signator.java
deleted file mode 100644
index 798788d2..00000000
--- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Signator.java
+++ /dev/null
@@ -1,86 +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 org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.EnumMap;
-import java.util.Map;
-
-/**
- * PDF Signator Interface
- */
-public class Signator {
-
- /**
- * SLF4J Logger instance
- **/
- private static Logger log = LoggerFactory.getLogger(Signator.class);
-
- /**
- * List of available PDF signing libraries
- */
- public enum Signers {
- /**
- * PDF-AS 3
- */
- PDFAS,
- /**
- * PDF-AS 4
- */
- PDFAS4
- };
-
- private static Map<Signers, SignerFactory> factoryMap;
-
- static {
- factoryMap = new EnumMap<Signers, SignerFactory>(Signers.class);
-
- try {
-// Class<?> pdfAsClass = Class.forName("at.asit.pdfover.signer.pdfas.PDFASSignerFactory");
-// SignerFactory factory = (SignerFactory)pdfAsClass.newInstance();
-// registerSigner(Signers.PDFAS, factory);
- Class<?> pdfAs4Class = Class.forName("at.asit.pdfover.signer.pdfas.PdfAs4SignerFactory");
- SignerFactory factory = (SignerFactory)pdfAs4Class.getDeclaredConstructor().newInstance();
- registerSigner(Signers.PDFAS4, factory);
- } catch (ClassNotFoundException e) {
- log.error("PDF Signer Factory not found", e);
- throw new RuntimeException("PDF Signer Factory not found", e);
- } catch (InstantiationException | InvocationTargetException | NoSuchMethodException e) {
- log.error("PDF Signer Factory could not be instantiated", e);
- throw new RuntimeException("PDF Signer Factory could not be instantiated", e);
- } catch (IllegalAccessException e) {
- log.error("PDF Signer Factory could not accessed", e);
- throw new RuntimeException("PDF Signer Factory could not accessed", e);
- }
- }
-
- private static void registerSigner(Signers signer, SignerFactory factory) {
- factoryMap.put(signer, factory);
- }
-
- /**
- * Gets a PDF Signer according to the chosen signer library
- * @param signer the chosen Signer type
- * @return the PDF Signer
- */
- public static Signer getSigner(Signers signer) {
- return factoryMap.get(signer).createSigner();
- }
-}
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Signer.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Signer.java
deleted file mode 100644
index 5140f0e0..00000000
--- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Signer.java
+++ /dev/null
@@ -1,48 +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;
-
-/**
- * PDF Signer base Class
- * This class should be extended to support libraries such as PDF-AS or PADES.
- */
-public interface Signer {
-
- /**
- * Prepare a signature
- * Defines signature parameters, the pdf library prepares the pdf document to sign and
- * creates a Security Layer Request.
- * @param parameter The signature parameters
- * @return The signing state (contains the prepared document and the signature request
- * @throws SignatureException
- */
- public SigningState prepare(SignatureParameter parameter) throws SignatureException;
-
- /**
- * Adds the signature to the document.
- * The SL Response has to be set in the state
- * @param state The signing state
- * @return The signature Result
- * @throws SignatureException
- */
- public SignResult sign(SigningState state) throws SignatureException;
-
- /**
- * Creates new signing profile
- * @return The new Profile
- */
- public SignatureParameter newParameter();
-}
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignerFactory.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignerFactory.java
deleted file mode 100644
index cde150f8..00000000
--- a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignerFactory.java
+++ /dev/null
@@ -1,28 +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;
-
-/**
- * A Signer factory
- * Creates Signer instances
- */
-public abstract class SignerFactory {
- /**
- * Create a Signer
- * @return the new Signer
- */
- public abstract Signer createSigner();
-}
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 9943ec0e..bc5d4263 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
@@ -12,7 +12,6 @@ import at.asit.pdfover.signator.SignResultImpl;
import at.asit.pdfover.signator.SignatureException;
import at.asit.pdfover.signator.SignatureParameter;
import at.asit.pdfover.signator.SignaturePosition;
-import at.asit.pdfover.signator.Signer;
import at.asit.pdfover.signator.SigningState;
import at.gv.egiz.pdfas.common.exceptions.PDFASError;
import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
@@ -30,10 +29,7 @@ import at.knowcenter.wag.egov.egiz.pdf.TablePos;
/**
* PDF AS Signer Implementation
*/
-public class PdfAs4Signer implements Signer {
-
-
-
+public class PdfAs4Signer {
/**
* The template URL
@@ -46,8 +42,7 @@ public class PdfAs4Signer implements Signer {
protected static final String LOC_REF = "<sl:LocRefContent>" + URL_TEMPLATE
+ "</sl:LocRefContent>";
- @Override
- public SigningState prepare(SignatureParameter parameter)
+ public static SigningState prepare(SignatureParameter parameter)
throws SignatureException {
PdfAs4SignatureParameter sign_para = null;
@@ -97,8 +92,7 @@ public class PdfAs4Signer implements Signer {
return state;
}
- @Override
- public SignResult sign(SigningState state) throws SignatureException {
+ public static SignResult sign(SigningState state) throws SignatureException {
try {
PdfAs4SigningState sstate = null;
@@ -157,8 +151,7 @@ public class PdfAs4Signer implements Signer {
}
}
- @Override
- public SignatureParameter newParameter() {
+ public static SignatureParameter newParameter() {
return new PdfAs4SignatureParameter();
}
}
diff --git a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignerFactory.java b/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignerFactory.java
deleted file mode 100644
index 3fa7ce16..00000000
--- a/pdf-over-signer/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignerFactory.java
+++ /dev/null
@@ -1,31 +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.signer.pdfas;
-
-//Imports
-import at.asit.pdfover.signator.Signer;
-import at.asit.pdfover.signator.SignerFactory;
-
-/**
- * Factory class for PDF-AS Signer
- */
-public class PdfAs4SignerFactory extends SignerFactory {
-
- @Override
- public Signer createSigner() {
- return new PdfAs4Signer();
- }
-}