Package java.security.cert

Examples of java.security.cert.CollectionCertStoreParameters


        CertPathParameters params = null;
        if("PKIX".equalsIgnoreCase(algorithm)) {
            PKIXBuilderParameters xparams = new PKIXBuilderParameters(trustStore,
                                                                     new X509CertSelector());
            Collection crls = getCRLs(crlf);
            CertStoreParameters csp = new CollectionCertStoreParameters(crls);
            CertStore store = CertStore.getInstance("Collection", csp);
            xparams.addCertStore(store);
            xparams.setRevocationEnabled(true);
            String trustLength = (String)attributes.get("trustMaxCertLength");
            if(trustLength != null) {
View Full Code Here


    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);
      return signedData.getEncoded();
View Full Code Here

    // 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);
      return signedData.getEncoded();
    } catch (Exception e) {
View Full Code Here

            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);
View Full Code Here

    }
   
    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

    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

                        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();
                gen.addCertificatesAndCRLs(certs);
View Full Code Here

              List list = new ArrayList();
              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);
View Full Code Here

       list.addAll(cACertChain);
       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);
View Full Code Here

  public static byte[] signData(PrivateKey signKey, X509Certificate signCert, byte[] data){
    byte[] retdata = null;
    try{
          ArrayList certList = new ArrayList();
          certList.add(signCert);
          CertStore certs = CertStore.getInstance("Collection", new CollectionCertStoreParameters(certList), provider);         
      CMSSignedDataGenerator    gen = new CMSSignedDataGenerator();
      gen.addCertificatesAndCRLs(certs);
      gen.addSigner(signKey, signCert, signAlg);       
      CMSSignedData           signedData = gen.generate(new CMSProcessableByteArray(data), true, provider);
      retdata = signedData.getEncoded();
View Full Code Here

TOP

Related Classes of java.security.cert.CollectionCertStoreParameters

Copyright © 2018 www.massapicom. 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.