Examples of CertStore


Examples of java.security.cert.CertStore

    CMSProcessableInputStream input = new CMSProcessableInputStream(content);
    CMSSignedDataGenerator gen = new CMSSignedDataGenerator();
    // CertificateChain
    List<Certificate> certList = Arrays.asList(cert);

    CertStore certStore = null;
    try
    {
      certStore = CertStore.getInstance("Collection",
          new CollectionCertStoreParameters(certList), provider);
      gen.addSigner(privKey, (X509Certificate) certList.get(0),
View Full Code Here

Examples of java.security.cert.CertStore

    CMSProcessableInputStream input = new CMSProcessableInputStream(content);
    CMSSignedDataGenerator gen = new CMSSignedDataGenerator();
    // CertificateChain
    List<Certificate> certList = Arrays.asList(cert);

    CertStore certStore = null;
    try {
      certStore = CertStore.getInstance("Collection", new CollectionCertStoreParameters(certList), provider);
      gen.addSigner(privKey, (X509Certificate) certList.get(0), CMSSignedGenerator.DIGEST_SHA256);
      gen.addCertificatesAndCRLs(certStore);
      CMSSignedData signedData = gen.generate(input, false, provider);
View Full Code Here

Examples of java.security.cert.CertStore

            List<Certificate> list = new ArrayList<Certificate>();
            list.add(verCert);
            list.addAll(cACertChain);

            CollectionCertStoreParameters ccsp = new CollectionCertStoreParameters(list);
            CertStore store = CertStore.getInstance("Collection", ccsp);

            //validating path
            List<Certificate> certchain = new ArrayList<Certificate>();
            certchain.addAll(cACertChain);
            certchain.add(verCert);
View Full Code Here

Examples of java.security.cert.CertStore

    }
   
    private byte[] createPKCS7(Certificate[] chain, PrivateKey pk, X509Certificate cert) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException, CertStoreException, CMSException, IOException {
      Collection<Certificate> certList = Arrays.asList(chain);
      CMSProcessable msg = new CMSProcessableByteArray(new byte[0]);
      CertStore certs = CertStore.getInstance("Collection", new CollectionCertStoreParameters(certList), "BC");
      CMSSignedDataGenerator gen = new CMSSignedDataGenerator();
      gen.addCertificatesAndCRLs(certs);
      // it is possible to sign the pkcs7, but it's not currently used
      CMSSignedData s = null;
      if ( (pk != null) && (cert != null) ) {
View Full Code Here

Examples of java.security.cert.CertStore

    final CMSSignedDataGenerator gen1 = new CMSSignedDataGenerator();
    try {
      byte[] resp = serviceReq.getDoc();
      // Add our signer info and sign the message
      if ((serviceReq.getMode() & CmsCAServiceRequest.MODE_SIGN) != 0) {
        final CertStore certs = CertStore.getInstance("Collection", new CollectionCertStoreParameters(certificatechain), "BC");
        gen1.addCertificatesAndCRLs(certs);
        gen1.addSigner(privKey, signerCert, CMSSignedGenerator.DIGEST_SHA1);
        final CMSProcessable msg = new CMSProcessableByteArray(resp);
        final CMSSignedData s = gen1.generate(msg, true, "BC");
        resp = s.getEncoded();
View Full Code Here

Examples of java.security.cert.CertStore

                        log.debug("Including message signer certificate in SCEP response.");
                        certList.add(signCert);
                      }
                    }
                }
                CertStore certs = CertStore.getInstance("Collection",
                        new CollectionCertStoreParameters(certList), "BC");

                // Create the signed CMS message to be contained inside the envelope
                // this message does not contain any message, and no signerInfo
                CMSSignedDataGenerator gen = new CMSSignedDataGenerator();
View Full Code Here

Examples of java.security.cert.CertStore

            if (content instanceof byte[]) {
                result.setContent((byte[]) content);
            }

            CertStore certs = signedData.getCertificatesAndCRLs("Collection",
                    "BC");

            SignerInformationStore  signers = signedData.getSignerInfos();
            for (Object o : signers.getSigners()) {
                if (o instanceof SignerInformation) {
                    SignerInformation si = (SignerInformation) o;

                    if (LOG.isDebugEnabled()) {
                        LOG.debug("*** SIGNATURE: " + "\n" + si.getSID());
                    }
                   
                    final Collection<? extends Certificate> signerCerts;
                    try {
                        signerCerts = certs.getCertificates(si.getSID());

                        if (LOG.isDebugEnabled()) {
                            LOG.debug("signerCerts: " + signerCerts);
                        }

View Full Code Here

Examples of java.security.cert.CertStore

              list.add(verCert);
              list.add(cACertChain);


              CollectionCertStoreParameters ccsp = new CollectionCertStoreParameters(list);
              CertStore store = CertStore.getInstance("Collection", ccsp);

              //validating path
              List certchain = new ArrayList();
              certchain.addAll(cACertChain);
              certchain.add(verCert);
View Full Code Here

Examples of java.security.cert.CertStore

            // log.info(sid.toString());
            X500Principal issuer = sid.getIssuer();
            assertNotNull(issuer);
            assertEquals("CN=TEST", issuer.getName());
        }
        CertStore store = csd.getCertificatesAndCRLs("Collection", "BC");
        Collection certs = store.getCertificates(null);
        assertEquals(2, certs.size());

        CMSProcessable cp = csd.getSignedContent();
        Object o = cp.getContent();
        byte[] ob = (byte[]) o;
View Full Code Here

Examples of java.security.cert.CertStore

       if(trustedCRLs != null){
         list.addAll(trustedCRLs);
       }
      
       CollectionCertStoreParameters ccsp = new CollectionCertStoreParameters(list);
       CertStore store = CertStore.getInstance("Collection", ccsp);
      
       //validating path
       List certchain = new ArrayList();
       certchain.addAll(cACertChain);
       certchain.add(usercert);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.