本文整理汇总了Java中org.bouncycastle.cert.ocsp.OCSPResp.getEncoded方法的典型用法代码示例。如果您正苦于以下问题:Java OCSPResp.getEncoded方法的具体用法?Java OCSPResp.getEncoded怎么用?Java OCSPResp.getEncoded使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.cert.ocsp.OCSPResp
的用法示例。
在下文中一共展示了OCSPResp.getEncoded方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleOCSP
import org.bouncycastle.cert.ocsp.OCSPResp; //导入方法依赖的package包/类
protected byte[] handleOCSP(byte[] input, String certAlias) throws IOException {
OCSPReq ocspreq = new OCSPReq(input);
/* TODO: verify signature - needed?
if (ocspreq.isSigned()) {
}*/
BasicOCSPRespBuilder respBuilder = Revocation.initOCSPRespBuilder(ocspreq, certUtil.getKeystoreHandler().getMCCertificate(certAlias).getPublicKey());
Req[] requests = ocspreq.getRequestList();
for (Req req : requests) {
BigInteger sn = req.getCertID().getSerialNumber();
Certificate cert = this.certificateService.getCertificateBySerialNumber(sn);
if (cert == null) {
respBuilder.addResponse(req.getCertID(), new UnknownStatus());
// Check if the certificate is even signed by this CA
} else if (!certAlias.equals(cert.getCertificateAuthority())) {
respBuilder.addResponse(req.getCertID(), new UnknownStatus());
// Check if certificate has been revoked
} else if (cert.isRevoked()) {
respBuilder.addResponse(req.getCertID(), new RevokedStatus(cert.getRevokedAt(), Revocation.getCRLReasonFromString(cert.getRevokeReason())));
} else {
// Certificate is valid
respBuilder.addResponse(req.getCertID(), CertificateStatus.GOOD);
}
}
OCSPResp response = Revocation.generateOCSPResponse(respBuilder, certUtil.getKeystoreHandler().getSigningCertEntry(certAlias));
return response.getEncoded();
}
示例2: getEncoded
import org.bouncycastle.cert.ocsp.OCSPResp; //导入方法依赖的package包/类
@Override
public byte[] getEncoded() {
try {
if (basicOCSPResp != null) {
final OCSPResp ocspResp = DSSRevocationUtils.fromBasicToResp(basicOCSPResp);
return ocspResp.getEncoded();
} else {
throw new DSSException("Empty OCSP response");
}
} catch (IOException e) {
throw new DSSException("OCSP encoding error: " + e.getMessage(), e);
}
}
示例3: getEncoded
import org.bouncycastle.cert.ocsp.OCSPResp; //导入方法依赖的package包/类
public static byte[] getEncoded(OCSPResp ocspResp) {
try {
final byte[] encoded = ocspResp.getEncoded();
return encoded;
} catch (IOException e) {
throw new DSSException(e);
}
}
示例4: addRevocationData
import org.bouncycastle.cert.ocsp.OCSPResp; //导入方法依赖的package包/类
private void addRevocationData(RevocationData revocationData,
OCSPResp ocspResp, URI uri) throws IOException {
if (null == revocationData) {
return;
}
OCSPRevocationData ocspRevocationData = new OCSPRevocationData(
ocspResp.getEncoded(), uri.toString());
revocationData.getOcspRevocationData().add(ocspRevocationData);
}
示例5: writeTo
import org.bouncycastle.cert.ocsp.OCSPResp; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void writeTo(OCSPResp ocspResp,
Class<?> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType,
MultivaluedMap<String, Object> httpHeaders,
OutputStream entityStream) throws IOException, WebApplicationException {
byte[] encodedBytes = ocspResp.getEncoded();
entityStream.write(encodedBytes);
}