Java 8 PKIXParameters - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 PKIXParameters class.

This code example shows how to use the following methods: addCertStore, setDate, setExplicitPolicyRequired, setInitialPolicies, setRevocationEnabled
     
        CertStore  store = CertStore.getInstance("Collection", new CollectionCertStoreParameters(certsAndCrls), "BC");
         
        //CertPathValidator validator = CertPathValidator.getInstance("PKIX","BC"); 
        PKIXCertPathReviewer reviewer;
        PKIXParameters    params = new PKIXParameters(trustedSet);
         
        params.addCertStore(store);
        params.setRevocationEnabled(true);
        params.setDate(new GregorianCalendar(2010, 1, 1).getTime());
 
        if (policies != null)
        { 
            params.setExplicitPolicyRequired(true);
            params.setInitialPolicies(policies);
        } 
         
        reviewer = new PKIXCertPathReviewer(certPath,params);
         
        return reviewer;

7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: addCertStore, setRevocationEnabled
        X509Certificate rootCert = CertUtils.getCertFromFile("anchor.cer");
        TrustAnchor anchor = new TrustAnchor
            (rootCert.getSubjectX500Principal(), rootCert.getPublicKey(), null);
        X509CertSelector sel = new X509CertSelector();
        sel.setBasicConstraints(-2);
        PKIXBuilderParameters params = new PKIXBuilderParameters
            (Collections.singleton(anchor), sel);
        params.setRevocationEnabled(false);
        X509Certificate eeCert = CertUtils.getCertFromFile("ee.cer");
        X509Certificate caCert = CertUtils.getCertFromFile("ca.cer");
        ArrayList<X509Certificate> certs = new ArrayList<X509Certificate>();
        certs.add(caCert);
        certs.add(eeCert);
        CollectionCertStoreParameters ccsp =
            new CollectionCertStoreParameters(certs);
        CertStore cs = CertStore.getInstance("Collection", ccsp);
        params.addCertStore(cs);
        PKIXCertPathBuilderResult res = CertUtils.build(params);
        CertPath cp = res.getCertPath();
        // check that first certificate is an EE cert 

7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: addCertStore, setDate, setRevocationEnabled, setTargetCertConstraints
        trust.add(new TrustAnchor(caCert, null));
 
        CertPathValidator cpv = CertPathValidator.getInstance("PKIX","BC");
        //PKIXParameters param = new PKIXParameters(trust); 
 
        PKIXBuilderParameters param = new PKIXBuilderParameters(trust, null);
        X509CertSelector certSelector = new X509CertSelector();
        certSelector.setCertificate(crlCaCert);
        param.setTargetCertConstraints(certSelector);
        param.addCertStore(store);
        param.setRevocationEnabled(true);
        param.setDate(validDate.getTime());
 
        PKIXCertPathValidatorResult result = (PKIXCertPathValidatorResult)cpv.validate(cp, param);
    } 
 
    public void performTest() 
        throws Exception 
    { 
        CertificateFactory cf = CertificateFactory.getInstance("X.509", "BC");
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setRevocationEnabled
        Session session = Session.getDefaultInstance(props, null);
 
        // read message 
        MimeMessage msg = new MimeMessage(session, getClass().getResourceAsStream(message));
 
        SignedMailValidator validator = new SignedMailValidator(msg, params);
        SignerInformation signer = (SignerInformation) validator
                .getSignerInformationStore().getSigners().iterator().next(); 
        return validator.getValidationResult(signer);
    } 
 
    private void assertContainsMessage(List msgList, String messageId,
            String text) throws Exception
    { 
        Iterator it = msgList.iterator();
        boolean found = false;
        while (it.hasNext())
        { 
            ErrorBundle message = (ErrorBundle) it.next();
            if (message.getId().equals(messageId))

6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: addCertStore, setDate, setRevocationEnabled, setTargetCertConstraints

Related Java 8 PKIXParameters Questions & Answers:

See Code Examples for Java 8 PKIXParameters Methods: