use of org.kse.gui.error.DError in project keystore-explorer by kaikramer.
the class CreateApplicationGui method run.
/**
* Create and show KeyStore Explorer.
*/
@Override
public void run() {
try {
if (!checkJreVersion()) {
System.exit(1);
}
initLookAndFeel(applicationSettings);
// try to remove crypto restrictions
JcePolicyUtil.removeRestrictions();
// if crypto strength still limited, start upgrade assistant
if (JcePolicyUtil.isLocalPolicyCrytoStrengthLimited()) {
upgradeCryptoStrength();
}
final KseFrame kseFrame = new KseFrame();
// workaround to a bug in initializing JEditorPane that seems to be a 1-in-10000 problem
if (Thread.currentThread().getContextClassLoader() == null) {
Thread.currentThread().setContextClassLoader(ClassLoader.getSystemClassLoader());
}
if (OperatingSystem.isMacOs()) {
integrateWithMacOs(kseFrame);
}
kseFrame.display();
// check if stored location of cacerts file still exists
checkCaCerts(kseFrame);
// open file list passed via command line params (basically same as if files were dropped on application)
DroppedFileHandler.openFiles(kseFrame, parameterFiles);
// start update check in background (disabled if KSE was packaged as rpm)
if (!Boolean.getBoolean(KseFrame.KSE_UPDATE_CHECK_DISABLED)) {
checkForUpdates(kseFrame);
}
} catch (Throwable t) {
DError dError = new DError(new JFrame(), t);
dError.setLocationRelativeTo(null);
dError.setVisible(true);
System.exit(1);
} finally {
closeSplash();
}
}
use of org.kse.gui.error.DError in project keystore-explorer by kaikramer.
the class JKeyIdentifier method editKeyIdentifier.
private void editKeyIdentifier() {
Container container = getTopLevelAncestor();
try {
DKeyIdentifierChooser dKeyIdentifierChooser = null;
if (container instanceof JDialog) {
dKeyIdentifierChooser = new DKeyIdentifierChooser((JDialog) container, title, publicKey, keyIdentifier);
dKeyIdentifierChooser.setLocationRelativeTo(container);
dKeyIdentifierChooser.setVisible(true);
} else if (container instanceof JFrame) {
dKeyIdentifierChooser = new DKeyIdentifierChooser((JFrame) container, title, publicKey, keyIdentifier);
dKeyIdentifierChooser.setLocationRelativeTo(container);
dKeyIdentifierChooser.setVisible(true);
}
byte[] newKeyIdentifier = dKeyIdentifierChooser.getKeyIdentifier();
if (newKeyIdentifier == null) {
return;
}
setKeyIdentifier(newKeyIdentifier);
} catch (CryptoException ex) {
DError dError = null;
if (container instanceof JDialog) {
dError = new DError((JDialog) container, ex);
} else {
dError = new DError((JFrame) container, ex);
}
dError.setLocationRelativeTo(container);
dError.setVisible(true);
}
}
use of org.kse.gui.error.DError 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);
}
}
use of org.kse.gui.error.DError in project keystore-explorer by kaikramer.
the class DViewCertificate method pemEncodingPressed.
private void pemEncodingPressed() {
X509Certificate cert = getSelectedCertificate();
try {
DViewPem dViewCertPem = new DViewPem(this, res.getString("DViewCertificate.Pem.Title"), cert);
dViewCertPem.setLocationRelativeTo(this);
dViewCertPem.setVisible(true);
} catch (CryptoException ex) {
DError dError = new DError(this, ex);
dError.setLocationRelativeTo(this);
dError.setVisible(true);
}
}
use of org.kse.gui.error.DError in project keystore-explorer by kaikramer.
the class DAddExtensions method editSelectedExtension.
private void editSelectedExtension() {
try {
int selectedRow = jtExtensions.getSelectedRow();
if (selectedRow != -1) {
String oid = ((ASN1ObjectIdentifier) jtExtensions.getValueAt(selectedRow, 2)).getId();
X509ExtensionType extensionType = X509ExtensionType.resolveOid(oid);
byte[] extensionValue = extensions.getExtensionValue(oid);
boolean isCritical = extensions.getCriticalExtensionOIDs().contains(oid);
byte[] newExtensionValue = null;
DExtension dExtension = null;
switch(extensionType) {
case AUTHORITY_INFORMATION_ACCESS:
{
dExtension = new DAuthorityInformationAccess(this, extensionValue);
break;
}
case AUTHORITY_KEY_IDENTIFIER:
{
dExtension = new DAuthorityKeyIdentifier(this, extensionValue, authorityPublicKey);
break;
}
case BASIC_CONSTRAINTS:
{
dExtension = new DBasicConstraints(this, extensionValue);
break;
}
case CERTIFICATE_POLICIES:
{
dExtension = new DCertificatePolicies(this, extensionValue);
break;
}
case EXTENDED_KEY_USAGE:
{
dExtension = new DExtendedKeyUsage(this, extensionValue);
break;
}
case INHIBIT_ANY_POLICY:
{
dExtension = new DInhibitAnyPolicy(this, extensionValue);
break;
}
case ISSUER_ALTERNATIVE_NAME:
{
dExtension = new DIssuerAlternativeName(this, extensionValue);
break;
}
case KEY_USAGE:
{
dExtension = new DKeyUsage(this, extensionValue);
break;
}
case NAME_CONSTRAINTS:
{
dExtension = new DNameConstraints(this, extensionValue);
break;
}
case NETSCAPE_BASE_URL:
{
dExtension = new DNetscapeBaseUrl(this, extensionValue);
break;
}
case NETSCAPE_CERTIFICATE_RENEWAL_URL:
{
dExtension = new DNetscapeCertificateRenewalUrl(this, extensionValue);
break;
}
case NETSCAPE_CA_POLICY_URL:
{
dExtension = new DNetscapeCaPolicyUrl(this, extensionValue);
break;
}
case NETSCAPE_CA_REVOCATION_URL:
{
dExtension = new DNetscapeCaRevocationUrl(this, extensionValue);
break;
}
case NETSCAPE_CERTIFICATE_TYPE:
{
dExtension = new DNetscapeCertificateType(this, extensionValue);
break;
}
case NETSCAPE_COMMENT:
{
dExtension = new DNetscapeComment(this, extensionValue);
break;
}
case NETSCAPE_REVOCATION_URL:
{
dExtension = new DNetscapeRevocationUrl(this, extensionValue);
break;
}
case NETSCAPE_SSL_SERVER_NAME:
{
dExtension = new DNetscapeSslServerName(this, extensionValue);
break;
}
case POLICY_CONSTRAINTS:
{
dExtension = new DPolicyConstraints(this, extensionValue);
break;
}
case POLICY_MAPPINGS:
{
dExtension = new DPolicyMappings(this, extensionValue);
break;
}
case PRIVATE_KEY_USAGE_PERIOD:
{
dExtension = new DPrivateKeyUsagePeriod(this, extensionValue);
break;
}
case SUBJECT_ALTERNATIVE_NAME:
{
dExtension = new DSubjectAlternativeName(this, extensionValue);
break;
}
case SUBJECT_INFORMATION_ACCESS:
{
dExtension = new DSubjectInformationAccess(this, extensionValue);
break;
}
case SUBJECT_KEY_IDENTIFIER:
{
dExtension = new DSubjectKeyIdentifier(this, extensionValue, subjectPublicKey);
break;
}
default:
{
return;
}
}
dExtension.setLocationRelativeTo(this);
dExtension.setVisible(true);
newExtensionValue = dExtension.getValue();
if (newExtensionValue == null) {
return;
}
extensions.addExtension(oid, isCritical, newExtensionValue);
reloadExtensionsTable();
selectExtensionInTable(oid);
updateButtonControls();
}
} catch (IOException ex) {
DError dError = new DError(this, ex);
dError.setLocationRelativeTo(this);
dError.setVisible(true);
}
}
Aggregations