Package java.security.cert

Examples of java.security.cert.CollectionCertStoreParameters


      }
      try {
        X509Certificate ca = (X509Certificate) factory
            .generateCertificate(new ByteArrayInputStream(content));
        Collection<X509Certificate> caSet = Collections.singleton(ca);
        CertStoreParameters storeParams = new CollectionCertStoreParameters(
            caSet);

        return CertStore.getInstance("Collection", storeParams);
      } catch (GeneralSecurityException e) {
        throw new InvalidContentTypeException(e);
View Full Code Here


        {
            _vec2.add(_vec.elementAt(i));
        }

        return CertStore.getInstance("Collection",
                new CollectionCertStoreParameters(_vec2), "BC");
    }
View Full Code Here

            list.add(rootCert);
            list.add(interCert);
            list.add(finalCert);
            list.add(rootCrl);
            list.add(interCrl);
            CollectionCertStoreParameters ccsp = new CollectionCertStoreParameters(list);
            CertStore store = CertStore.getInstance("Collection", ccsp, "BC");
            Calendar validDate = Calendar.getInstance();
            validDate.set(2002,2,21,2,21,10);

                //Searching for rootCert by subjectDN without CRL
View Full Code Here

            list.add(interCert);
            list.add(endCert);
            list.add(rootCRL);
            list.add(interCRL);
           
            CollectionCertStoreParameters params = new CollectionCertStoreParameters(list);
            CertStore                     store = CertStore.getInstance("Collection", params);
   
            // build the path
            CertPathBuilder  builder = CertPathBuilder.getInstance("PKIX", "BC");
            X509CertSelector pathConstraints = new X509CertSelector();
View Full Code Here

        list.add(rootCert);
        list.add(interCert);
        list.add(finalCert);
        list.add(rootCrl);
        list.add(interCrl);
        CollectionCertStoreParameters ccsp = new CollectionCertStoreParameters(list);
        CertStore store = CertStore.getInstance("Collection", ccsp);
        Calendar validDate = Calendar.getInstance();
        validDate.set(2002,2,21,2,21,10);

            //validating path
        List certchain = new ArrayList();
        certchain.add(finalCert);
        certchain.add(interCert);
        CertPath cp = CertificateFactory.getInstance("X.509","BC").generateCertPath(certchain);
        Set trust = new HashSet();
        trust.add(new TrustAnchor(rootCert, null));

        CertPathValidator cpv = CertPathValidator.getInstance("PKIX","BC");
        PKIXParameters param = new PKIXParameters(trust);
        param.addCertStore(store);
        param.setDate(validDate.getTime());
        PKIXCertPathValidatorResult result =
            (PKIXCertPathValidatorResult) cpv.validate(cp, param);
        PolicyNode policyTree = result.getPolicyTree();
        PublicKey subjectPublicKey = result.getPublicKey();

        //
        // invalid path containing a valid one test
        //
        try
        {
                // initialise CertStore
            rootCert = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream(AC_RAIZ_ICPBRASIL));
            interCert = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream(AC_PR));
            finalCert = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream(schefer));
   
            list = new ArrayList();
            list.add(rootCert);
            list.add(interCert);
            list.add(finalCert);

            ccsp = new CollectionCertStoreParameters(list);
            store = CertStore.getInstance("Collection", ccsp);
            validDate = Calendar.getInstance();
            validDate.set(2004,2,21,2,21,10);
   
                //validating path
View Full Code Here

       
        List      list = new ArrayList();
       
        list.add(sCert);
       
        CollectionCertStoreParameters ccsp = new CollectionCertStoreParameters(list);
        CertStore store = CertStore.getInstance("Collection", ccsp);
       
        Collection certs = store.getCertificates(aCert.getIssuer());
        if (certs.size() != 1 || !certs.contains(sCert))
        {
View Full Code Here

            list.add(rootCert);
            list.add(interCert);
            list.add(finalCert);
            list.add(rootCrl);
            list.add(interCrl);
            CollectionCertStoreParameters ccsp = new CollectionCertStoreParameters(
                    list);
            CertStore store = CertStore.getInstance("Collection", ccsp);

            // Searching for rootCert by subjectDN
            X509CertSelector targetConstraints = new X509CertSelector();
View Full Code Here

        generator.addSigner((PrivateKey) privateKey,
                    (X509Certificate) keyStore.getCertificate(keyAlias),
                    digestOID);
        List<X509Certificate> certList = new ArrayList<X509Certificate>();
        certList.add((X509Certificate) keyStore.getCertificate(keyAlias));
        CertStoreParameters params = new CollectionCertStoreParameters(certList);
        CertStore cs = CertStore.getInstance("Collection", params, "BC");
        generator.addCertificatesAndCRLs(cs);
        processableData = new CMSProcessableByteArray(data2beSigned);
        signedContainer = generator.generate(processableData, true, "BC");
        signedData = signedContainer.getEncoded();
View Full Code Here

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

        }
       
        // create a CertStore containing the certificates we want carried
        // in the signature
        this.certStore = CertStore.getInstance("Collection",
        new CollectionCertStoreParameters(certList), "BC");
       
    }
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.