title: Enable SSL certificate revocation checking in OpenJDK 11
body: <p>Is there some quick "declarative" way in Java 11, instead of a tedious manual implementation, to enable checking if a certificate is revoked?</p>
  
  <p>I tried to use properties from this answer:
  <a href="https://stackoverflow.com/questions/8506661/check-x509-certificate-revocation-status-in-spring-security-before-authenticatin/8507905#8507905">Check X509 certificate revocation status in Spring-Security before authenticating</a>
  with this dummy revoked certificate: <a href="https://revoked.badssl.com" rel="nofollow noreferrer">https://revoked.badssl.com</a>
  but the code always accepts the certificate. Am I doing something wrong or these properties are no more actual for Java 11? If so, do we have any alternatives?</p>
  
  <p>Below is my code:</p>
  
  <pre><code>public static void validateOnCertificateRevocation(boolean check) {
      if (check) {
          System.setProperty("com.sun.net.ssl.checkRevocation", "true");
          System.setProperty("com.sun.security.enableCRLDP", "true");
  
          Security.setProperty("ocsp.enable", "true");
      }
  
      try {
          new URL("https://revoked.badssl.com").openConnection().connect();
      } catch (IOException e) {
          e.printStackTrace();
      }
  }
  </code></pre>