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


Java BasicOCSPResp类代码示例

本文整理汇总了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;
}
 
开发者ID:aleksz,项目名称:driveddoc,代码行数:21,代码来源:FlexibleBouncyCastleNotaryFactory.java

示例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;
	}
 
开发者ID:bluecrystalsign,项目名称:signer-source,代码行数:63,代码来源:OcspValidatorImpl.java

示例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);
}
 
开发者ID:aleksz,项目名称:driveddoc,代码行数:13,代码来源:FlexibleBouncyCastleNotaryFactory.java


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