Search in sources :

Example 31 with KeyStoreHistory

use of org.kse.utilities.history.KeyStoreHistory in project keystore-explorer by kaikramer.

the class DExamineSsl method initComponents.

private void initComponents() {
    jlSslHost = new JLabel(res.getString("DExamineSsl.jlSslHost.text"));
    jcbSslHost = new JComboBox<String>();
    jcbSslHost.setEditable(true);
    jcbSslHost.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
    jcbSslHost.setToolTipText(res.getString("DExamineSsl.jtfSslHost.tooltip"));
    jcbSslHost.setModel(new DefaultComboBoxModel<String>(getSslHosts()));
    jlSslPort = new JLabel(res.getString("DExamineSsl.jlSslPort.text"));
    jcbSslPort = new JComboBox<String>();
    jcbSslPort.setEditable(true);
    jcbSslPort.setToolTipText(res.getString("DExamineSsl.jtfSslPort.tooltip"));
    jcbSslPort.setModel(new DefaultComboBoxModel<String>(getSslPorts()));
    jcbClientAuth = new JCheckBox(res.getString("DExamineSsl.jlEnableClientAuth.text"));
    jcbKeyStore = new JComboBox<KeyStoreHistory>(getKeystoreNames());
    jcbKeyStore.setToolTipText(res.getString("DExamineSsl.jcbKeyStore.tooltip"));
    jbLoadKeystore = new JButton();
    jbLoadKeystore.setIcon(new ImageIcon(getClass().getResource(res.getString("DExamineSsl.jbOpen.image"))));
    jbLoadKeystore.setToolTipText(res.getString("DExamineSsl.jbLoadKeystore.tooltip"));
    jbOK = new JButton(res.getString("DExamineSsl.jbOK.text"));
    jbCancel = new JButton(res.getString("DExamineSsl.jbCancel.text"));
    jbCancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), CANCEL_KEY);
    jpButtons = PlatformUtil.createDialogButtonPanel(jbOK, jbCancel);
    Container pane = getContentPane();
    pane.setLayout(new MigLayout("insets dialog, fill", "[para]unrel[right]unrel[]", "[]unrel[]"));
    MiGUtil.addSeparator(pane, res.getString("DExamineSsl.jlConnSettings.text"));
    pane.add(jlSslHost, "skip");
    pane.add(jcbSslHost, "sgx, wrap");
    pane.add(jlSslPort, "skip");
    pane.add(jcbSslPort, "sgx, wrap para");
    MiGUtil.addSeparator(pane, res.getString("DExamineSsl.jlClientAuth.text"));
    pane.add(jcbClientAuth, "left, spanx, wrap");
    pane.add(new JLabel(res.getString("DExamineSsl.jlKeyStore.text")), "skip");
    pane.add(jcbKeyStore, "sgx");
    pane.add(jbLoadKeystore, "wrap para");
    pane.add(new JSeparator(), "spanx, growx, wrap para");
    pane.add(jpButtons, "right, spanx");
    jcbClientAuth.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            updateClientAuthComponents();
        }
    });
    jbLoadKeystore.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            OpenAction openAction = new OpenAction(kseFrame);
            openAction.actionPerformed(evt);
            updateClientAuthComponents();
        }
    });
    jbOK.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            okPressed();
        }
    });
    jbCancel.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            cancelPressed();
        }
    });
    jbCancel.getActionMap().put(CANCEL_KEY, new AbstractAction() {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent evt) {
            cancelPressed();
        }
    });
    addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent evt) {
            closeDialog();
        }
    });
    updateClientAuthComponents();
    setResizable(false);
    getRootPane().setDefaultButton(jbOK);
    pack();
}
Also used : ImageIcon(javax.swing.ImageIcon) KeyStoreHistory(org.kse.utilities.history.KeyStoreHistory) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) MigLayout(net.miginfocom.swing.MigLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) WindowAdapter(java.awt.event.WindowAdapter) ActionEvent(java.awt.event.ActionEvent) JSeparator(javax.swing.JSeparator) JCheckBox(javax.swing.JCheckBox) Container(java.awt.Container) OpenAction(org.kse.gui.actions.OpenAction) ActionListener(java.awt.event.ActionListener) WindowEvent(java.awt.event.WindowEvent) AbstractAction(javax.swing.AbstractAction)

Example 32 with KeyStoreHistory

use of org.kse.utilities.history.KeyStoreHistory in project keystore-explorer by kaikramer.

the class KseFrame method addKeyStore.

/**
 * Add a KeyStore to the set of loaded KeyStores.
 *
 * @param keyStore
 *            KeyStore
 * @param keyStoreFile
 *            KeyStore file
 * @param password
 *            KeyStore password
 */
public void addKeyStore(KeyStore keyStore, File keyStoreFile, Password password) {
    KeyStoreHistory history = new KeyStoreHistory(keyStore, keyStoreFile, password);
    addKeyStoreHistory(history);
}
Also used : KeyStoreHistory(org.kse.utilities.history.KeyStoreHistory)

Example 33 with KeyStoreHistory

use of org.kse.utilities.history.KeyStoreHistory in project keystore-explorer by kaikramer.

the class KseFrame method showSelectedEntryDetails.

private void showSelectedEntryDetails(JTable jtKeyStore, int row) {
    jtKeyStore.setRowSelectionInterval(row, row);
    // Selection changed - update edit controls
    updateCutCopyPasteControls();
    KeyStoreHistory history = getActiveKeyStoreHistory();
    KeyStore keyStore = history.getCurrentState().getKeyStore();
    String alias = getSelectedEntryAlias();
    try {
        if (KeyStoreUtil.isKeyPairEntry(alias, keyStore)) {
            keyPairCertificateChainDetailsAction.showCertificateSelectedEntry();
        } else if (KeyStoreUtil.isTrustedCertificateEntry(alias, keyStore)) {
            trustedCertificateDetailsAction.showCertificateSelectedEntry();
        } else if (KeyStoreUtil.isKeyEntry(alias, keyStore)) {
            keyDetailsAction.showKeySelectedEntry();
        }
    } catch (Exception ex) {
        DError.displayError(frame, ex);
    }
}
Also used : KeyStoreHistory(org.kse.utilities.history.KeyStoreHistory) KeyStore(java.security.KeyStore) KeyStoreException(java.security.KeyStoreException) GeneralSecurityException(java.security.GeneralSecurityException) CryptoException(org.kse.crypto.CryptoException)

Example 34 with KeyStoreHistory

use of org.kse.utilities.history.KeyStoreHistory in project keystore-explorer by kaikramer.

the class KseFrame method addKeyStore.

/**
 * Add a KeyStore to the set of loaded KeyStores.
 *
 * @param keyStore
 *            KeyStore
 * @param keyStoreName
 *            KeyStore name
 * @param password
 *            KeyStore password
 * @param explicitProvider
 *            Explicitly specify a provider that is used for this keystore
 */
public void addKeyStore(KeyStore keyStore, String keyStoreName, Password password, Provider explicitProvider) {
    KeyStoreHistory history = new KeyStoreHistory(keyStore, keyStoreName, password, explicitProvider);
    addKeyStoreHistory(history);
}
Also used : KeyStoreHistory(org.kse.utilities.history.KeyStoreHistory)

Example 35 with KeyStoreHistory

use of org.kse.utilities.history.KeyStoreHistory in project keystore-explorer by kaikramer.

the class KseFrame method updateKeyStoreTabsText.

private void updateKeyStoreTabsText() {
    for (int i = 0; i < histories.size(); i++) {
        KeyStoreHistory history = histories.get(i);
        KeyStoreTab keyStoreTab = (KeyStoreTab) jkstpKeyStores.getTabComponentAt(i);
        // Tab component may not be available yet
        if (keyStoreTab != null) {
            if (!history.getCurrentState().isSavedState()) {
                // Unsaved Changes - append '*'
                String title = MessageFormat.format("{0} *", history.getName());
                keyStoreTab.updateTitle(title);
            } else {
                String title = history.getName();
                keyStoreTab.updateTitle(title);
            }
            // Set tooltip text to be the same as is displayed for the
            // KeyStore's status bar text
            jkstpKeyStores.setToolTipTextAt(i, getKeyStoreStatusText(history));
        }
    }
}
Also used : KeyStoreHistory(org.kse.utilities.history.KeyStoreHistory) Point(java.awt.Point)

Aggregations

KeyStoreHistory (org.kse.utilities.history.KeyStoreHistory)60 KeyStore (java.security.KeyStore)45 KeyStoreState (org.kse.utilities.history.KeyStoreState)41 Password (org.kse.crypto.Password)31 X509Certificate (java.security.cert.X509Certificate)21 PrivateKey (java.security.PrivateKey)17 Certificate (java.security.cert.Certificate)13 Key (java.security.Key)12 CryptoException (org.kse.crypto.CryptoException)11 KeyStoreType (org.kse.crypto.keystore.KeyStoreType)11 DGetAlias (org.kse.gui.dialogs.DGetAlias)10 KeyStoreException (java.security.KeyStoreException)9 File (java.io.File)7 GeneralSecurityException (java.security.GeneralSecurityException)6 DViewCertificate (org.kse.gui.dialogs.DViewCertificate)6 DGetNewPassword (org.kse.gui.password.DGetNewPassword)6 FileNotFoundException (java.io.FileNotFoundException)5 PublicKey (java.security.PublicKey)5 Provider (java.security.Provider)4 ArrayList (java.util.ArrayList)3