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


Java SignerInformationVerifierProvider类代码示例

本文整理汇总了Java中org.bouncycastle.cms.SignerInformationVerifierProvider的典型用法代码示例。如果您正苦于以下问题:Java SignerInformationVerifierProvider类的具体用法?Java SignerInformationVerifierProvider怎么用?Java SignerInformationVerifierProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testCPDRequest

import org.bouncycastle.cms.SignerInformationVerifierProvider; //导入依赖的package包/类
public void testCPDRequest()
    throws Exception
{
    CMSSignedData reqMsg = getWrappedCPDRequest();

    assertTrue(reqMsg.verifySignatures(new SignerInformationVerifierProvider()
    {
        public SignerInformationVerifier get(SignerId sid)
            throws OperatorCreationException
        {
            return new JcaSimpleSignerInfoVerifierBuilder().setProvider(BC).build(signCert);
        }
    }));

    DVCSRequest request = new DVCSRequest(reqMsg);

    CPDRequestData reqData = (CPDRequestData)request.getData();

    assertTrue(Arrays.areEqual(new byte[100], reqData.getMessage()));
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:21,代码来源:AllTests.java

示例2: testVPKCRequest

import org.bouncycastle.cms.SignerInformationVerifierProvider; //导入依赖的package包/类
public void testVPKCRequest()
    throws Exception
{
    SignedDVCSMessageGenerator gen = getSignedDVCSMessageGenerator();

    VPKCRequestBuilder reqBuilder = new VPKCRequestBuilder();

    reqBuilder.addTargetChain(new JcaX509CertificateHolder(signCert));

    CMSSignedData reqMsg = gen.build(reqBuilder.build());

    assertTrue(reqMsg.verifySignatures(new SignerInformationVerifierProvider()
    {
        public SignerInformationVerifier get(SignerId sid)
            throws OperatorCreationException
        {
            return new JcaSimpleSignerInfoVerifierBuilder().setProvider(BC).build(signCert);
        }
    }));

    DVCSRequest request = new DVCSRequest(reqMsg);

    VPKCRequestData reqData = (VPKCRequestData)request.getData();

    assertEquals(new TargetEtcChain(new CertEtcToken(CertEtcToken.TAG_CERTIFICATE, new JcaX509CertificateHolder(signCert).toASN1Structure())), ((TargetChain)reqData.getCerts().get(0)).toASN1Structure());
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:27,代码来源:AllTests.java

示例3: testVSDRequest

import org.bouncycastle.cms.SignerInformationVerifierProvider; //导入依赖的package包/类
public void testVSDRequest()
    throws Exception
{
    CMSSignedData message = getWrappedCPDRequest();

    SignedDVCSMessageGenerator gen = getSignedDVCSMessageGenerator();

    VSDRequestBuilder reqBuilder = new VSDRequestBuilder();

    CMSSignedData reqMsg = gen.build(reqBuilder.build(message));

    assertTrue(reqMsg.verifySignatures(new SignerInformationVerifierProvider()
    {
        public SignerInformationVerifier get(SignerId sid)
            throws OperatorCreationException
        {
            return new JcaSimpleSignerInfoVerifierBuilder().setProvider(BC).build(signCert);
        }
    }));

    DVCSRequest request = new DVCSRequest(reqMsg);

    VSDRequestData reqData = (VSDRequestData)request.getData();

    assertEquals(message.toASN1Structure().getContentType(), reqData.getParsedMessage().toASN1Structure().getContentType());
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:27,代码来源:AllTests.java

示例4: testCCPDRequest

import org.bouncycastle.cms.SignerInformationVerifierProvider; //导入依赖的package包/类
public void testCCPDRequest()
    throws Exception
{
    SignedDVCSMessageGenerator gen = getSignedDVCSMessageGenerator();

    CCPDRequestBuilder reqBuilder = new CCPDRequestBuilder();

    MessageImprintBuilder imprintBuilder = new MessageImprintBuilder(new SHA1DigestCalculator());

    MessageImprint messageImprint = imprintBuilder.build(new byte[100]);

    CMSSignedData reqMsg = gen.build(reqBuilder.build(messageImprint));

    assertTrue(reqMsg.verifySignatures(new SignerInformationVerifierProvider()
    {
        public SignerInformationVerifier get(SignerId sid)
            throws OperatorCreationException
        {
            return new JcaSimpleSignerInfoVerifierBuilder().setProvider(BC).build(signCert);
        }
    }));

    DVCSRequest request = new DVCSRequest(reqMsg);

    CCPDRequestData reqData = (CCPDRequestData)request.getData();

    assertEquals(messageImprint, reqData.getMessageImprint());
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:29,代码来源:AllTests.java

示例5: testCreateSimpleSignatureContainer

import org.bouncycastle.cms.SignerInformationVerifierProvider; //导入依赖的package包/类
/**
 * For some tests I needed SHA256withRSAandMGF1 CMS signatures.
 */
@Test
public void testCreateSimpleSignatureContainer() throws CMSException, GeneralSecurityException, OperatorCreationException, IOException
{
    byte[] message = "SHA256withRSAandMGF1".getBytes();
    CMSTypedData msg = new CMSProcessableByteArray(message);

    List<X509Certificate> certList = new ArrayList<X509Certificate>();
    certList.add(origCert);
    certList.add(signCert);
    Store certs = new JcaCertStore(certList);

    CMSSignedDataGenerator gen = new CMSSignedDataGenerator();
    ContentSigner sha1Signer = new JcaContentSignerBuilder("SHA256withRSAandMGF1").setProvider("BC").build(signKP.getPrivate());

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

    gen.addCertificates(certs);

    CMSSignedData sigData = gen.generate(msg, false);
    
    
    Files.write(new File(RESULT_FOLDER, "simpleMessageSHA256withRSAandMGF1.bin").toPath(), message);
    Files.write(new File(RESULT_FOLDER, "simpleMessageSHA256withRSAandMGF1.p7s").toPath(), sigData.getEncoded());
    
    boolean verifies = sigData.verifySignatures(new SignerInformationVerifierProvider()
    {
        @Override
        public SignerInformationVerifier get(SignerId sid) throws OperatorCreationException
        {
            if (sid.getSerialNumber().equals(origCert.getSerialNumber()))
            {
                System.out.println("SignerInformationVerifier requested for OrigCert");
                return new JcaSignerInfoVerifierBuilder(new BcDigestCalculatorProvider()).build(origCert);
            }
            if (sid.getSerialNumber().equals(signCert.getSerialNumber()))
            {
                System.out.println("SignerInformationVerifier requested for SignCert");
                return new JcaSignerInfoVerifierBuilder(new BcDigestCalculatorProvider()).build(signCert);
            }
            System.out.println("SignerInformationVerifier requested for unknown " + sid);
            return null;
        }
    });
    
    System.out.println("Verifies? " + verifies);
}
 
开发者ID:mkl-public,项目名称:testarea-itext5,代码行数:53,代码来源:RsaSsaPss.java


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