本文整理汇总了Java中org.bouncycastle.ocsp.RevokedStatus类的典型用法代码示例。如果您正苦于以下问题:Java RevokedStatus类的具体用法?Java RevokedStatus怎么用?Java RevokedStatus使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RevokedStatus类属于org.bouncycastle.ocsp包,在下文中一共展示了RevokedStatus类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: xtractNextUpdate
import org.bouncycastle.ocsp.RevokedStatus; //导入依赖的package包/类
private Date xtractNextUpdate(OCSPResp ocspResponse) throws OCSPQueryException {
int status = ocspResponse.getStatus();
switch (status) {
// case OCSPRespStatus.SUCCESSFUL:
// break;
// case OCSPResp.INTERNAL_ERROR:
// case OCSPRespStatus.MALFORMED_REQUEST:
// case OCSPRespStatus.SIGREQUIRED:
// case OCSPRespStatus.TRY_LATER:
// case OCSPRespStatus.UNAUTHORIZED:
case OCSPResp.SUCCESSFUL:
break;
case OCSPResp.INTERNAL_ERROR:
case OCSPResp.MALFORMED_REQUEST:
case OCSPResp.SIG_REQUIRED:
case OCSPResp.TRY_LATER:
case OCSPResp.UNAUTHORIZED:
throw new OCSPQueryException(
"OCSP Error: " //$NON-NLS-1$
+ Integer.toString(status));
default:
throw new OCSPQueryException("***"); //$NON-NLS-1$
}
try {
BasicOCSPResp bresp = (BasicOCSPResp) ocspResponse
.getResponseObject();
if (bresp == null) {
throw new OCSPQueryException("***"); //$NON-NLS-1$
}
// X509Certificate[] ocspcerts = bresp.getCerts(Messages
// .getString("ValidateSignAndCertBase.71")); //$NON-NLS-1$
// Verify all except trusted anchor
// for (i = 0; i < ocspcerts.length - 1; i++) {
// ocspcerts[i].verify(ocspcerts[i + 1].getPublicKey());
// }
// if (rootcert != null) {
// ocspcerts[i].verify(rootcert.getPublicKey());
// }
SingleResp[] certstat = bresp.getResponses();
for (SingleResp singleResp : certstat) {
// if (singleResp.getCertStatus() == null) {
// return true;
// }
if (singleResp.getCertStatus() instanceof RevokedStatus) {
throw new RevokedException();
}
return singleResp.getNextUpdate();
}
} catch (Exception e) {
throw new OCSPQueryException(e);
}
return null;
}