// Perform offline revocation check using stored OCSP responses.
if (useOCSP) {
// Check if offline OCSP responses were provided.
if (ocspResponses == null) {
throw new NoOCSPResponseException(
String.format(messages.getString(
"No_OCSP_response_was_provided_to_perform_offline_revocation_check_of_the_certificate__%s"),
CertificateValidator.getCertificateName(certificate)));
}
// Disable standard online revocation check.
parameters.setRevocationEnabled(false);
// Verify the certificate using OCSP responses.
OCSPVerifier verifier = new OCSPVerifier(null, (ArrayList<BasicOCSPResp>) ocspResponses);
verifier.setOnlineCheckingAllowed(false);
if (verifier.verify(certificate, issuerCertificate, date.getTime()).size() == 0) {
throw new NoOCSPResponseException(
String.format(messages.getString(
"Could_not_find_a_valid_OCSP_response_for_the_certificate__%s"),
CertificateValidator.getCertificateName(certificate)));
}