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();
}
});
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
Aggregations