Search in sources :

Example 1 with CertificateManager

use of com.intellij.util.net.ssl.CertificateManager in project intellij-community by JetBrains.

the class ShowCertificateInfoAction method actionPerformed.

@Override
public void actionPerformed(final AnActionEvent e) {
    try {
        CertificateManager manager = CertificateManager.getInstance();
        List<X509Certificate> certificates = manager.getCustomTrustManager().getCertificates();
        if (certificates.isEmpty()) {
            Messages.showInfoMessage(String.format("Key store '%s' is empty", manager.getCacertsPath()), "No Certificates Available");
        } else {
            CertificateWarningDialog dialog = CertificateWarningDialog.createUntrustedCertificateWarning(certificates.get(0));
            LOG.debug("Accepted: " + dialog.showAndGet());
        }
    } catch (Exception logged) {
        LOG.error(logged);
    }
}
Also used : CertificateManager(com.intellij.util.net.ssl.CertificateManager) X509Certificate(java.security.cert.X509Certificate) CertificateWarningDialog(com.intellij.util.net.ssl.CertificateWarningDialog)

Aggregations

CertificateManager (com.intellij.util.net.ssl.CertificateManager)1 CertificateWarningDialog (com.intellij.util.net.ssl.CertificateWarningDialog)1 X509Certificate (java.security.cert.X509Certificate)1