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