From 96ea325cbce319f64ad548908e395825bbdca83f Mon Sep 17 00:00:00 2001 From: Tobias Kellner Date: Mon, 23 Feb 2015 15:31:03 +0100 Subject: Make BASE64 usage configurable for a-trust mobile bku --- .../main/java/at/asit/pdfover/gui/Constants.java | 5 ++++- .../asit/pdfover/gui/bku/mobile/ATrustHandler.java | 8 ++++++-- .../pdfover/gui/workflow/config/ConfigProvider.java | 6 ++++++ .../gui/workflow/config/ConfigProviderImpl.java | 13 +++++++++++++ .../gui/workflow/config/ConfigurationContainer.java | 12 ++++++++++++ .../workflow/config/ConfigurationContainerImpl.java | 21 +++++++++++++++++++++ .../pdfover/gui/workflow/states/MobileBKUState.java | 9 ++++++--- 7 files changed, 68 insertions(+), 6 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 16c5f7cf..228485cd 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 @@ -125,7 +125,7 @@ public class Constants { public static final String CFG_SIGNATURE_POSITION = "SIGNATURE_POSITION"; //$NON-NLS-1$ /** The signature placeholder transparency config parameter (0-255) */ - public static final String CFG_SIGNATURE_PLACEHOLDER_TRANSPARENCY = "SIGNATURE_PLACEHOLDER_TRANSPARENCY"; //$NON-NLS-1$ + public static final String CFG_SIGNATURE_PLACEHOLDER_TRANSPARENCY = "SIGNATURE_PLACEHOLDER_TRANSPARENCY"; //$NON-NLS-1$ /** The mobile number config parameter */ public static final String CFG_MOBILE_NUMBER = "MOBILE_NUMBER"; //$NON-NLS-1$ @@ -145,6 +145,9 @@ public class Constants { /** Mobile bku type config parameter */ public static final String CFG_MOBILE_BKU_TYPE = "MOBILE_BKU_TYPE"; //$NON-NLS-1$ + /** Mobile bku BASE64 config parameter */ + public static final String CFG_MOBILE_BKU_BASE64 = "MOBILE_BKU_BASE64"; //$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/bku/mobile/ATrustHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustHandler.java index 12eff95b..43a4002e 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 @@ -44,10 +44,12 @@ public class ATrustHandler extends MobileBKUHandler { /** * @param state * @param shell + * @param useBase64 */ - public ATrustHandler(MobileBKUState state, Shell shell) { + public ATrustHandler(MobileBKUState state, Shell shell, boolean useBase64) { super(state); this.shell = shell; + this.useBase64 = useBase64; } /** @@ -56,6 +58,8 @@ public class ATrustHandler extends MobileBKUHandler { private static final Logger log = LoggerFactory .getLogger(ATrustHandler.class); + private boolean useBase64 = false; + /* (non-Javadoc) * @see at.asit.pdfover.gui.workflow.states.mobilebku.MobileBKUHandler#handleSLRequestResponse(java.lang.String) */ @@ -240,6 +244,6 @@ public class ATrustHandler extends MobileBKUHandler { */ @Override public boolean useBase64Request() { - return false; + return this.useBase64; } } 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 d4489e27..ac67fb9b 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 @@ -132,6 +132,12 @@ public interface ConfigProvider { */ public MobileBKUs getMobileBKUType(); + /** + * Gets the mobile BKU BASE64 setting + * @return the mobile BKU BASE64 setting + */ + public boolean getMobileBKUBase64(); + /** * Get the signature note text to use * @return the signature note text 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 5ec55555..2bf59a02 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 @@ -151,6 +151,10 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } + String useBase64 = config.getProperty(Constants.CFG_MOBILE_BKU_BASE64); + if (useBase64 != null) + this.configuration.setMobileBKUBase64(useBase64.equalsIgnoreCase(Constants.TRUE)); + // Set Proxy Port String proxyPortString = config .getProperty(Constants.CFG_PROXY_PORT); @@ -950,6 +954,15 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return this.configuration.getMobileBKUType(); } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigProvider#getMobileBKUBase64() + */ + @Override + public boolean getMobileBKUBase64() { + return this.configuration.getMobileBKUBase64(); + } + /* * (non-Javadoc) * 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 6d5e888e..6215fb87 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 @@ -231,6 +231,18 @@ public interface ConfigurationContainer { */ public void setMobileBKUType(MobileBKUs bkuType); + /** + * Gets the mobile BKU BASE64 setting + * @return the mobile BKU BASE64 setting + */ + public boolean getMobileBKUBase64(); + + /** + * Sets the mobile BKU BASE64 setting + * @param useBase64 the mobile BKU BASE64 setting + */ + public void setMobileBKUBase64(boolean useBase64); + /** * Gets the default signature position * @return the default signature position 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 726e5b4b..c7ec2c34 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 @@ -100,6 +100,9 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { /** Holds the mobile BKU type */ protected MobileBKUs mobileBKUType = Constants.DEFAULT_MOBILE_BKU_TYPE; + /** Holds the mobile BKU BASE64 setting */ + protected boolean mobileBKUBase64 = false; + /** Holds the main window size */ protected Point mainWindowSize = null; @@ -434,6 +437,24 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { } + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getMobileBKUBase64() + */ + @Override + public boolean getMobileBKUBase64() { + return this.mobileBKUBase64; + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getMobileBKUBase64(boolean) + */ + @Override + public void setMobileBKUBase64(boolean useBase64) { + this.mobileBKUBase64 = useBase64; + } + + /* (non-Javadoc) * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#getSignaturePosition() */ 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 6b0d6684..68f0f02a 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 @@ -49,10 +49,13 @@ public class MobileBKUState extends State { */ public MobileBKUState(StateMachine stateMachine) { super(stateMachine); - switch(getStateMachine().getConfigProvider().getMobileBKUType()) { + ConfigProvider provider = stateMachine.getConfigProvider(); + switch(provider.getMobileBKUType()) { case A_TRUST: - this.status = new ATrustStatus(getStateMachine().getConfigProvider()); - this.handler = new ATrustHandler(this, getStateMachine().getGUIProvider().getMainShell()); + this.status = new ATrustStatus(provider); + this.handler = new ATrustHandler(this, + stateMachine.getGUIProvider().getMainShell(), + provider.getMobileBKUBase64()); break; case IAIK: -- cgit v1.2.3