use of org.kse.gui.dialogs.DNewKeyStoreType in project keystore-explorer by kaikramer.
the class OpenCaCertificatesAction method doAction.
/**
* Do action.
*/
@Override
protected void doAction() {
File caCertificatesFile = applicationSettings.getCaCertificatesFile();
if (caCertificatesFile.isFile()) {
openKeyStore(caCertificatesFile, AuthorityCertificates.CACERTS_DEFAULT_PWD);
return;
}
int selected = JOptionPane.showConfirmDialog(frame, res.getString("OpenCaCertificatesAction.NoCaCertificatesKeyStoreCreate.message"), res.getString("OpenCaCertificatesAction.OpenCaCertificatesKeyStore.Title"), JOptionPane.YES_NO_OPTION);
if (selected != JOptionPane.YES_OPTION) {
return;
}
try {
DNewKeyStoreType dNewKeyStoreType = new DNewKeyStoreType(frame);
dNewKeyStoreType.setLocationRelativeTo(frame);
dNewKeyStoreType.setVisible(true);
KeyStoreType keyStoreType = dNewKeyStoreType.getKeyStoreType();
if (keyStoreType == null) {
return;
}
Password password = getNewKeyStorePassword();
if (password == null) {
return;
}
KeyStore caCertificatesKeyStore = KeyStoreUtil.create(keyStoreType);
KeyStoreUtil.save(caCertificatesKeyStore, caCertificatesFile, password);
kseFrame.addKeyStore(caCertificatesKeyStore, caCertificatesFile, password);
} catch (Exception ex) {
DError.displayError(frame, ex);
}
}
use of org.kse.gui.dialogs.DNewKeyStoreType in project keystore-explorer by kaikramer.
the class OpenDefaultAction method doAction.
/**
* Do action.
*/
@Override
protected void doAction() {
File defaultKeyStoreFile = new File(System.getProperty("user.home"), ".keystore");
if (defaultKeyStoreFile.isFile()) {
openKeyStore(defaultKeyStoreFile);
return;
}
int selected = JOptionPane.showConfirmDialog(frame, res.getString("OpenDefaultAction.NoDefaultKeyStoreCreate.message"), res.getString("OpenDefaultAction.OpenDefaultKeyStore.Title"), JOptionPane.YES_NO_OPTION);
if (selected != JOptionPane.YES_OPTION) {
return;
}
try {
DNewKeyStoreType dNewKeyStoreType = new DNewKeyStoreType(frame);
dNewKeyStoreType.setLocationRelativeTo(frame);
dNewKeyStoreType.setVisible(true);
KeyStoreType keyStoreType = dNewKeyStoreType.getKeyStoreType();
if (keyStoreType == null) {
return;
}
Password password = getNewKeyStorePassword();
if (password == null) {
return;
}
KeyStore defaultKeyStore = KeyStoreUtil.create(keyStoreType);
KeyStoreUtil.save(defaultKeyStore, defaultKeyStoreFile, password);
kseFrame.addKeyStore(defaultKeyStore, defaultKeyStoreFile, password);
} catch (Exception ex) {
DError.displayError(frame, ex);
}
}
use of org.kse.gui.dialogs.DNewKeyStoreType in project keystore-explorer by kaikramer.
the class NewAction method doAction.
/**
* Do action.
*/
@Override
protected void doAction() {
try {
DNewKeyStoreType dNewKeyStoreType = new DNewKeyStoreType(frame);
dNewKeyStoreType.setLocationRelativeTo(frame);
dNewKeyStoreType.setVisible(true);
KeyStoreType keyStoreType = dNewKeyStoreType.getKeyStoreType();
if (keyStoreType == null) {
return;
}
KeyStore newKeyStore = KeyStoreUtil.create(keyStoreType);
untitledCount++;
String untitled = MessageFormat.format(res.getString("NewAction.Untitled"), untitledCount);
kseFrame.addKeyStore(newKeyStore, untitled, null, null);
} catch (Exception ex) {
DError.displayError(frame, ex);
}
}
Aggregations