diff options
author | Tobias Kellner <imcybot@gmail.com> | 2015-10-12 04:27:03 +0200 |
---|---|---|
committer | Tobias Kellner <imcybot@gmail.com> | 2015-10-12 04:27:03 +0200 |
commit | eeb3ec439e67085c04849e24446936eba1d8171e (patch) | |
tree | d360aa6ad89641432e0397d998f8eaa8e0f79c3c /pdf-over-gui | |
parent | 3603b045cee533bbdc629d592c6cff56923eb857 (diff) | |
download | pdf-over-eeb3ec439e67085c04849e24446936eba1d8171e.tar.gz pdf-over-eeb3ec439e67085c04849e24446936eba1d8171e.tar.bz2 pdf-over-eeb3ec439e67085c04849e24446936eba1d8171e.zip |
Use keystore config data, prompt for passwords if unset
Diffstat (limited to 'pdf-over-gui')
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java | 24 |
1 files changed, 23 insertions, 1 deletions
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 1072942c..37a691dd 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 @@ -24,9 +24,11 @@ import at.asit.pdfover.gui.MainWindow.Buttons; import at.asit.pdfover.gui.MainWindowBehavior; import at.asit.pdfover.gui.controls.Dialog.BUTTONS; import at.asit.pdfover.gui.controls.ErrorDialog; +import at.asit.pdfover.gui.controls.PasswordInputDialog; import at.asit.pdfover.gui.utils.Messages; import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; +import at.asit.pdfover.gui.workflow.config.ConfigProvider; import at.asit.pdfover.signator.SignatureException; import at.asit.pdfover.signator.SigningState; @@ -60,9 +62,29 @@ public class KSState extends State { Status status = getStateMachine().getStatus(); SigningState signingState = status.getSigningState(); + ConfigProvider config = getStateMachine().getConfigProvider(); try { - signingState.setKSSigner("D:/Downloads/test.p12", "ecc_test", "123456", "123456", "PKCS12"); + String file = config.getKeyStoreFile(); + String alias = config.getKeyStoreAlias(); + String storePass = config.getKeyStoreStorePass(); + if (storePass.isEmpty()) { + PasswordInputDialog pwd = new PasswordInputDialog( + getStateMachine().getGUIProvider().getMainShell(), + Messages.getString("keystore_config.KeystoreStorePass"), //$NON-NLS-1$ + Messages.getString("keystore.KeystoreStorePassEntry")); //$NON-NLS-1$ + storePass = pwd.open(); + } + String keyPass = config.getKeyStoreKeyPass(); + if (keyPass.isEmpty()) { + PasswordInputDialog pwd = new PasswordInputDialog( + getStateMachine().getGUIProvider().getMainShell(), + Messages.getString("keystore_config.KeystoreKeyPass"), //$NON-NLS-1$ + Messages.getString("keystore.KeystoreKeyPassEntry")); //$NON-NLS-1$ + keyPass = pwd.open(); + } + String type = config.getKeyStoreType(); + signingState.setKSSigner(file, alias, storePass, keyPass, type); } catch (SignatureException e) { log.error("Error loading keystore", e); //$NON-NLS-1$ ErrorDialog dialog = new ErrorDialog( |