public GetBasicOCSPResp ( |
||
checkCert | ||
rootCert | ||
url | String | |
return |
public BasicOcspResp GetBasicOCSPResp(X509Certificate checkCert, X509Certificate rootCert, String url)
{
try {
OcspResp ocspResponse = GetOcspResponse(checkCert, rootCert, url);
if (ocspResponse == null)
return null;
if (ocspResponse.Status != 0)
return null;
return (BasicOcspResp) ocspResponse.GetResponseObject();
}
catch (Exception ex) {
if (LOGGER.IsLogging(Level.ERROR))
LOGGER.Error(ex.Message);
}
return null;
}
/** * Gets an OCSP response online and returns it if the status is GOOD * (without further checking). * @param signCert the signing certificate * @param issuerCert the issuer certificate * @return an OCSP response */ virtual public BasicOcspResp GetOcspResponse(X509Certificate signCert, X509Certificate issuerCert) { if (signCert == null && issuerCert == null) { return(null); } OcspClientBouncyCastle ocsp = new OcspClientBouncyCastle(); BasicOcspResp ocspResp = ocsp.GetBasicOCSPResp(signCert, issuerCert, null); if (ocspResp == null) { return(null); } SingleResp[] resp = ocspResp.Responses; for (int i = 0; i < resp.Length; ++i) { Object status = resp[i].GetCertStatus(); if (status == CertificateStatus.Good) { return(ocspResp); } } return(null); }