Search in sources :

Example 21 with Asn1Exception

use of org.kse.utilities.asn1.Asn1Exception in project keystore-explorer by kaikramer.

the class DViewAsn1Dump method initComponents.

private void initComponents() throws Asn1Exception, IOException {
    jbCopy = new JButton(res.getString("DViewAsn1Dump.jbCopy.text"));
    PlatformUtil.setMnemonic(jbCopy, res.getString("DViewAsn1Dump.jbCopy.mnemonic").charAt(0));
    jbCopy.setToolTipText(res.getString("DViewAsn1Dump.jbCopy.tooltip"));
    jbCopy.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DViewAsn1Dump.this);
                copyPressed();
            } finally {
                CursorUtil.setCursorFree(DViewAsn1Dump.this);
            }
        }
    });
    jbOK = new JButton(res.getString("DViewAsn1Dump.jbOK.text"));
    jbOK.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            okPressed();
        }
    });
    jpButtons = PlatformUtil.createDialogButtonPanel(jbOK, null, jbCopy, true);
    jpAsn1Dump = new JPanel(new BorderLayout());
    jpAsn1Dump.setBorder(new EmptyBorder(5, 5, 5, 5));
    Asn1Dump asn1Dump = new Asn1Dump();
    if (certificate != null) {
        jtaAsn1Dump = new JTextArea(asn1Dump.dump(certificate));
    } else if (crl != null) {
        jtaAsn1Dump = new JTextArea(asn1Dump.dump(crl));
    } else if (extension != null) {
        jtaAsn1Dump = new JTextArea(asn1Dump.dump(extension));
    } else if (privateKey != null) {
        jtaAsn1Dump = new JTextArea(asn1Dump.dump(privateKey));
    } else if (publicKey != null) {
        jtaAsn1Dump = new JTextArea(asn1Dump.dump(publicKey));
    } else if (pkcs10Csr != null) {
        jtaAsn1Dump = new JTextArea(asn1Dump.dump(pkcs10Csr.getEncoded()));
    } else {
        jtaAsn1Dump = new JTextArea(asn1Dump.dump(spkac.getEncoded()));
    }
    jtaAsn1Dump.setCaretPosition(0);
    jtaAsn1Dump.setEditable(false);
    jtaAsn1Dump.setFont(new Font(Font.MONOSPACED, Font.PLAIN, LnfUtil.getDefaultFontSize()));
    // JGoodies - keep uneditable color same as editable
    jtaAsn1Dump.putClientProperty("JTextArea.infoBackground", Boolean.TRUE);
    jspAsn1Dump = PlatformUtil.createScrollPane(jtaAsn1Dump, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    jspAsn1Dump.setPreferredSize(new Dimension(500, 300));
    jpAsn1Dump.add(jspAsn1Dump, BorderLayout.CENTER);
    getContentPane().add(jpAsn1Dump, BorderLayout.CENTER);
    getContentPane().add(jpButtons, BorderLayout.SOUTH);
    setResizable(true);
    addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent evt) {
            closeDialog();
        }
    });
    getRootPane().setDefaultButton(jbOK);
    pack();
    SwingUtilities.invokeLater(new Runnable() {

        @Override
        public void run() {
            jbOK.requestFocus();
        }
    });
}
Also used : JPanel(javax.swing.JPanel) JTextArea(javax.swing.JTextArea) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) Asn1Dump(org.kse.utilities.asn1.Asn1Dump) WindowAdapter(java.awt.event.WindowAdapter) Dimension(java.awt.Dimension) Font(java.awt.Font) ActionListener(java.awt.event.ActionListener) BorderLayout(java.awt.BorderLayout) WindowEvent(java.awt.event.WindowEvent) EmptyBorder(javax.swing.border.EmptyBorder)

Example 22 with Asn1Exception

use of org.kse.utilities.asn1.Asn1Exception in project keystore-explorer by kaikramer.

the class DViewCrl method asn1DumpPressed.

private void asn1DumpPressed() {
    try {
        DViewAsn1Dump dViewAsn1Dump = new DViewAsn1Dump(this, crl);
        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);
    }
}
Also used : IOException(java.io.IOException) Asn1Exception(org.kse.utilities.asn1.Asn1Exception) DError(org.kse.gui.error.DError)

Example 23 with Asn1Exception

use of org.kse.utilities.asn1.Asn1Exception in project keystore-explorer by kaikramer.

the class DViewCsr method asn1DumpPressed.

private void asn1DumpPressed() {
    try {
        DViewAsn1Dump dViewAsn1Dump;
        if (pkcs10Csr != null) {
            dViewAsn1Dump = new DViewAsn1Dump(this, pkcs10Csr);
        } else {
            dViewAsn1Dump = new DViewAsn1Dump(this, spkacCsr);
        }
        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);
    }
}
Also used : IOException(java.io.IOException) Asn1Exception(org.kse.utilities.asn1.Asn1Exception) DError(org.kse.gui.error.DError)

Example 24 with Asn1Exception

use of org.kse.utilities.asn1.Asn1Exception in project keystore-explorer by kaikramer.

the class DViewPrivateKey method asn1DumpPressed.

private void asn1DumpPressed() {
    try {
        DViewAsn1Dump dViewAsn1Dump = new DViewAsn1Dump(this, privateKey);
        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);
    }
}
Also used : IOException(java.io.IOException) Asn1Exception(org.kse.utilities.asn1.Asn1Exception) DError(org.kse.gui.error.DError)

Example 25 with Asn1Exception

use of org.kse.utilities.asn1.Asn1Exception 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);
    }
}
Also used : DViewAsn1Dump(org.kse.gui.dialogs.DViewAsn1Dump) IOException(java.io.IOException) Asn1Exception(org.kse.utilities.asn1.Asn1Exception) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier) X509Ext(org.kse.crypto.x509.X509Ext) DError(org.kse.gui.error.DError)

Aggregations

IOException (java.io.IOException)12 Asn1Exception (es.gob.jmulticard.asn1.Asn1Exception)10 Asn1Exception (sun.security.krb5.Asn1Exception)9 TlvException (es.gob.jmulticard.asn1.TlvException)8 DError (org.kse.gui.error.DError)6 Asn1Exception (org.kse.utilities.asn1.Asn1Exception)6 DecoderObject (es.gob.jmulticard.asn1.DecoderObject)4 Tlv (es.gob.jmulticard.asn1.Tlv)4 X509Certificate (java.security.cert.X509Certificate)4 ASN1Exception (codec.asn1.ASN1Exception)3 PFX (codec.pkcs12.PFX)3 ApduConnectionException (es.gob.jmulticard.apdu.connection.ApduConnectionException)3 InvalidCardException (es.gob.jmulticard.card.InvalidCardException)3 FileNotFoundException (es.gob.jmulticard.card.iso7816four.FileNotFoundException)3 Iso7816FourCardException (es.gob.jmulticard.card.iso7816four.Iso7816FourCardException)3 BigInteger (java.math.BigInteger)3 Cdf (es.gob.jmulticard.asn1.der.pkcs15.Cdf)2 Odf (es.gob.jmulticard.asn1.der.pkcs15.Odf)2 Path (es.gob.jmulticard.asn1.der.pkcs15.Path)2 AuthenticationModeLockedException (es.gob.jmulticard.card.AuthenticationModeLockedException)2