• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java X509CollectionStoreParameters类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: createCertificateStore

import org.bouncycastle.x509.X509CollectionStoreParameters; //导入依赖的package包/类
/**
 * 
 * @param type
 * @param provider
 * @param certSet -> conjunto/cadeia de certificados
 * @return X509Store
 * @see org.bouncycastle.x509.X509Store
 * @throws NoSuchStoreException
 * @throws NoSuchProviderException
 * @throws CMSException
 */
X509Store createCertificateStore(
    String type,
    String provider,
    ASN1Set certSet)
    throws NoSuchStoreException, NoSuchProviderException, CMSException
{
    List<Object> certs = new ArrayList<Object>();

    if (certSet != null)
    {
        addCertsFromSet(certs, certSet, provider);
    }

    try
    {
        return X509Store.getInstance(
                     "Certificate/" +type, new X509CollectionStoreParameters(certs), provider);
    }
    catch (IllegalArgumentException e)
    {
        throw new CMSException("Nao e possivel setar/gerar o X509Store", e);
    }
}
 
开发者ID:esaito,项目名称:ExemplosDemoiselle,代码行数:35,代码来源:CMSSignedHelper.java


示例2: createCRLsStore

import org.bouncycastle.x509.X509CollectionStoreParameters; //导入依赖的package包/类
/**
 * 
 * @param type
 * @param provider
 * @param crlSet -> Conjunto de listas de certificados revogados
 * @return X509Store
 * @see org.bouncycastle.x509.X509Store
 * @throws NoSuchStoreException
 * @throws NoSuchProviderException
 * @throws CMSException
 */
X509Store createCRLsStore(
    String type,
    String provider,
    ASN1Set crlSet)
    throws NoSuchStoreException, NoSuchProviderException, CMSException
{
    List<Object> crls = new ArrayList<Object>();

    if (crlSet != null)
    {
        addCRLsFromSet(crls, crlSet, provider);
    }

    try
    {
        return X509Store.getInstance(
                     "CRL/" +type, new X509CollectionStoreParameters(crls), provider);
    }
    catch (IllegalArgumentException e)
    {
        throw new CMSException("Nao e possivel setar/gerar o X509Store", e);
    }
}
 
开发者ID:esaito,项目名称:ExemplosDemoiselle,代码行数:35,代码来源:CMSSignedHelper.java


示例3: createCertificateStore

import org.bouncycastle.x509.X509CollectionStoreParameters; //导入依赖的package包/类
X509Store createCertificateStore(
    String type,
    Provider provider,
    ASN1Set certSet)
    throws NoSuchStoreException, CMSException
{
    List certs = new ArrayList();

    if (certSet != null)
    {
        addCertsFromSet(certs, certSet, provider);
    }

    try
    {
        return X509Store.getInstance(
                     "Certificate/" +type, new X509CollectionStoreParameters(certs), provider);
    }
    catch (IllegalArgumentException e)
    {
        throw new CMSException("can't setup the X509Store", e);
    }
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:24,代码来源:CMSSignedHelper.java


示例4: createCRLsStore

import org.bouncycastle.x509.X509CollectionStoreParameters; //导入依赖的package包/类
X509Store createCRLsStore(
    String type,
    Provider provider,
    ASN1Set crlSet)
    throws NoSuchStoreException, CMSException
{
    List crls = new ArrayList();

    if (crlSet != null)
    {
        addCRLsFromSet(crls, crlSet, provider);
    }

    try
    {
        return X509Store.getInstance(
                     "CRL/" +type, new X509CollectionStoreParameters(crls), provider);
    }
    catch (IllegalArgumentException e)
    {
        throw new CMSException("can't setup the X509Store", e);
    }
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:24,代码来源:CMSSignedHelper.java


示例5: engineInit

import org.bouncycastle.x509.X509CollectionStoreParameters; //导入依赖的package包/类
public void engineInit(X509StoreParameters params)
{
    if (!(params instanceof X509CollectionStoreParameters))
    {
        throw new IllegalArgumentException(params.toString());
    }

    _store = new CollectionStore(((X509CollectionStoreParameters)params).getCollection());
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:10,代码来源:X509StoreCertCollection.java


示例6: engineInit

import org.bouncycastle.x509.X509CollectionStoreParameters; //导入依赖的package包/类
/**
 * Initializes this store.
 *
 * @param params The {@link X509CollectionStoreParameters}s for this store.
 * @throws IllegalArgumentException if <code>params</code> is no instance of
 *                                  <code>X509CollectionStoreParameters</code>.
 */
public void engineInit(X509StoreParameters params)
{
    if (!(params instanceof X509CollectionStoreParameters))
    {
        throw new IllegalArgumentException(
            "Initialization parameters must be an instance of "
                + X509CollectionStoreParameters.class.getName()
                + ".");
    }

    _store = new CollectionStore(((X509CollectionStoreParameters)params)
        .getCollection());
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:21,代码来源:X509StoreCertPairCollection.java


示例7: certPairTest

import org.bouncycastle.x509.X509CollectionStoreParameters; //导入依赖的package包/类
private void certPairTest()
    throws Exception
{
    CertificateFactory cf = CertificateFactory.getInstance("X.509",
            "BC");

    X509Certificate rootCert = (X509Certificate)cf
            .generateCertificate(new ByteArrayInputStream(
                    CertPathTest.rootCertBin));
    X509Certificate interCert = (X509Certificate)cf
            .generateCertificate(new ByteArrayInputStream(
                    CertPathTest.interCertBin));
    X509Certificate finalCert = (X509Certificate)cf
            .generateCertificate(new ByteArrayInputStream(
                    CertPathTest.finalCertBin));

    // Testing CollectionCertStore generation from List
    X509CertificatePair pair1 = new X509CertificatePair(rootCert, interCert);
    List certList = new ArrayList();

    certList.add(pair1);
    certList.add(new X509CertificatePair(interCert, finalCert));

    X509CollectionStoreParameters ccsp = new X509CollectionStoreParameters(certList);

    X509Store certStore = X509Store.getInstance("CertificatePair/Collection", ccsp, "BC");
    X509CertPairStoreSelector selector = new X509CertPairStoreSelector();
    X509CertStoreSelector fwSelector = new X509CertStoreSelector();

    fwSelector.setSerialNumber(rootCert.getSerialNumber());
    fwSelector.setSubject(rootCert.getIssuerDN().getName());
    
    selector.setForwardSelector(fwSelector);

    Collection col = certStore.getMatches(selector);

    if (col.size() != 1 || !col.contains(pair1))
    {
        fail("failed pair1 test");
    }

    col = certStore.getMatches(null);

    if (col.size() != 2)
    {
        fail("failed null test");
    }
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:49,代码来源:X509StoreTest.java


示例8: certPairTest

import org.bouncycastle.x509.X509CollectionStoreParameters; //导入依赖的package包/类
private void certPairTest()
    throws Exception
{
    CertificateFactory cf = CertificateFactory.getInstance("X.509",
            "BC");

    X509Certificate rootCert = (X509Certificate)cf
            .generateCertificate(new ByteArrayInputStream(
                    CertPathTest.rootCertBin));
    X509Certificate interCert = (X509Certificate)cf
            .generateCertificate(new ByteArrayInputStream(
                    CertPathTest.interCertBin));
    X509Certificate finalCert = (X509Certificate)cf
            .generateCertificate(new ByteArrayInputStream(
                    CertPathTest.finalCertBin));

    // Testing CollectionCertStore generation from List
    X509CertificatePair pair1 = new X509CertificatePair(rootCert, interCert);
    List certList = new ArrayList();

    certList.add(pair1);
    certList.add(new X509CertificatePair(interCert, finalCert));

    X509CollectionStoreParameters ccsp = new X509CollectionStoreParameters(certList);

    X509Store certStore = X509Store.getInstance("CertificatePair/Collection", ccsp, "BC");
    X509CertPairStoreSelector selector = new X509CertPairStoreSelector();
    X509CertStoreSelector fwSelector = new X509CertStoreSelector();

    fwSelector.setSerialNumber(rootCert.getSerialNumber());

    selector.setForwardSelector(fwSelector);

    Collection col = certStore.getMatches(selector);

    if (col.size() != 1 || !col.contains(pair1))
    {
        fail("failed pair1 test");
    }

    col = certStore.getMatches(null);

    if (col.size() != 2)
    {
        fail("failed null test");
    }
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:48,代码来源:X509StoreTest.java


示例9: testWithAttributeCertificate

import org.bouncycastle.x509.X509CollectionStoreParameters; //导入依赖的package包/类
public void testWithAttributeCertificate()
    throws Exception
{
    List certList = new ArrayList();

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

    CertStore certs = CertStore.getInstance("Collection",
                    new CollectionCertStoreParameters(certList), "BC");

    ASN1EncodableVector signedAttrs = generateSignedAttributes();

    SMIMESignedGenerator gen = new SMIMESignedGenerator();

    gen.addSigner(_signKP.getPrivate(), _signCert, SMIMESignedGenerator.DIGEST_SHA256, new AttributeTable(signedAttrs), null);

    gen.addCertificatesAndCRLs(certs);

    X509AttributeCertificateHolder attrCert = CMSTestUtil.getAttributeCertificate();

    X509Store store = X509Store.getInstance("AttributeCertificate/Collection",
                                new X509CollectionStoreParameters(Collections.singleton(attrCert)), "BC");

    gen.addAttributeCertificates(store);

    SMIMESigned s = new SMIMESigned(gen.generateEncapsulated(msg, "BC"));

    verifyMessageBytes(msg, s.getContent());

    verifySigners(s.getCertificatesAndCRLs("Collection", "BC"), s.getSignerInfos());

    Store attrCerts = s.getAttributeCertificates();

    assertTrue(attrCerts.getMatches(null).contains(attrCert));
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:37,代码来源:SMIMESignedTest.java


示例10: testWithAttributeCertificate

import org.bouncycastle.x509.X509CollectionStoreParameters; //导入依赖的package包/类
public void testWithAttributeCertificate()
    throws Exception
{
    List certList = new ArrayList();

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

    CertStore certs = CertStore.getInstance("Collection",
                    new CollectionCertStoreParameters(certList), "BC");

    ASN1EncodableVector signedAttrs = generateSignedAttributes();

    SMIMESignedGenerator gen = new SMIMESignedGenerator();

    gen.addSigner(_signKP.getPrivate(), _signCert, SMIMESignedGenerator.DIGEST_SHA256, new AttributeTable(signedAttrs), null);

    gen.addCertificatesAndCRLs(certs);

    X509AttributeCertificate attrCert = CMSTestUtil.getAttributeCertificate();

    X509Store store = X509Store.getInstance("AttributeCertificate/Collection",
                                new X509CollectionStoreParameters(Collections.singleton(attrCert)), "BC");

    gen.addAttributeCertificates(store);

    SMIMESigned s = new SMIMESigned(gen.generateEncapsulated(msg, "BC"));

    verifyMessageBytes(msg, s.getContent());

    verifySigners(s.getCertificatesAndCRLs("Collection", "BC"), s.getSignerInfos());

    X509Store attrCerts = s.getAttributeCertificates("Collection", "BC");

    assertTrue(attrCerts.getMatches(null).contains(attrCert));
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:37,代码来源:SMIMESignedTest.java


示例11: testWithAttributeCertificate

import org.bouncycastle.x509.X509CollectionStoreParameters; //导入依赖的package包/类
public void testWithAttributeCertificate()
    throws Exception
{
    List                  certList = new ArrayList();
    CMSProcessable        msg = new CMSProcessableByteArray("Hello World!".getBytes());


    certList.add(_signDsaCert);

    CertStore           certs = CertStore.getInstance("Collection",
                    new CollectionCertStoreParameters(certList), BC);

    CMSSignedDataGenerator gen = new CMSSignedDataGenerator();

    gen.addSigner(_origKP.getPrivate(), _origCert, CMSSignedDataGenerator.DIGEST_SHA1);

    gen.addCertificatesAndCRLs(certs);

    X509AttributeCertificate attrCert = CMSTestUtil.getAttributeCertificate();

    X509Store store = X509Store.getInstance("AttributeCertificate/Collection",
                                new X509CollectionStoreParameters(Collections.singleton(attrCert)), BC);

    gen.addAttributeCertificates(store);

    CMSSignedData sd = gen.generate(msg, BC);

    assertEquals(4, sd.getVersion());

    store = sd.getAttributeCertificates("Collection", BC);

    Collection coll = store.getMatches(null);

    assertEquals(1, coll.size());

    assertTrue(coll.contains(attrCert));
    
    //
    // create new certstore
    //
    certList = new ArrayList();
    certList.add(_origCert);
    certList.add(_signCert);

    certs = CertStore.getInstance("Collection",
                    new CollectionCertStoreParameters(certList), BC);


    //
    // replace certs
    //
    sd = CMSSignedData.replaceCertificatesAndCRLs(sd, certs);

    verifySignatures(sd);
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:56,代码来源:SignedDataTest.java


示例12: testWithAttributeCertificate

import org.bouncycastle.x509.X509CollectionStoreParameters; //导入依赖的package包/类
public void testWithAttributeCertificate()
    throws Exception
{
    List                  certList = new ArrayList();

    certList.add(_signCert);

    CertStore           certs = CertStore.getInstance("Collection",
                    new CollectionCertStoreParameters(certList), BC);

    CMSSignedDataStreamGenerator gen = new CMSSignedDataStreamGenerator();

    gen.addSigner(_origKP.getPrivate(), _origCert, CMSSignedDataGenerator.DIGEST_SHA1, BC);

    gen.addCertificatesAndCRLs(certs);

    X509AttributeCertificate attrCert = CMSTestUtil.getAttributeCertificate();

    X509Store store = X509Store.getInstance("AttributeCertificate/Collection",
                                new X509CollectionStoreParameters(Collections.singleton(attrCert)), BC);

    gen.addAttributeCertificates(store);

    ByteArrayOutputStream bOut = new ByteArrayOutputStream();

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

    sigOut.write(TEST_MESSAGE.getBytes());

    sigOut.close();

    CMSSignedDataParser     sp = new CMSSignedDataParser(bOut.toByteArray());

    sp.getSignedContent().drain();

    assertEquals(4, sp.getVersion());

    store = sp.getAttributeCertificates("Collection", BC);

    Collection coll = store.getMatches(null);

    assertEquals(1, coll.size());

    assertTrue(coll.contains(attrCert));
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:46,代码来源:SignedDataStreamTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java XeLocalhost类代码示例发布时间:2022-05-22
下一篇:
Java IntLinkedOpenHashSet类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap