本文整理汇总了Java中org.bouncycastle.ocsp.BasicOCSPResp类的典型用法代码示例。如果您正苦于以下问题:Java BasicOCSPResp类的具体用法?Java BasicOCSPResp怎么用?Java BasicOCSPResp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BasicOCSPResp类属于org.bouncycastle.ocsp包,在下文中一共展示了BasicOCSPResp类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: responderIDtoString
import org.bouncycastle.ocsp.BasicOCSPResp; //导入依赖的package包/类
/**
* Get String represetation of ResponderID
* @param basResp
* @return stringified responder ID
*/
private String responderIDtoString(BasicOCSPResp basResp) {
if(basResp != null) {
ResponderID respid = basResp.getResponseData().getResponderId().toASN1Object();
Object o = ((DERTaggedObject)respid.toASN1Object()).getObject();
if(o instanceof org.bouncycastle.asn1.DEROctetString) {
org.bouncycastle.asn1.DEROctetString oc = (org.bouncycastle.asn1.DEROctetString)o;
return "byKey: " + SignedDoc.bin2hex(oc.getOctets());
} else {
X509Name name = new X509Name((ASN1Sequence)o);
return "byName: " + name.toString();
}
}
else
return null;
}
示例2: xtractNextUpdate
import org.bouncycastle.ocsp.BasicOCSPResp; //导入依赖的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;
}
示例3: checkCertStatus
import org.bouncycastle.ocsp.BasicOCSPResp; //导入依赖的package包/类
/**
* Verifies that the OCSP response is about our signers
* cert and the response status is successfull
* @param sig Signature object
* @param basResp OCSP Basic response
* @throws DigiDocException if the response is not successfull
*/
private void checkCertStatus(Signature sig, BasicOCSPResp basResp)
throws DigiDocException
{
checkCertStatus(sig.getKeyInfo().getSignersCertificate(), basResp, null);
}