use of org.kse.gui.dialogs.DViewSecretKey in project keystore-explorer by kaikramer.
the class KeyDetailsAction method showKeySelectedEntry.
/**
* Show the key details of the selected KeyStore entry.
*/
public void showKeySelectedEntry() {
try {
KeyStoreHistory history = kseFrame.getActiveKeyStoreHistory();
KeyStoreState currentState = history.getCurrentState();
String alias = kseFrame.getSelectedEntryAlias();
Password password = getEntryPassword(alias, currentState);
if (password == null) {
return;
}
KeyStore keyStore = currentState.getKeyStore();
Key key = keyStore.getKey(alias, password.toCharArray());
if (key instanceof SecretKey) {
SecretKey secretKey = (SecretKey) key;
DViewSecretKey dViewSecretKey = new DViewSecretKey(frame, MessageFormat.format(res.getString("KeyDetailsAction.SecretKeyDetailsEntry.Title"), alias), secretKey);
dViewSecretKey.setLocationRelativeTo(frame);
dViewSecretKey.setVisible(true);
} else if (key instanceof PrivateKey) {
PrivateKey privateKey = (PrivateKey) key;
DViewPrivateKey dViewPrivateKey = new DViewPrivateKey(frame, MessageFormat.format(res.getString("KeyDetailsAction.PrivateKeyDetailsEntry.Title"), alias), privateKey, history.getExplicitProvider());
dViewPrivateKey.setLocationRelativeTo(frame);
dViewPrivateKey.setVisible(true);
} else if (key instanceof PublicKey) {
PublicKey publicKey = (PublicKey) key;
DViewPublicKey dViewPublicKey = new DViewPublicKey(frame, MessageFormat.format(res.getString("KeyDetailsAction.PublicKeyDetailsEntry.Title"), alias), publicKey);
dViewPublicKey.setLocationRelativeTo(frame);
dViewPublicKey.setVisible(true);
}
} catch (Exception ex) {
DError.displayError(frame, ex);
}
}
Aggregations