当前位置: 首页>>代码示例>>Java>>正文


Java OCSPResp.getEncoded方法代码示例

本文整理汇总了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();
}
 
开发者ID:MaritimeConnectivityPlatform,项目名称:IdentityRegistry,代码行数:31,代码来源:CertificateController.java

示例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);
	}
}
 
开发者ID:esig,项目名称:dss,代码行数:14,代码来源:OCSPToken.java

示例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);
	}
}
 
开发者ID:esig,项目名称:dss,代码行数:9,代码来源:DSSRevocationUtils.java

示例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);
}
 
开发者ID:e-Contract,项目名称:jtrust,代码行数:10,代码来源:OcspTrustLinker.java

示例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);
}
 
开发者ID:wdawson,项目名称:revoker,代码行数:15,代码来源:OCSPRespMessageBodyWriter.java


注:本文中的org.bouncycastle.cert.ocsp.OCSPResp.getEncoded方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。