Java SSL certificate revocation check

There is two common way to check TLS certificate revocation status:

  • Certificate Revocation List (CRL)
  • Online Certificate Status Protocol (OCSP)

The second option is more faster and modern way to do that. The OCSP link must be presented some way to do that. There are at least two options:

  • Your Certificate Authority (CA) automatically puts that OCSP link into your certificate
  • You go to the guys in your CA and asks them for the OCSP link.

There is how you can check if your SSL certificate contains OCSP link:

  • Your cert must contain Authority Information Access (AIA) extension
Authority Information Access (AIA) section of TLS certificate
  • If you don’t see OCSP link in first point, you must scroll down information into this section to the second point
OCSP link into AIA section of TLS certificate

If you certificate contains OCSP link

  1. Add flag when you run your jar
  2. Set Security property from inside your code:"ocsp.enable", "true")

After you perform this, every time Java sees new TLS connection, it is going to OCSP CA server through the link from AIA section of TLS certificate, check the revocation status, and reject the connection if certificate was revoked.

If your certificate does not contain OCSP link

  1. Add flag when you run your jar
  2. Set Security property from inside your code:"ocsp.enable", "true")
  3. Go to the guys from your CA and asks them for OCSP link
  4. Set one more Security property inside your code: Security.setProperty("ocsp.responderURL", url)

P.S.: there might be one case, when OCSP server itself has specific SSL cert. If so, you need to set other Security properties manually:

  • Security.setProperty("ocsp.responderCertSubjectName", certSubjectName)
  • Security.setProperty("ocsp.responderCertIssuerName", certIssuerName)
  • Security.setProperty("ocsp.responderCertSerialNumber", certSerialNumber)

Technical details

If you interested in how this works under the JVM hood, you might want to see this classes:, class declaration is: public abstract class PKIXRevocationChecker extends PKIXCertPathChecker, class declaration is: class RevocationChecker extends PKIXRevocationChecker

You can navigate into class just by pasting this line into IntelliJ IDEA and clicking on the class name with CTL+left click ignoring error (red glow).

You can see, how RevocationChecker class reads Security properties in method:

private static RevocationProperties getRevocationProperties() {
    rp.ocspEnabled = ocspEnabled != null
                     && ocspEnabled.equalsIgnoreCase("true");
    rp.ocspUrl = Security.getProperty("ocsp.responderURL");
        = Security.getProperty("ocsp.responderCertSubjectName");
        = Security.getProperty("ocsp.responderCertIssuerName");
        = Security.getProperty("ocsp.responderCertSerialNumber");
        = Boolean.getBoolean("");

Useful links

If you still have any questions, feel free to ask me in the comments under this article, or write me on

Leave a Reply

Your email address will not be published. Required fields are marked *