Class OnlineOCSPSource
java.lang.Object
eu.europa.esig.dss.service.ocsp.OnlineOCSPSource
- All Implemented Interfaces:
Serializable
Online OCSP repository. This implementation will contact the OCSP Responder
to retrieve the OCSP response.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreate an OCSP source The default constructor for OnlineOCSPSource.OnlineOCSPSource(eu.europa.esig.dss.spi.client.http.DataLoader dataLoader) Creates an Online OCSP Source with the providedDataLoaderinstance. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidassertOCSPResponseValid(org.bouncycastle.cert.ocsp.BasicOCSPResp basicOCSPResp, org.bouncycastle.cert.ocsp.SingleResp latestSingleResponse, byte[] expectedNonce) Verifies whether an OCSP response is validprotected byte[]buildOCSPRequest(eu.europa.esig.dss.model.x509.CertificateToken certificateToken, eu.europa.esig.dss.model.x509.CertificateToken issuerToken, byte[] nonce) Builds an OCSP request forcertificateTokenprotected org.bouncycastle.cert.ocsp.BasicOCSPRespexecuteOCSPRequest(String ocspAccessLocation, byte[] request) Executes arequestto the givenocspAccessLocationand returns an OCSP basic response, when applicablegetOCSPAccessURLs(eu.europa.esig.dss.model.x509.CertificateToken certificateToken, List<String> alternativeUrls) Extracts a list of OCSP access URLs to be used in the provided order to retrieve an OCSP responseeu.europa.esig.dss.spi.x509.revocation.ocsp.OCSPTokengetRevocationToken(eu.europa.esig.dss.model.x509.CertificateToken certificateToken, eu.europa.esig.dss.model.x509.CertificateToken issuerCertificateToken) eu.europa.esig.dss.spi.x509.revocation.ocsp.OCSPTokengetRevocationToken(eu.europa.esig.dss.model.x509.CertificateToken certificateToken, eu.europa.esig.dss.model.x509.CertificateToken issuerCertificateToken, List<String> alternativeUrls) voidsetAlertOnInvalidNonce(eu.europa.esig.dss.alert.StatusAlert alertOnInvalidNonce) Sets a behavior when the nonce of the OCSP Response does not match the nonce sent within the request Default : ExceptionOnStatusAlert (throws an exception if nonce does not match)voidsetAlertOnInvalidUpdateTime(eu.europa.esig.dss.alert.StatusAlert alertOnInvalidUpdateTime) Sets a behavior when the current time is out of the range of thisUpdate and nextUpdate fields extracted from the OCSP Response.voidsetAlertOnNonexistentNonce(eu.europa.esig.dss.alert.StatusAlert alertOnNonexistentNonce) Sets a behavior when the obtained OCSP Response does not contain the nonce even that the nonce has been enforced (i.e.voidsetCertIDDigestAlgorithm(eu.europa.esig.dss.enumerations.DigestAlgorithm certIDDigestAlgorithm) This method allows setting of DigestAlgorithm to be used in hash calculation for CertID element in an OCSP request buildingvoidsetDataLoader(eu.europa.esig.dss.spi.client.http.DataLoader dataLoader) Set the DataLoader to use for querying a revocation server.voidsetNextUpdateTolerancePeriod(long nextUpdateTolerancePeriod) Clients MAY allow configuration of a small tolerance period for acceptance of responses after nextUpdate to handle minor clock differences relative to responders and caches.voidsetNonceSource(NonceSource nonceSource) Set the NonceSource to use for querying the OCSP server.
-
Constructor Details
-
OnlineOCSPSource
public OnlineOCSPSource()Create an OCSP source The default constructor for OnlineOCSPSource. The defaultOCSPDataLoaderis set. It is possible to change it with#setDataLoader(dataLoader). -
OnlineOCSPSource
public OnlineOCSPSource(eu.europa.esig.dss.spi.client.http.DataLoader dataLoader) Creates an Online OCSP Source with the providedDataLoaderinstance. It is still possible to change the defined instance with#setDataLoader(dataLoader).- Parameters:
dataLoader-DataLoaderto use
-
-
Method Details
-
setDataLoader
public void setDataLoader(eu.europa.esig.dss.spi.client.http.DataLoader dataLoader) Set the DataLoader to use for querying a revocation server.- Parameters:
dataLoader- the component that allows to retrieve an OCSP response using HTTP.
-
setNonceSource
Set the NonceSource to use for querying the OCSP server.- Parameters:
nonceSource- the component that prevents the replay attack.
-
setCertIDDigestAlgorithm
public void setCertIDDigestAlgorithm(eu.europa.esig.dss.enumerations.DigestAlgorithm certIDDigestAlgorithm) This method allows setting of DigestAlgorithm to be used in hash calculation for CertID element in an OCSP request building- Parameters:
certIDDigestAlgorithm-DigestAlgorithm
-
setAlertOnInvalidNonce
public void setAlertOnInvalidNonce(eu.europa.esig.dss.alert.StatusAlert alertOnInvalidNonce) Sets a behavior when the nonce of the OCSP Response does not match the nonce sent within the request Default : ExceptionOnStatusAlert (throws an exception if nonce does not match)- Parameters:
alertOnInvalidNonce-StatusAlert
-
setAlertOnNonexistentNonce
public void setAlertOnNonexistentNonce(eu.europa.esig.dss.alert.StatusAlert alertOnNonexistentNonce) Sets a behavior when the obtained OCSP Response does not contain the nonce even that the nonce has been enforced (i.e.nonceSourceis specified). Default : LogOnStatusAlert (logs a warning in case the OCSP Response does not contain the nonce)- Parameters:
alertOnNonexistentNonce-StatusAlert
-
setAlertOnInvalidUpdateTime
public void setAlertOnInvalidUpdateTime(eu.europa.esig.dss.alert.StatusAlert alertOnInvalidUpdateTime) Sets a behavior when the current time is out of the range of thisUpdate and nextUpdate fields extracted from the OCSP Response. The check is executed only when nonce is not checked. Default : SilentOnStatusAlert (skips the check validation)- Parameters:
alertOnInvalidUpdateTime-StatusAlert
-
setNextUpdateTolerancePeriod
public void setNextUpdateTolerancePeriod(long nextUpdateTolerancePeriod) Clients MAY allow configuration of a small tolerance period for acceptance of responses after nextUpdate to handle minor clock differences relative to responders and caches. I.e. currentTime shall not be after nextUpdate + nextUpdateTolerancePeriod. The setting is applicable only whencheckOCSPResponseUpdateTimeis enabled and no nonce is checked. Default : 0- Parameters:
nextUpdateTolerancePeriod- the tolerance period in milliseconds
-
getRevocationToken
public eu.europa.esig.dss.spi.x509.revocation.ocsp.OCSPToken getRevocationToken(eu.europa.esig.dss.model.x509.CertificateToken certificateToken, eu.europa.esig.dss.model.x509.CertificateToken issuerCertificateToken) -
getRevocationToken
-
getOCSPAccessURLs
-
buildOCSPRequest
protected byte[] buildOCSPRequest(eu.europa.esig.dss.model.x509.CertificateToken certificateToken, eu.europa.esig.dss.model.x509.CertificateToken issuerToken, byte[] nonce) Builds an OCSP request forcertificateToken- Parameters:
certificateToken-CertificateTokento retrieve an OCSP token forissuerToken-CertificateTokenrepresenting an issuer certificate ofcertificateTokennonce- byte array containing a unique nonce- Returns:
- byte array representing an OCSP request
-
executeOCSPRequest
protected org.bouncycastle.cert.ocsp.BasicOCSPResp executeOCSPRequest(String ocspAccessLocation, byte[] request) throws IOException, org.bouncycastle.cert.ocsp.OCSPException Executes arequestto the givenocspAccessLocationand returns an OCSP basic response, when applicable- Parameters:
ocspAccessLocation-Stringrepresenting a URL to execute requestrequest- byte array containing OCSP request- Returns:
BasicOCSPResp- Throws:
IOException- if an error occurs on OCSP request executionorg.bouncycastle.cert.ocsp.OCSPException- if an error occurs on OCSP response reading
-
assertOCSPResponseValid
protected void assertOCSPResponseValid(org.bouncycastle.cert.ocsp.BasicOCSPResp basicOCSPResp, org.bouncycastle.cert.ocsp.SingleResp latestSingleResponse, byte[] expectedNonce) Verifies whether an OCSP response is valid- Parameters:
basicOCSPResp-BasicOCSPResplatestSingleResponse-SingleRespexpectedNonce- byte array
-