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


Java OCSPResponse.getInstance方法代码示例

本文整理汇总了Java中org.bouncycastle.asn1.ocsp.OCSPResponse.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java OCSPResponse.getInstance方法的具体用法?Java OCSPResponse.getInstance怎么用?Java OCSPResponse.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bouncycastle.asn1.ocsp.OCSPResponse的用法示例。


在下文中一共展示了OCSPResponse.getInstance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getOthersFromStore

import org.bouncycastle.asn1.ocsp.OCSPResponse; //导入方法依赖的package包/类
static Collection getOthersFromStore(ASN1ObjectIdentifier otherRevocationInfoFormat, Store otherRevocationInfos)
{
    List others = new ArrayList();

    for (Iterator it = otherRevocationInfos.getMatches(null).iterator(); it.hasNext();)
    {
        ASN1Encodable info = (ASN1Encodable)it.next();

        if (CMSObjectIdentifiers.id_ri_ocsp_response.equals(otherRevocationInfoFormat))
        {
            OCSPResponse resp = OCSPResponse.getInstance(info);

            if (resp.getResponseStatus().getValue().intValue() != OCSPResponseStatus.SUCCESSFUL)
            {
                throw new IllegalArgumentException("cannot add unsuccessful OCSP response to CMS SignedData");
            }
        }

        others.add(new DERTaggedObject(false, 1, new OtherRevocationInfoFormat(otherRevocationInfoFormat, info)));
    }

    return others;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:24,代码来源:CMSUtils.java

示例2: parse

import org.bouncycastle.asn1.ocsp.OCSPResponse; //导入方法依赖的package包/类
/**
 * Parse a {@link CertificateStatus} from an {@link InputStream}.
 * 
 * @param input
 *            the {@link InputStream} to parse from.
 * @return a {@link CertificateStatus} object.
 * @throws IOException
 */
public static CertificateStatus parse(InputStream input) throws IOException
{
    short status_type = TlsUtils.readUint8(input);
    Object response;

    switch (status_type)
    {
    case CertificateStatusType.ocsp:
    {
        byte[] derEncoding = TlsUtils.readOpaque24(input);
        response = OCSPResponse.getInstance(TlsUtils.readDERObject(derEncoding));
        break;
    }
    default:
        throw new TlsFatalAlert(AlertDescription.decode_error);
    }

    return new CertificateStatus(status_type, response);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:28,代码来源:CertificateStatus.java

示例3: CertEtcToken

import org.bouncycastle.asn1.ocsp.OCSPResponse; //导入方法依赖的package包/类
private CertEtcToken(ASN1TaggedObject choice)
{
    this.tagNo = choice.getTagNo();

    switch (tagNo)
    {
    case TAG_CERTIFICATE:
        value = Certificate.getInstance(choice, false);
        break;
    case TAG_ESSCERTID:
        value = ESSCertID.getInstance(choice.getObject());
        break;
    case TAG_PKISTATUS:
        value = PKIStatusInfo.getInstance(choice, false);
        break;
    case TAG_ASSERTION:
        value = ContentInfo.getInstance(choice.getObject());
        break;
    case TAG_CRL:
        value = CertificateList.getInstance(choice, false);
        break;
    case TAG_OCSPCERTSTATUS:
        value = CertStatus.getInstance(choice.getObject());
        break;
    case TAG_OCSPCERTID:
        value = CertID.getInstance(choice, false);
        break;
    case TAG_OCSPRESPONSE:
        value = OCSPResponse.getInstance(choice, false);
        break;
    case TAG_CAPABILITIES:
        value = SMIMECapabilities.getInstance(choice.getObject());
        break;
    default:
        throw new IllegalArgumentException("Unknown tag: " + tagNo);
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:38,代码来源:CertEtcToken.java

示例4: validateInfoFormat

import org.bouncycastle.asn1.ocsp.OCSPResponse; //导入方法依赖的package包/类
private static void validateInfoFormat(OtherRevocationInfoFormat infoFormat)
{
    if (CMSObjectIdentifiers.id_ri_ocsp_response.equals(infoFormat.getInfoFormat()))
    {
        OCSPResponse resp = OCSPResponse.getInstance(infoFormat.getInfo());

        if (resp.getResponseStatus().getValue().intValue() != OCSPResponseStatus.SUCCESSFUL)
        {
            throw new IllegalArgumentException("cannot add unsuccessful OCSP response to CMS SignedData");
        }
    }
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:13,代码来源:CMSUtils.java

示例5: testSHA1WithRSAAndOtherRevocation

import org.bouncycastle.asn1.ocsp.OCSPResponse; //导入方法依赖的package包/类
public void testSHA1WithRSAAndOtherRevocation()
    throws Exception
{
    List                  certList = new ArrayList();
    CMSTypedData          msg = new CMSProcessableByteArray("Hello world!".getBytes());
    ByteArrayOutputStream bOut = new ByteArrayOutputStream();

    certList.add(_origCert);
    certList.add(_signCert);

    Store           certs = new JcaCertStore(certList);

    CMSSignedDataStreamGenerator gen = new CMSSignedDataStreamGenerator();

    ContentSigner sha1Signer = new JcaContentSignerBuilder("SHA1withRSA").setProvider(BC).build(_origKP.getPrivate());

    gen.addSignerInfoGenerator(new JcaSignerInfoGeneratorBuilder(new JcaDigestCalculatorProviderBuilder().setProvider(BC).build()).build(sha1Signer, _origCert));

    gen.addCertificates(certs);

    List otherInfo = new ArrayList();
    OCSPResp response = new OCSPResp(successResp);

    otherInfo.add(response.toASN1Structure());

    gen.addOtherRevocationInfo(CMSObjectIdentifiers.id_ri_ocsp_response, new CollectionStore(otherInfo));

    OutputStream sigOut = gen.open(bOut, true);

    sigOut.write(TEST_MESSAGE.getBytes());

    sigOut.close();

    CMSSignedDataParser     sp = new CMSSignedDataParser(new JcaDigestCalculatorProviderBuilder().setProvider(BC).build(), bOut.toByteArray());

    CMSTypedStream stream = sp.getSignedContent();

    assertEquals(CMSObjectIdentifiers.data, stream.getContentType());

    stream.drain();

    //
    // check version
    //
    assertEquals(5, sp.getVersion());

    //
    // compute expected content digest
    //
    MessageDigest md = MessageDigest.getInstance("SHA1", BC);

    verifySignatures(sp, md.digest(TEST_MESSAGE.getBytes()));

    Store dataOtherInfo = sp.getOtherRevocationInfo(CMSObjectIdentifiers.id_ri_ocsp_response);

    assertEquals(1, dataOtherInfo.getMatches(null).size());

    OCSPResp dataResponse = new OCSPResp(OCSPResponse.getInstance(dataOtherInfo.getMatches(null).iterator().next()));

    assertEquals(response, dataResponse);
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:62,代码来源:NewSignedDataStreamTest.java

示例6: testSHA1WithRSAAndOtherRevocation

import org.bouncycastle.asn1.ocsp.OCSPResponse; //导入方法依赖的package包/类
public void testSHA1WithRSAAndOtherRevocation()
    throws Exception
{
    List              certList = new ArrayList();
    CMSTypedData      msg = new CMSProcessableByteArray("Hello world!".getBytes());

    certList.add(_origCert);
    certList.add(_signCert);

    Store           certs = new JcaCertStore(certList);

    CMSSignedDataGenerator gen = new CMSSignedDataGenerator();

    ContentSigner sha1Signer = new JcaContentSignerBuilder("SHA1withRSA").setProvider(BC).build(_origKP.getPrivate());

    gen.addSignerInfoGenerator(new JcaSignerInfoGeneratorBuilder(new JcaDigestCalculatorProviderBuilder().setProvider(BC).build()).build(sha1Signer, _origCert));

    gen.addCertificates(certs);

    List otherInfo = new ArrayList();
    OCSPResp response = new OCSPResp(successResp);

    otherInfo.add(response.toASN1Structure());

    gen.addOtherRevocationInfo(CMSObjectIdentifiers.id_ri_ocsp_response, new CollectionStore(otherInfo));

    CMSSignedData s;

    s = gen.generate(msg, false);

    //
    // check version
    //
    assertEquals(5, s.getVersion());

    //
    // compute expected content digest
    //
    MessageDigest md = MessageDigest.getInstance("SHA1", BC);

    verifySignatures(s, md.digest("Hello world!".getBytes()));

    Store dataOtherInfo = s.getOtherRevocationInfo(CMSObjectIdentifiers.id_ri_ocsp_response);

    assertEquals(1, dataOtherInfo.getMatches(null).size());

    OCSPResp dataResponse = new OCSPResp(OCSPResponse.getInstance(dataOtherInfo.getMatches(null).iterator().next()));

    assertEquals(response, dataResponse);
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:51,代码来源:NewSignedDataTest.java


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