Search in sources :

Example 1 with DViewCrl

use of org.kse.gui.dialogs.DViewCrl in project keystore-explorer by kaikramer.

the class DViewExtensions method hyperlinkUpdate.

@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        try {
            URL url = e.getURL();
            if (url != null) {
                if (url.getPath().endsWith(".cer") || url.getPath().endsWith(".crt")) {
                    X509Certificate[] certs = downloadCert(url);
                    if (certs != null && certs.length > 0) {
                        DViewCertificate dViewCertificate = new DViewCertificate(this, MessageFormat.format(res.getString("DViewExtensions.ViewCert.Title"), url.toString()), certs, null, DViewCertificate.NONE);
                        dViewCertificate.setLocationRelativeTo(this);
                        dViewCertificate.setVisible(true);
                    }
                } else if (url.getPath().endsWith(".crl")) {
                    X509CRL crl = downloadCrl(url);
                    if (crl != null) {
                        DViewCrl dViewCrl = new DViewCrl(this, MessageFormat.format(res.getString("DViewExtensions.ViewCrl.Title"), url.toString()), ModalityType.DOCUMENT_MODAL, crl);
                        dViewCrl.setLocationRelativeTo(this);
                        dViewCrl.setVisible(true);
                    }
                } else {
                    Desktop.getDesktop().browse(url.toURI());
                }
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}
Also used : X509CRL(java.security.cert.X509CRL) DViewCertificate(org.kse.gui.dialogs.DViewCertificate) URL(java.net.URL) X509Certificate(java.security.cert.X509Certificate) CryptoException(org.kse.crypto.CryptoException) Asn1Exception(org.kse.utilities.asn1.Asn1Exception) IOException(java.io.IOException) DViewCrl(org.kse.gui.dialogs.DViewCrl)

Example 2 with DViewCrl

use of org.kse.gui.dialogs.DViewCrl in project keystore-explorer by kaikramer.

the class ExamineClipboardAction method showCrl.

private void showCrl(InputStream is) {
    if (is == null) {
        return;
    }
    X509CRL crl = null;
    try {
        crl = X509CertUtil.loadCRL(is);
    } catch (Exception ex) {
        String problemStr = res.getString("ExamineClipboardAction.NoOpenCrl.Problem");
        String[] causes = new String[] { res.getString("ExamineClipboardAction.NotCrl.Cause"), res.getString("ExamineClipboardAction.CorruptedCrl.Cause") };
        Problem problem = new Problem(problemStr, causes, ex);
        DProblem dProblem = new DProblem(frame, res.getString("ExamineClipboardAction.ProblemOpeningCrl.Title"), problem);
        dProblem.setLocationRelativeTo(frame);
        dProblem.setVisible(true);
    }
    if (crl != null) {
        DViewCrl dViewCrl = new DViewCrl(frame, res.getString("ExamineClipboardAction.CrlDetails.Title"), crl);
        dViewCrl.setLocationRelativeTo(frame);
        dViewCrl.setVisible(true);
    }
}
Also used : X509CRL(java.security.cert.X509CRL) Problem(org.kse.gui.error.Problem) DProblem(org.kse.gui.error.DProblem) CryptoException(org.kse.crypto.CryptoException) UnsupportedFlavorException(java.awt.datatransfer.UnsupportedFlavorException) IOException(java.io.IOException) DProblem(org.kse.gui.error.DProblem) DViewCrl(org.kse.gui.dialogs.DViewCrl)

Example 3 with DViewCrl

use of org.kse.gui.dialogs.DViewCrl in project keystore-explorer by kaikramer.

the class ExamineFileAction method openCrl.

private void openCrl(File crlFile) {
    if (crlFile == null) {
        return;
    }
    X509CRL crl = null;
    try {
        crl = X509CertUtil.loadCRL(new FileInputStream(crlFile));
    } catch (Exception ex) {
        String problemStr = MessageFormat.format(res.getString("ExamineFileAction.NoOpenCrl.Problem"), crlFile.getName());
        String[] causes = new String[] { res.getString("ExamineFileAction.NotCrl.Cause"), res.getString("ExamineFileAction.CorruptedCrl.Cause") };
        Problem problem = new Problem(problemStr, causes, ex);
        DProblem dProblem = new DProblem(frame, res.getString("ExamineFileAction.ProblemOpeningCrl.Title"), problem);
        dProblem.setLocationRelativeTo(frame);
        dProblem.setVisible(true);
    }
    if (crl != null) {
        DViewCrl dViewCrl = new DViewCrl(frame, MessageFormat.format(res.getString("ExamineFileAction.CrlDetailsFile.Title"), crlFile.getName()), crl);
        dViewCrl.setLocationRelativeTo(frame);
        dViewCrl.setVisible(true);
    }
}
Also used : X509CRL(java.security.cert.X509CRL) Problem(org.kse.gui.error.Problem) DProblem(org.kse.gui.error.DProblem) FileInputStream(java.io.FileInputStream) CryptoException(org.kse.crypto.CryptoException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) DProblem(org.kse.gui.error.DProblem) DViewCrl(org.kse.gui.dialogs.DViewCrl)

Aggregations

IOException (java.io.IOException)3 X509CRL (java.security.cert.X509CRL)3 CryptoException (org.kse.crypto.CryptoException)3 DViewCrl (org.kse.gui.dialogs.DViewCrl)3 DProblem (org.kse.gui.error.DProblem)2 Problem (org.kse.gui.error.Problem)2 UnsupportedFlavorException (java.awt.datatransfer.UnsupportedFlavorException)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 URL (java.net.URL)1 X509Certificate (java.security.cert.X509Certificate)1 DViewCertificate (org.kse.gui.dialogs.DViewCertificate)1 Asn1Exception (org.kse.utilities.asn1.Asn1Exception)1