diff options
author | Tobias Kellner <tobias.kellner@iaik.tugraz.at> | 2015-10-08 17:55:01 +0200 |
---|---|---|
committer | Tobias Kellner <tobias.kellner@iaik.tugraz.at> | 2015-10-08 17:56:11 +0200 |
commit | 86d2a12c001e74a1a549768eeb25ca0d1d389757 (patch) | |
tree | 0fceaa129289548455d049ddc8a3db64e5db7630 | |
parent | d9b7f8f0ed2befcd0bbfa80c84c6a89e190ff481 (diff) | |
download | pdf-over-86d2a12c001e74a1a549768eeb25ca0d1d389757.tar.gz pdf-over-86d2a12c001e74a1a549768eeb25ca0d1d389757.tar.bz2 pdf-over-86d2a12c001e74a1a549768eeb25ca0d1d389757.zip |
Add keystore configuration
8 files changed, 544 insertions, 1 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java index 228485cd..cdd96043 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java @@ -148,6 +148,24 @@ public class Constants { /** Mobile bku BASE64 config parameter */ public static final String CFG_MOBILE_BKU_BASE64 = "MOBILE_BKU_BASE64"; //$NON-NLS-1$ + /** KeyStore enabled config parameter */ + public static final String CFG_KEYSTORE_ENABLED = "KEYSTORE_ENABLED"; //$NON-NLS-1$ + + /** KeyStore file config parameter */ + public static final String CFG_KEYSTORE_FILE = "KEYSTORE_FILE"; //$NON-NLS-1$ + + /** KeyStore type config parameter */ + public static final String CFG_KEYSTORE_TYPE = "KEYSTORE_TYPE"; //$NON-NLS-1$ + + /** KeyStore alias config parameter */ + public static final String CFG_KEYSTORE_ALIAS = "KEYSTORE_ALIAS"; //$NON-NLS-1$ + + /** KeyStore store password config parameter */ + public static final String CFG_KEYSTORE_STOREPASS = "KEYSTORE_STOREPASS"; //$NON-NLS-1$ + + /** KeyStore key password config parameter */ + public static final String CFG_KEYSTORE_KEYPASS = "KEYSTORE_KEYPASS"; //$NON-NLS-1$ + /** The emblem config parameter */ public static final String CFG_EMBLEM = "EMBLEM"; //$NON-NLS-1$ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigManipulator.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigManipulator.java index 346c59ae..701d0faf 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigManipulator.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigManipulator.java @@ -118,6 +118,36 @@ public interface ConfigManipulator { public void setSignaturePdfACompat(boolean compat); /** + * Sets whether keystore signing is enabled + * @param enabled whether keystore signing is enabled + */ + public void setKeyStoreEnabled(Boolean enabled); + + /** + * Sets the keystore file + * @param file the keystore file + */ + public void setKeyStoreFile(String file); + + /** + * Sets the keystore type + * @param type the keystore type + */ + public void setKeyStoreType(String type); + + /** + * Sets the keystore store password + * @param storePass the keystore store password + */ + public void setKeyStoreStorePass(String storePass); + + /** + * Sets the keystore key password + * @param keyPass the keystore key password + */ + public void setKeyStoreKeyPass(String keyPass); + + /** * Sets whether to automatically check for application updates * @param checkUpdate whether to automatically check for application updates */ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigOverlayManipulator.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigOverlayManipulator.java index e3fec9f5..4eca4e4f 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigOverlayManipulator.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigOverlayManipulator.java @@ -91,6 +91,36 @@ public interface ConfigOverlayManipulator { public void setSkipFinishOverlay(boolean skipFinish); /** + * Sets whether keystore signing is enabled + * @param enabled whether keystore signing is enabled + */ + public void setKeyStoreEnabledOverlay(Boolean enabled); + + /** + * Sets the keystore file + * @param file the keystore file + */ + public void setKeyStoreFileOverlay(String file); + + /** + * Sets the keystore type + * @param type the keystore type + */ + public void setKeyStoreTypeOverlay(String type); + + /** + * Sets the keystore store password + * @param storePass the keystore store password + */ + public void setKeyStoreStorePassOverlay(String storePass); + + /** + * Sets the keystore key password + * @param keyPass the keystore key password + */ + public void setKeyStoreKeyPassOverlay(String keyPass); + + /** * Sets the configuration file * @param configurationFile */ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java index ac67fb9b..30063efa 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java @@ -163,6 +163,36 @@ public interface ConfigProvider { public boolean getSignaturePdfACompat(); /** + * Gets whether keystore signing is enabled + * @return whether keystore signing is enabled + */ + public Boolean getKeyStoreEnabled(); + + /** + * Gets the keystore file + * @return the keystore file + */ + public String getKeyStoreFile(); + + /** + * Gets the keystore type + * @return the keystore type + */ + public String getKeyStoreType(); + + /** + * Gets the keystore store password + * @return the keystore store password + */ + public String getKeyStoreStorePass(); + + /** + * Gets the keystore key password + * @return the keystore key password + */ + public String getKeyStoreKeyPass(); + + /** * Gets whether to automatically check for application updates * @return whether to automatically check for application updates */ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java index c43f3293..edc6e167 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java @@ -274,6 +274,19 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } setDefaultSignaturePosition(position); + //Set keystore stuff + String keystoreEnabled = config.getProperty(Constants.CFG_KEYSTORE_ENABLED); + if (keystoreEnabled != null) + setKeyStoreEnabled(keystoreEnabled.equalsIgnoreCase(Constants.TRUE)); + String keystoreFile = config.getProperty(Constants.CFG_KEYSTORE_FILE); + setKeyStoreFile(keystoreFile); + String keystoreType = config.getProperty(Constants.CFG_KEYSTORE_TYPE); + setKeyStoreType(keystoreType); + String keystoreStorePass = config.getProperty(Constants.CFG_KEYSTORE_STOREPASS); + setKeyStoreStorePass(keystoreStorePass); + String keystoreKeyPass = config.getProperty(Constants.CFG_KEYSTORE_KEYPASS); + setKeyStoreKeyPass(keystoreKeyPass); + // Set update check String updateCheck = config.getProperty(Constants.CFG_UPDATE_CHECK); if (updateCheck != null) @@ -359,6 +372,21 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, if (Constants.THEME != Constants.Themes.DEFAULT) props.setProperty(Constants.CFG_THEME, Constants.THEME.name()); + if (getKeyStoreEnabledPersistent()) + props.setProperty(Constants.CFG_KEYSTORE_ENABLED, Constants.TRUE); + String keystoreFile = getKeyStoreFilePersistent(); + if (keystoreFile != STRING_EMPTY) + props.setProperty(Constants.CFG_KEYSTORE_FILE, keystoreFile); + String keystoreType = getKeyStoreTypePersistent(); + if (keystoreType != STRING_EMPTY) + props.setProperty(Constants.CFG_KEYSTORE_TYPE, keystoreType); + String keystoreStorePass = getKeyStoreStorePassPersistent(); + if (keystoreStorePass != STRING_EMPTY) + props.setProperty(Constants.CFG_KEYSTORE_STOREPASS, keystoreStorePass); + String keystoreKeyPass = getKeyStoreKeyPassPersistent(); + if (keystoreKeyPass != STRING_EMPTY) + props.setProperty(Constants.CFG_KEYSTORE_KEYPASS, keystoreKeyPass); + if (!getUpdateCheck()) props.setProperty(Constants.CFG_UPDATE_CHECK, Constants.FALSE); @@ -1069,6 +1097,228 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigManipulator#setKeyStoreEnabled(boolean) + */ + @Override + public void setKeyStoreEnabled(Boolean enabled) { + this.configuration.setKeyStoreEnabled(enabled); + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigOverlayManipulator#setKeyStoreEnabledOverlay(boolean) + */ + @Override + public void setKeyStoreEnabledOverlay(Boolean enabled) { + this.configurationOverlay.setKeyStoreEnabled(enabled); + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigProvider#getKeyStoreEnabled() + */ + @Override + public Boolean getKeyStoreEnabled() { + Boolean enabled = this.configurationOverlay.getKeyStoreEnabled(); + if (enabled == null) + enabled = getKeyStoreEnabledPersistent(); + return enabled; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.PersistentConfigProvider#getKeyStoreEnabledPersistent() + */ + @Override + public Boolean getKeyStoreEnabledPersistent() { + Boolean enabled = this.configuration.getKeyStoreEnabled(); + if (enabled == null) + enabled = false; + return enabled; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigManipulator#setKeyStoreFile(java.lang.String) + */ + @Override + public void setKeyStoreFile(String file) { + if (file == null || file.trim().isEmpty()) { + this.configuration.setKeyStoreFile(STRING_EMPTY); + } else { + this.configuration.setKeyStoreFile(file); + } + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigOverlayManipulator#setKeyStoreFileOverlay(java.lang.String) + */ + @Override + public void setKeyStoreFileOverlay(String file) { + if (file == null || file.trim().isEmpty()) { + this.configurationOverlay.setKeyStoreFile(STRING_EMPTY); + } else { + this.configurationOverlay.setKeyStoreFile(file); + } + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigProvider#getKeyStoreFile() + */ + @Override + public String getKeyStoreFile() { + String file = this.configurationOverlay.getKeyStoreFile(); + if (file == null) + file = getKeyStoreFilePersistent(); + return file; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.PersistentConfigProvider#getKeyStoreFilePersistent() + */ + @Override + public String getKeyStoreFilePersistent() { + String file = this.configuration.getKeyStoreFile(); + if (file == null) + file = STRING_EMPTY; + return file; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigManipulator#setKeyStoreType(java.lang.String) + */ + @Override + public void setKeyStoreType(String type) { + if (type == null || type.trim().isEmpty()) { + this.configuration.setKeyStoreType(STRING_EMPTY); + } else { + this.configuration.setKeyStoreType(type); + } + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigOverlayManipulator#setKeyStoreTypeOverlay(java.lang.String) + */ + @Override + public void setKeyStoreTypeOverlay(String type) { + if (type == null || type.trim().isEmpty()) { + this.configurationOverlay.setKeyStoreType(STRING_EMPTY); + } else { + this.configurationOverlay.setKeyStoreType(type); + } + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigProvider#getKeyStoreType() + */ + @Override + public String getKeyStoreType() { + String type = this.configurationOverlay.getKeyStoreType(); + if (type == null) + type = getKeyStoreTypePersistent(); + return type; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.PersistentConfigProvider#getKeyStoreTypePersistent() + */ + @Override + public String getKeyStoreTypePersistent() { + String type = this.configuration.getKeyStoreType(); + if (type == null) + type = STRING_EMPTY; + return type; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigManipulator#setKeyStoreStorePass(java.lang.String) + */ + @Override + public void setKeyStoreStorePass(String storePass) { + if (storePass == null || storePass.trim().isEmpty()) { + this.configuration.setKeyStoreStorePass(STRING_EMPTY); + } else { + this.configuration.setKeyStoreStorePass(storePass); + } + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigOverlayManipulator#setKeyStoreStorePassOverlay(java.lang.String) + */ + @Override + public void setKeyStoreStorePassOverlay(String storePass) { + if (storePass == null || storePass.trim().isEmpty()) { + this.configurationOverlay.setKeyStoreStorePass(STRING_EMPTY); + } else { + this.configurationOverlay.setKeyStoreStorePass(storePass); + } + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigProvider#getKeyStoreStorePass() + */ + @Override + public String getKeyStoreStorePass() { + String storePass = this.configurationOverlay.getKeyStoreStorePass(); + if (storePass == null) + storePass = getKeyStoreStorePassPersistent(); + return storePass; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.PersistentConfigProvider#getKeyStoreStorePassPersistent() + */ + @Override + public String getKeyStoreStorePassPersistent() { + String storePass = this.configuration.getKeyStoreStorePass(); + if (storePass == null) + storePass = STRING_EMPTY; + return storePass; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigManipulator#setKeyStoreKeyPass(java.lang.String) + */ + @Override + public void setKeyStoreKeyPass(String keyPass) { + if (keyPass == null || keyPass.trim().isEmpty()) { + this.configuration.setKeyStoreKeyPass(STRING_EMPTY); + } else { + this.configuration.setKeyStoreKeyPass(keyPass); + } + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigOverlayManipulator#setKeyStoreKeyPassOverlay(java.lang.String) + */ + @Override + public void setKeyStoreKeyPassOverlay(String keyPass) { + if (keyPass == null || keyPass.trim().isEmpty()) { + this.configurationOverlay.setKeyStoreKeyPass(STRING_EMPTY); + } else { + this.configurationOverlay.setKeyStoreKeyPass(keyPass); + } + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigProvider#getKeyStoreKeyPass() + */ + @Override + public String getKeyStoreKeyPass() { + String keyPass = this.configurationOverlay.getKeyStoreKeyPass(); + if (keyPass == null) + keyPass = getKeyStoreKeyPassPersistent(); + return keyPass; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.PersistentConfigProvider#getKeyStoreKeyPassPersistent() + */ + @Override + public String getKeyStoreKeyPassPersistent() { + String keyPass = this.configuration.getKeyStoreKeyPass(); + if (keyPass == null) + keyPass = STRING_EMPTY; + return keyPass; + } + + /* (non-Javadoc) * @see at.asit.pdfover.gui.workflow.config.ConfigManipulator#setUpdateCheck(boolean) */ @Override diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java index 6215fb87..9b312ee6 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java @@ -250,12 +250,72 @@ public interface ConfigurationContainer { public SignaturePosition getDefaultSignaturePosition(); /** - * Gets the default signature position + * Sets the default signature position * @param signaturePosition the default signature position */ public void setDefaultSignaturePosition(SignaturePosition signaturePosition); /** + * Gets whether keystore signing is enabled + * @return whether keystore signing is enabled + */ + public Boolean getKeyStoreEnabled(); + + /** + * Sets whether keystore signing is enabled + * @param enabled whether keystore signing is enabled + */ + public void setKeyStoreEnabled(Boolean enabled); + + /** + * Gets the keystore file + * @return the keystore file + */ + public String getKeyStoreFile(); + + /** + * Sets the keystore file + * @param file the keystore file + */ + public void setKeyStoreFile(String file); + + /** + * Gets the keystore type + * @return the keystore type + */ + public String getKeyStoreType(); + + /** + * Sets the keystore type + * @param type the keystore type + */ + public void setKeyStoreType(String type); + + /** + * Gets the keystore store password + * @return the keystore store password + */ + public String getKeyStoreStorePass(); + + /** + * Sets the keystore store password + * @param storePass the keystore store password + */ + public void setKeyStoreStorePass(String storePass); + + /** + * Gets the keystore key password + * @return the keystore key password + */ + public String getKeyStoreKeyPass(); + + /** + * Sets the keystore key password + * @param keyPass the keystore key password + */ + public void setKeyStoreKeyPass(String keyPass); + + /** * Gets whether to automatically check for application updates * @return whether to automatically check for application updates */ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java index c7ec2c34..f1817c83 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java @@ -109,6 +109,21 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { /** Holds the default signature position */ protected SignaturePosition defaultSignaturePosition = null; + /** Whether keystore signing is enabled */ + protected Boolean keystoreEnabled = null; + + /** Keystore file */ + protected String keystoreFile = null; + + /** Keystore type */ + protected String keystoreType = null; + + /** Keystore store password */ + protected String keystoreStorePass = null; + + /** Keystore key password */ + protected String keystoreKeyPass = null; + /** Whether to automatically check for updates */ protected boolean updateCheck = true; @@ -474,6 +489,86 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getKeyStoreEnabled() + */ + @Override + public Boolean getKeyStoreEnabled() { + return this.keystoreEnabled; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setKeyStoreEnabled(boolean) + */ + @Override + public void setKeyStoreEnabled(Boolean enabled) { + this.keystoreEnabled = enabled; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getKeyStoreFile() + */ + @Override + public String getKeyStoreFile() { + return this.keystoreFile; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setKeyStoreFile(java.lang.String) + */ + @Override + public void setKeyStoreFile(String file) { + this.keystoreFile = file; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getKeyStoreType() + */ + @Override + public String getKeyStoreType() { + return this.keystoreType; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setKeyStoreType(java.lang.String) + */ + @Override + public void setKeyStoreType(String type) { + this.keystoreType = type; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getKeyStoreStorePass() + */ + @Override + public String getKeyStoreStorePass() { + return this.keystoreStorePass; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setKeyStoreStorePass(java.lang.String) + */ + @Override + public void setKeyStoreStorePass(String storePass) { + this.keystoreStorePass = storePass; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getKeyStoreKeyPass() + */ + @Override + public String getKeyStoreKeyPass() { + return this.keystoreKeyPass; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setKeyStoreKeyPass(java.lang.String) + */ + @Override + public void setKeyStoreKeyPass(String keyPass) { + this.keystoreKeyPass = keyPass; + } + + /* (non-Javadoc) * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getUpdateCheck() */ @Override diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java index 26a98def..c3c78c75 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java @@ -134,6 +134,36 @@ public interface PersistentConfigProvider { public boolean getSignaturePdfACompat(); /** + * Gets whether keystore signing is enabled + * @return whether keystore signing is enabled + */ + public Boolean getKeyStoreEnabledPersistent(); + + /** + * Gets the keystore file + * @return the keystore file + */ + public String getKeyStoreFilePersistent(); + + /** + * Gets the keystore type + * @return the keystore type + */ + public String getKeyStoreTypePersistent(); + + /** + * Gets the keystore store password + * @return the keystore store password + */ + public String getKeyStoreStorePassPersistent(); + + /** + * Gets the keystore key password + * @return the keystore key password + */ + public String getKeyStoreKeyPassPersistent(); + + /** * Gets whether to automatically check for application updates * @return whether to automatically check for application updates */ |