summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-over-gui/src/main')
-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
13 files changed, 22 insertions, 198 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 {