use of org.kse.gui.error.DError in project keystore-explorer by kaikramer.
the class DViewExtensions method asn1DumpPressed.
private void asn1DumpPressed() {
int selectedRow = jtExtensions.getSelectedRow();
if (selectedRow == -1) {
return;
}
String oid = ((ASN1ObjectIdentifier) jtExtensions.getValueAt(selectedRow, 2)).getId();
byte[] value = extensions.getExtensionValue(oid);
boolean criticality = (Boolean) jtExtensions.getValueAt(selectedRow, 0);
X509Ext extension = new X509Ext(oid, value, criticality);
try {
DViewAsn1Dump dViewAsn1Dump = new DViewAsn1Dump(this, extension);
dViewAsn1Dump.setLocationRelativeTo(this);
dViewAsn1Dump.setVisible(true);
} catch (Asn1Exception ex) {
DError dError = new DError(this, ex);
dError.setLocationRelativeTo(this);
dError.setVisible(true);
} catch (IOException 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 DExtendedKeyUsage method okPressed.
private void okPressed() {
if (!jcbTlsWebServerAuthentication.isSelected() && !jcbTlsWebClientAuthentication.isSelected() && !jcbCodeSigning.isSelected() && !jcbEmailProtection.isSelected() && !jcbIpSecurityEndSystem.isSelected() && !jcbIpSecurityTunnelTermination.isSelected() && !jcbIpSecurityUser.isSelected() && !jcbTimeStamping.isSelected() && !jcbOcspStamping.isSelected() && !jcbDocumentSigning.isSelected() && !jcbAdobePDFSigning.isSelected() && !jcbEncryptedFileSystem.isSelected() && !jcbAnyExtendedKeyUsage.isSelected()) {
JOptionPane.showMessageDialog(this, res.getString("DExtendedKeyUsage.ValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
return;
}
ArrayList<KeyPurposeId> keyPurposeIds = new ArrayList<KeyPurposeId>();
if (jcbTlsWebServerAuthentication.isSelected()) {
keyPurposeIds.add(KeyPurposeId.getInstance(new ASN1ObjectIdentifier(SERVER_AUTH.oid())));
}
if (jcbTlsWebClientAuthentication.isSelected()) {
keyPurposeIds.add(KeyPurposeId.getInstance(new ASN1ObjectIdentifier(CLIENT_AUTH.oid())));
}
if (jcbCodeSigning.isSelected()) {
keyPurposeIds.add(KeyPurposeId.getInstance(new ASN1ObjectIdentifier(CODE_SIGNING.oid())));
}
if (jcbDocumentSigning.isSelected()) {
keyPurposeIds.add(KeyPurposeId.getInstance(new ASN1ObjectIdentifier(DOCUMENT_SIGNING.oid())));
}
if (jcbAdobePDFSigning.isSelected()) {
keyPurposeIds.add(KeyPurposeId.getInstance(new ASN1ObjectIdentifier(ADOBE_PDF_SIGNING.oid())));
}
if (jcbEmailProtection.isSelected()) {
keyPurposeIds.add(KeyPurposeId.getInstance(new ASN1ObjectIdentifier(EMAIL_PROTECTION.oid())));
}
if (jcbEncryptedFileSystem.isSelected()) {
keyPurposeIds.add(KeyPurposeId.getInstance(new ASN1ObjectIdentifier(ENCRYPTED_FILE_SYSTEM.oid())));
}
if (jcbIpSecurityEndSystem.isSelected()) {
keyPurposeIds.add(KeyPurposeId.getInstance(new ASN1ObjectIdentifier(IPSEC_END_SYSTEM.oid())));
}
if (jcbIpSecurityTunnelTermination.isSelected()) {
keyPurposeIds.add(KeyPurposeId.getInstance(new ASN1ObjectIdentifier(IPSEC_TUNNEL.oid())));
}
if (jcbIpSecurityUser.isSelected()) {
keyPurposeIds.add(KeyPurposeId.getInstance(new ASN1ObjectIdentifier(IPSEC_USER.oid())));
}
if (jcbTimeStamping.isSelected()) {
keyPurposeIds.add(KeyPurposeId.getInstance(new ASN1ObjectIdentifier(TIME_STAMPING.oid())));
}
if (jcbOcspStamping.isSelected()) {
keyPurposeIds.add(KeyPurposeId.getInstance(new ASN1ObjectIdentifier(OCSP_SIGNING.oid())));
}
if (jcbSmartcardLogon.isSelected()) {
keyPurposeIds.add(KeyPurposeId.getInstance(new ASN1ObjectIdentifier(SMARTCARD_LOGON.oid())));
}
if (jcbAnyExtendedKeyUsage.isSelected()) {
keyPurposeIds.add(KeyPurposeId.getInstance(new ASN1ObjectIdentifier(ANY_EXTENDED_KEY_USAGE.oid())));
}
ExtendedKeyUsage extendedKeyUsage = new ExtendedKeyUsage(keyPurposeIds.toArray(new KeyPurposeId[keyPurposeIds.size()]));
try {
value = extendedKeyUsage.getEncoded(ASN1Encoding.DER);
} catch (IOException ex) {
DError dError = new DError(this, ex);
dError.setLocationRelativeTo(this);
dError.setVisible(true);
return;
}
closeDialog();
}
use of org.kse.gui.error.DError in project keystore-explorer by kaikramer.
the class DInhibitAnyPolicy method okPressed.
private void okPressed() {
int skipCertificates = -1;
String skipCertificatesStr = jtfSkipCertificates.getText().trim();
if (skipCertificatesStr.length() == 0) {
JOptionPane.showMessageDialog(this, res.getString("DInhibitAnyPolicy.ValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
return;
}
try {
skipCertificates = Integer.parseInt(skipCertificatesStr);
} catch (NumberFormatException ex) {
JOptionPane.showMessageDialog(this, res.getString("DInhibitAnyPolicy.InvalidLengthValue.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
return;
}
if (skipCertificates < 0) {
JOptionPane.showMessageDialog(this, res.getString("DInhibitAnyPolicy.InvalidLengthValue.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
return;
}
InhibitAnyPolicy inhibitAnyPolicy = new InhibitAnyPolicy(skipCertificates);
try {
value = inhibitAnyPolicy.getEncoded(ASN1Encoding.DER);
} catch (IOException ex) {
DError dError = new DError(this, ex);
dError.setLocationRelativeTo(this);
dError.setVisible(true);
return;
}
closeDialog();
}
use of org.kse.gui.error.DError in project keystore-explorer by kaikramer.
the class DIssuerAlternativeName method okPressed.
private void okPressed() {
GeneralNames issuerAlternativeName = jgnAlternativeName.getGeneralNames();
if (issuerAlternativeName.getNames().length == 0) {
JOptionPane.showMessageDialog(this, res.getString("DIssuerAlternativeName.ValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
return;
}
try {
value = issuerAlternativeName.getEncoded(ASN1Encoding.DER);
} catch (IOException ex) {
DError dError = new DError(this, ex);
dError.setLocationRelativeTo(this);
dError.setVisible(true);
return;
}
closeDialog();
}
use of org.kse.gui.error.DError in project keystore-explorer by kaikramer.
the class DKeyUsage method okPressed.
private void okPressed() {
if (!jcbDigitalSignature.isSelected() && !jcbNonRepudiation.isSelected() && !jcbKeyEncipherment.isSelected() && !jcbDataEncipherment.isSelected() && !jcbKeyAgreement.isSelected() && !jcbCertificateSigning.isSelected() && !jcbCrlSign.isSelected() && !jcbEncipherOnly.isSelected() && !jcbDecipherOnly.isSelected()) {
JOptionPane.showMessageDialog(this, res.getString("DKeyUsage.ValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
return;
}
int keyUsageIntValue = 0;
keyUsageIntValue |= jcbDigitalSignature.isSelected() ? KeyUsage.digitalSignature : 0;
keyUsageIntValue |= jcbNonRepudiation.isSelected() ? KeyUsage.nonRepudiation : 0;
keyUsageIntValue |= jcbKeyEncipherment.isSelected() ? KeyUsage.keyEncipherment : 0;
keyUsageIntValue |= jcbDataEncipherment.isSelected() ? KeyUsage.dataEncipherment : 0;
keyUsageIntValue |= jcbKeyAgreement.isSelected() ? KeyUsage.keyAgreement : 0;
keyUsageIntValue |= jcbCertificateSigning.isSelected() ? KeyUsage.keyCertSign : 0;
keyUsageIntValue |= jcbCrlSign.isSelected() ? KeyUsage.cRLSign : 0;
keyUsageIntValue |= jcbEncipherOnly.isSelected() ? KeyUsage.encipherOnly : 0;
keyUsageIntValue |= jcbDecipherOnly.isSelected() ? KeyUsage.decipherOnly : 0;
KeyUsage keyUsage = new KeyUsage(keyUsageIntValue);
try {
value = keyUsage.getEncoded(ASN1Encoding.DER);
} catch (IOException ex) {
DError dError = new DError(this, ex);
dError.setLocationRelativeTo(this);
dError.setVisible(true);
return;
}
closeDialog();
}
Aggregations