mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Simplify check, that certificates chain is self-signed
This commit is contained in:
@@ -83,6 +83,7 @@ public class CertificatesManager implements ApplicationComponent {
|
||||
// Don't do this: protocol created this way will ignore SSL tunnels. See IDEA-115708.
|
||||
// Protocol.registerProtocol("https", CertificatesManager.createDefault().createProtocol());
|
||||
SSLContext.setDefault(getSslContext());
|
||||
LOG.debug("Default SSL context initialized");
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error(e);
|
||||
@@ -194,7 +195,7 @@ public class CertificatesManager implements ApplicationComponent {
|
||||
catch (CertificateException e1) {
|
||||
X509Certificate certificate = certificates[0];
|
||||
// looks like self-signed certificate
|
||||
if (certificates.length == 1 && certificateIsSelfSigned(certificate)) {
|
||||
if (certificates.length == 1) {
|
||||
// check-then-act sequence
|
||||
synchronized (myCustomManager) {
|
||||
try {
|
||||
@@ -395,8 +396,4 @@ public class CertificatesManager implements ApplicationComponent {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static boolean certificateIsSelfSigned(X509Certificate certificate) {
|
||||
return certificate.getIssuerX500Principal().equals(certificate.getSubjectX500Principal());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user