APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.security.provider.certpath

public final Class OCSP

extends Object
Class Inheritance
Imports
java.io.IOException, .OutputStream, java.net.*, java.security.cert.CertificateException, .CertPathValidatorException, .CertPathValidatorException.BasicReason, .CRLReason, .Extension, .X509Certificate, java.util.Base64, .Date, .List, .Map, sun.security.util.Debug, .Event, .IOUtils, .SecurityProperties, sun.security.x509.AccessDescription, .AuthorityInfoAccessExtension, .GeneralName, .GeneralNameInterface, .PKIXExtensions, .URIName, .X509CertImpl

This is a class that checks the revocation status of a certificate(s) using OCSP. It is not a PKIXCertPathChecker and therefore can be used outside the CertPathValidator framework. It is useful when you want to just check the revocation status of a certificate, and you don't want to incur the overhead of validating all the certificates in the associated certificate chain.
Author
Sean Mullan

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
OCSP.RevocationStatus

The Revocation Status of a certificate.

Field Summary

Modifier and TypeField and Description
private static final int
CONNECT_TIMEOUT

Integer value indicating the timeout length, in milliseconds, to be used for establishing a connection to an OCSP responder.

private static final Debug
private static final int
private static final int
READ_TIMEOUT

Integer value indicating the timeout length, in milliseconds, to be used for reading an OCSP response from the responder.

private static final boolean
USE_GET

Boolean value indicating whether OCSP client can use GET for OCSP requests.

Constructor Summary

AccessConstructor and Description
private
OCSP()

Method Summary

Modifier and TypeMethod and Description
pack-priv static OCSPResponse

Returns:

the OCSPResponse
check
(List<CertId>
the CertIds to be checked
certIds
,
URI
the URI of the OCSP responder
responderURI
,
OCSPResponse.IssuerInfo
the issuer's certificate and/or subject and public key
issuerInfo
,
X509Certificate
the OCSP responder's certificate
responderCert
,
Date
the time the validity of the OCSP responder's certificate should be checked against. If null, the current time is used.
date
,
List<Extension>
zero or more OCSP extensions to be included in the request. If no extensions are requested, an empty List must be used. A null value is not allowed.
extensions
,
String variant)

Checks the revocation status of a list of certificates using OCSP.

public static byte[]

Returns:

the OCSP response bytes
getOCSPBytes
(List<CertId>
the CertIds to be checked
certIds
,
URI
the URI of the OCSP responder
responderURI
,
List<Extension>
zero or more OCSP extensions to be included in the request. If no extensions are requested, an empty List must be used. A null value is not allowed.
extensions
)

Send an OCSP request, then read and return the OCSP response bytes.

public static URI

Returns:

the URI of the OCSP Responder, or null if not specified
getResponderURI
(X509Certificate
the certificate
cert
)

Returns the URI of the OCSP Responder as specified in the certificate's Authority Information Access extension, or null if not specified.

pack-priv static URI
private static boolean
initializeBoolean(String prop, boolean def)

private static int
initializeTimeout(String prop, int def)

Initialize the timeout length by getting the OCSP timeout system property.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CONNECT_TIMEOUTback to summary
private static final int CONNECT_TIMEOUT

Integer value indicating the timeout length, in milliseconds, to be used for establishing a connection to an OCSP responder. A timeout of zero is interpreted as an infinite timeout.

debugback to summary
private static final Debug debug
DEFAULT_CONNECT_TIMEOUTback to summary
private static final int DEFAULT_CONNECT_TIMEOUT
READ_TIMEOUTback to summary
private static final int READ_TIMEOUT

Integer value indicating the timeout length, in milliseconds, to be used for reading an OCSP response from the responder. A timeout of zero is interpreted as an infinite timeout.

USE_GETback to summary
private static final boolean USE_GET

Boolean value indicating whether OCSP client can use GET for OCSP requests. There is an ambiguity in RFC recommendations. RFC 5019 says a stronger thing, "MUST": "When sending requests that are less than or equal to 255 bytes in total (after encoding) including the scheme and delimiters (http://), server name and base64-encoded OCSPRequest structure, clients MUST use the GET method (to enable OCSP response caching)." RFC 6960 says a weaker thing, "MAY": "HTTP-based OCSP requests can use either the GET or the POST method to submit their requests. To enable HTTP caching, small requests (that after encoding are less than 255 bytes) MAY be submitted using GET." For performance reasons, we default to stronger behavior. But this option also allows to fallback to weaker behavior in case of compatibility problems.

Constructor Detail

OCSPback to summary
private OCSP()

Method Detail

checkback to summary
pack-priv static OCSPResponse check(List<CertId> certIds, URI responderURI, OCSPResponse.IssuerInfo issuerInfo, X509Certificate responderCert, Date date, List<Extension> extensions, String variant) throws IOException, CertPathValidatorException

Checks the revocation status of a list of certificates using OCSP.

Parameters
certIds:List<CertId>

the CertIds to be checked

responderURI:URI

the URI of the OCSP responder

issuerInfo:OCSPResponse.IssuerInfo

the issuer's certificate and/or subject and public key

responderCert:X509Certificate

the OCSP responder's certificate

date:Date

the time the validity of the OCSP responder's certificate should be checked against. If null, the current time is used.

extensions:List<Extension>

zero or more OCSP extensions to be included in the request. If no extensions are requested, an empty List must be used. A null value is not allowed.

Returns:OCSPResponse

the OCSPResponse

Exceptions
IOException:
if there is an exception connecting to or communicating with the OCSP responder
CertPathValidatorException:
if an exception occurs while encoding the OCSP Request or validating the OCSP Response
getOCSPBytesback to summary
public static byte[] getOCSPBytes(List<CertId> certIds, URI responderURI, List<Extension> extensions) throws IOException

Send an OCSP request, then read and return the OCSP response bytes.

Parameters
certIds:List<CertId>

the CertIds to be checked

responderURI:URI

the URI of the OCSP responder

extensions:List<Extension>

zero or more OCSP extensions to be included in the request. If no extensions are requested, an empty List must be used. A null value is not allowed.

Returns:byte[]

the OCSP response bytes

Exceptions
IOException:
if there is an exception connecting to or communicating with the OCSP responder
getResponderURIback to summary
public static URI getResponderURI(X509Certificate cert)

Returns the URI of the OCSP Responder as specified in the certificate's Authority Information Access extension, or null if not specified.

Parameters
cert:X509Certificate

the certificate

Returns:URI

the URI of the OCSP Responder, or null if not specified

getResponderURIback to summary
pack-priv static URI getResponderURI(X509CertImpl certImpl)
initializeBooleanback to summary
private static boolean initializeBoolean(String prop, boolean def)
initializeTimeoutback to summary
private static int initializeTimeout(String prop, int def)

Initialize the timeout length by getting the OCSP timeout system property. If the property has not been set, or if its value is negative, set the timeout length to the default.

sun.security.provider.certpath back to summary

public Interface OCSP.RevocationStatus

Known Direct Implementers
sun.security.provider.certpath.OCSPResponse.SingleResponse

The Revocation Status of a certificate.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Method Summary

Modifier and TypeMethod and Description
public OCSP.RevocationStatus.CertStatus
getCertStatus()

Returns the revocation status.

public CRLReason
getRevocationReason()

Returns the reason the certificate was revoked, or null if it has not been revoked.

public Date
getRevocationTime()

Returns the time when the certificate was revoked, or null if it has not been revoked.

public Map<String, Extension>
getSingleExtensions()

Returns a Map of additional extensions.

Method Detail

getCertStatusback to summary
public OCSP.RevocationStatus.CertStatus getCertStatus()

Returns the revocation status.

getRevocationReasonback to summary
public CRLReason getRevocationReason()

Returns the reason the certificate was revoked, or null if it has not been revoked.

getRevocationTimeback to summary
public Date getRevocationTime()

Returns the time when the certificate was revoked, or null if it has not been revoked.

getSingleExtensionsback to summary
public Map<String, Extension> getSingleExtensions()

Returns a Map of additional extensions.

sun.security.provider.certpath back to summary

public final Enum OCSP.RevocationStatus.CertStatus

extends Enum<OCSP.RevocationStatus.CertStatus>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final OCSP.RevocationStatus.CertStatus
public static final OCSP.RevocationStatus.CertStatus
public static final OCSP.RevocationStatus.CertStatus

Constructor Summary

AccessConstructor and Description
private

Field Detail

GOODback to summary
public static final OCSP.RevocationStatus.CertStatus GOOD
REVOKEDback to summary
public static final OCSP.RevocationStatus.CertStatus REVOKED
UNKNOWNback to summary
public static final OCSP.RevocationStatus.CertStatus UNKNOWN

Constructor Detail

CertStatusback to summary
private CertStatus()

Method Detail

valueOfback to summary
public static OCSP.RevocationStatus.CertStatus valueOf(String name)
valuesback to summary
public static OCSP.RevocationStatus.CertStatus[] values()