use of org.kse.gui.dialogs.DViewPublicKey in project keystore-explorer by kaikramer.
the class ExamineFileAction method openPublicKey.
private void openPublicKey(File file) throws IOException, CryptoException {
PublicKey publicKey = OpenSslPubUtil.load(new FileInputStream(file));
DViewPublicKey dViewPublicKey = new DViewPublicKey(frame, MessageFormat.format(res.getString("ExamineFileAction.PublicKeyDetailsFile.Title"), file.getName()), publicKey);
dViewPublicKey.setLocationRelativeTo(frame);
dViewPublicKey.setVisible(true);
}
use of org.kse.gui.dialogs.DViewPublicKey in project keystore-explorer by kaikramer.
the class TrustedCertificatePublicKeyDetailsAction method doAction.
/**
* Do action.
*/
@Override
protected void doAction() {
try {
KeyStoreHistory history = kseFrame.getActiveKeyStoreHistory();
KeyStoreState currentState = history.getCurrentState();
KeyStore keyStore = currentState.getKeyStore();
String alias = kseFrame.getSelectedEntryAlias();
PublicKey pubKey = keyStore.getCertificate(alias).getPublicKey();
DViewPublicKey dViewPublicKey = new DViewPublicKey(frame, MessageFormat.format(res.getString("TrustedCertificatePublicKeyDetailsAction.PubKeyDetailsEntry.Title"), alias), pubKey);
dViewPublicKey.setLocationRelativeTo(frame);
dViewPublicKey.setVisible(true);
} catch (Exception ex) {
DError.displayError(frame, ex);
}
}
use of org.kse.gui.dialogs.DViewPublicKey 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);
}
}
use of org.kse.gui.dialogs.DViewPublicKey in project keystore-explorer by kaikramer.
the class KeyPairPublicKeyDetailsAction method doAction.
/**
* Do action.
*/
@Override
protected void doAction() {
try {
KeyStoreHistory history = kseFrame.getActiveKeyStoreHistory();
KeyStoreState currentState = history.getCurrentState();
KeyStore keyStore = currentState.getKeyStore();
String alias = kseFrame.getSelectedEntryAlias();
PublicKey pubKey = X509CertUtil.orderX509CertChain(X509CertUtil.convertCertificates(keyStore.getCertificateChain(alias)))[0].getPublicKey();
DViewPublicKey dViewPublicKey = new DViewPublicKey(frame, MessageFormat.format(res.getString("KeyPairPublicKeyDetailsAction.PubKeyDetailsEntry.Title"), alias), pubKey);
dViewPublicKey.setLocationRelativeTo(frame);
dViewPublicKey.setVisible(true);
} catch (Exception ex) {
DError.displayError(frame, ex);
}
}
use of org.kse.gui.dialogs.DViewPublicKey in project keystore-explorer by kaikramer.
the class DSignCsr method pubKeyDetailsPressed.
private void pubKeyDetailsPressed() {
try {
DViewPublicKey dViewPublicKey = new DViewPublicKey(this, res.getString("DSignCsr.PubKeyDetails.Title"), csrPublicKey);
dViewPublicKey.setLocationRelativeTo(this);
dViewPublicKey.setVisible(true);
} catch (CryptoException ex) {
DError dError = new DError(this, ex);
dError.setLocationRelativeTo(this);
dError.setVisible(true);
}
}
Aggregations