Search in sources :

Example 41 with DError

use of org.kse.gui.error.DError in project keystore-explorer by kaikramer.

the class DNetscapeSslServerName method okPressed.

private void okPressed() {
    String netscapeSslServerNameStr = jtfNetscapeSslServerName.getText().trim();
    if (netscapeSslServerNameStr.length() == 0) {
        JOptionPane.showMessageDialog(this, res.getString("DNetscapeSslServerName.ValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
        return;
    }
    DERIA5String netscapeSslServerName = new DERIA5String(netscapeSslServerNameStr);
    try {
        value = netscapeSslServerName.getEncoded(ASN1Encoding.DER);
    } catch (IOException ex) {
        DError dError = new DError(this, ex);
        dError.setLocationRelativeTo(this);
        dError.setVisible(true);
        return;
    }
    closeDialog();
}
Also used : DERIA5String(org.bouncycastle.asn1.DERIA5String) DERIA5String(org.bouncycastle.asn1.DERIA5String) IOException(java.io.IOException) DError(org.kse.gui.error.DError)

Example 42 with DError

use of org.kse.gui.error.DError in project keystore-explorer by kaikramer.

the class DPolicyMappings method okPressed.

private void okPressed() {
    PolicyMappings policyMappings = jpmPolicyMappings.getPolicyMappings();
    ASN1Sequence policyMappingsSeq = (ASN1Sequence) policyMappings.toASN1Primitive();
    if (policyMappingsSeq.size() == 0) {
        JOptionPane.showMessageDialog(this, res.getString("DPolicyMappings.ValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
        return;
    }
    try {
        value = policyMappings.getEncoded(ASN1Encoding.DER);
    } catch (IOException ex) {
        DError dError = new DError(this, ex);
        dError.setLocationRelativeTo(this);
        dError.setVisible(true);
        return;
    }
    closeDialog();
}
Also used : ASN1Sequence(org.bouncycastle.asn1.ASN1Sequence) JPolicyMappings(org.kse.gui.crypto.policymapping.JPolicyMappings) PolicyMappings(org.bouncycastle.asn1.x509.PolicyMappings) IOException(java.io.IOException) DError(org.kse.gui.error.DError)

Example 43 with DError

use of org.kse.gui.error.DError in project keystore-explorer by kaikramer.

the class DSubjectInformationAccess method okPressed.

private void okPressed() {
    List<AccessDescription> accessDescriptions = jadAccessDescriptions.getAccessDescriptions();
    if (accessDescriptions.size() == 0) {
        JOptionPane.showMessageDialog(this, res.getString("DSubjectInformationAccess.ValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
        return;
    }
    SubjectInfoAccess subjectInformationAccess = new SubjectInfoAccess(accessDescriptions);
    try {
        value = subjectInformationAccess.getEncoded(ASN1Encoding.DER);
    } catch (IOException ex) {
        DError dError = new DError(this, ex);
        dError.setLocationRelativeTo(this);
        dError.setVisible(true);
        return;
    }
    closeDialog();
}
Also used : AccessDescription(org.bouncycastle.asn1.x509.AccessDescription) SubjectInfoAccess(org.kse.crypto.x509.SubjectInfoAccess) IOException(java.io.IOException) DError(org.kse.gui.error.DError)

Example 44 with DError

use of org.kse.gui.error.DError in project keystore-explorer by kaikramer.

the class DSubjectKeyIdentifier method okPressed.

private void okPressed() {
    byte[] keyIdentifier = jkiKeyIdentifier.getKeyIdentifier();
    if (keyIdentifier == null) {
        JOptionPane.showMessageDialog(this, res.getString("DSubjectKeyIdentifier.ValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
        return;
    }
    SubjectKeyIdentifier subjectKeyIdentifier = new SubjectKeyIdentifier(keyIdentifier);
    try {
        value = subjectKeyIdentifier.getEncoded(ASN1Encoding.DER);
    } catch (IOException ex) {
        DError dError = new DError(this, ex);
        dError.setLocationRelativeTo(this);
        dError.setVisible(true);
        return;
    }
    closeDialog();
}
Also used : SubjectKeyIdentifier(org.bouncycastle.asn1.x509.SubjectKeyIdentifier) IOException(java.io.IOException) DError(org.kse.gui.error.DError)

Example 45 with DError

use of org.kse.gui.error.DError in project keystore-explorer by kaikramer.

the class DViewExtensions method updateExtensionValue.

private void updateExtensionValue() {
    int selectedRow = jtExtensions.getSelectedRow();
    if (selectedRow == -1) {
        jepExtensionValue.setText("");
        jbAsn1.setEnabled(false);
    } else {
        String oid = ((ASN1ObjectIdentifier) jtExtensions.getValueAt(selectedRow, 2)).getId();
        byte[] value = extensions.getExtensionValue(oid);
        boolean criticality = (Boolean) jtExtensions.getValueAt(selectedRow, 0);
        X509Ext ext = new X509Ext(oid, value, criticality);
        try {
            jepExtensionValue.setText("<html><body>" + ext.getStringValue().replace(X509Ext.INDENT.getIndentChar().toString(), "&nbsp;").replace(X509Ext.NEWLINE, "<br/>") + "</body></html>");
        } catch (Exception ex) {
            jepExtensionValue.setText("");
            DError dError = new DError(this, ex);
            dError.setLocationRelativeTo(this);
            dError.setVisible(true);
        }
        jepExtensionValue.setCaretPosition(0);
        jbAsn1.setEnabled(true);
    }
}
Also used : ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier) CryptoException(org.kse.crypto.CryptoException) Asn1Exception(org.kse.utilities.asn1.Asn1Exception) IOException(java.io.IOException) X509Ext(org.kse.crypto.x509.X509Ext) DError(org.kse.gui.error.DError)

Aggregations

DError (org.kse.gui.error.DError)52 IOException (java.io.IOException)38 CryptoException (org.kse.crypto.CryptoException)11 DERIA5String (org.bouncycastle.asn1.DERIA5String)9 JFrame (javax.swing.JFrame)8 ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)8 Asn1Exception (org.kse.utilities.asn1.Asn1Exception)7 Container (java.awt.Container)6 JDialog (javax.swing.JDialog)6 X509Certificate (java.security.cert.X509Certificate)4 ASN1EncodableVector (org.bouncycastle.asn1.ASN1EncodableVector)4 DERSequence (org.bouncycastle.asn1.DERSequence)4 GeneralNames (org.bouncycastle.asn1.x509.GeneralNames)4 PolicyInformation (org.bouncycastle.asn1.x509.PolicyInformation)4 PolicyQualifierInfo (org.bouncycastle.asn1.x509.PolicyQualifierInfo)4 JGeneralNames (org.kse.gui.crypto.generalname.JGeneralNames)4 Point (java.awt.Point)3 BigInteger (java.math.BigInteger)3 Date (java.util.Date)3 ArrayList (java.util.ArrayList)2