Java 8 CertPathValidatorException - 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 CertPathValidatorException class.

This code example shows how to use the following methods: getCause, getMessage, getCertPath, getIndex
     * constructor Assertion: constructs CertPathValidatorException when 
     * <code>cause</code> is null <code>msg</code> is null 
     * <code>certPath</code> is null <code>index</code> is -1 
     */ 
    public void testCertPathValidatorException10() { 
        CertPathValidatorException tE = new CertPathValidatorException(null,
                null, null, -1); 
        assertNull("getMessage() must return null", tE.getMessage());
        assertNull("getCause() must return null", tE.getCause());
        assertNull("getCertPath() must return null", tE.getCertPath());
        assertEquals("getIndex() must be -1", tE.getIndex(), -1);
    } 
 
    /** 
     * Test for 
     * <code>CertPathValidatorException(String, Throwable, CertPath, int)</code> 
     * constructor Assertion: constructs CertPathValidatorException when 
     * <code>cause</code> is null <code>msg</code> is null 
     * <code>certPath</code> is null <code>index</code> not -1 throws: 
     * IllegalArgumentException 
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getCause, getMessage, getCertPath, getIndex
     * constructor Assertion: constructs CertPathValidatorException when 
     * <code>cause</code> is null <code>msg</code> is null 
     * <code>certPath</code> is null <code>index</code> is -1 
     */ 
    public void testCertPathValidatorException10() { 
        CertPathValidatorException tE = new CertPathValidatorException(null,
                null, null, -1); 
        assertNull("getMessage() must return null", tE.getMessage());
        assertNull("getCause() must return null", tE.getCause());
        assertNull("getCertPath() must return null", tE.getCertPath());
        assertEquals("getIndex() must be -1", tE.getIndex(), -1);
    } 
 
    /** 
     * Test for 
     * <code>CertPathValidatorException(String, Throwable, CertPath, int)</code> 
     * constructor Assertion: constructs CertPathValidatorException when 
     * <code>cause</code> is null <code>msg</code> is null 
     * <code>certPath</code> is null <code>index</code> not -1 throws: 
     * IllegalArgumentException 
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getCertPath, getIndex
        THROWABLE_COMPARATOR.assertDeserialized(oref, otest);
 
        // class specific checks 
        CertPathValidatorException ref = (CertPathValidatorException) oref;
        CertPathValidatorException test = (CertPathValidatorException) otest;
        CertPath cp = ref.getCertPath();
        int ind = ref.getIndex();
        assertEquals("Incorrect index", test.getIndex(), ind);
        if (cp == null) {
            assertNull("getCertPath() must return null", test.getCertPath());
        } else { 
            CertPath res = test.getCertPath();
            assertEquals("Incorrect CertPath", res.getClass(), cp.getClass());
        } 
    } 
 
} 
Full Snippet Info
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getCause, getMessage, getCertPath, getIndex
     * constructor Assertion: constructs CertPathValidatorException when 
     * <code>cause</code> is null <code>msg</code> is null 
     * <code>certPath</code> is null <code>index</code> is -1 
     */ 
    public void testCertPathValidatorException10() { 
        CertPathValidatorException tE = new CertPathValidatorException(null,
                null, null, -1); 
        assertNull("getMessage() must return null", tE.getMessage());
        assertNull("getCause() must return null", tE.getCause());
        assertNull("getCertPath() must return null", tE.getCertPath());
        assertEquals("getIndex() must be -1", tE.getIndex(), -1);
    } 
 
    /** 
     * Test for 
     * <code>CertPathValidatorException(String, Throwable, CertPath, int)</code> 
     * constructor Assertion: constructs CertPathValidatorException when 
     * <code>cause</code> is null <code>msg</code> is null 
     * <code>certPath</code> is null <code>index</code> not -1 throws: 
     * IllegalArgumentException 
Full Snippet Info
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getCertPath, getIndex
        THROWABLE_COMPARATOR.assertDeserialized(oref, otest);
         
        // class specific checks 
        CertPathValidatorException ref = (CertPathValidatorException) oref;
        CertPathValidatorException test = (CertPathValidatorException) otest;
        CertPath cp = ref.getCertPath();
        int ind = ref.getIndex();
        assertEquals("Incorrect index", test.getIndex(), ind);
        if (cp == null) {
            assertNull("getCertPath() must return null", test.getCertPath());
        } else { 
            CertPath res = test.getCertPath();
            assertEquals("Incorrect CertPath", res.getClass(), cp.getClass());
        } 
    } 
 
    public static void main(String[] args) {
        junit.textui.TestRunner.run(CertPathValidatorExceptionTest.class); 
    } 
} 
Full Snippet Info
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getMessage, getIndex
             
            fail("path accepted when should be rejected");
        } 
        catch (CertPathValidatorException e)
        { 
            assertEquals(index, e.getIndex());
            assertEquals(message, e.getMessage());
        } 
    } 
     
    private void doExceptionTest( 
        String      trustAnchor,
        String[]    certs,
        String[]    crls,
        Set         policies,
        int         index,
        String      message)
        throws Exception 
    { 
        try 
Full Snippet Info
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 
    public void invoke(X509Certificate cert, GSIConstants.CertificateType certType) throws CertPathValidatorException {
        try { 
            cert.checkValidity();
        } catch (CertificateExpiredException e) {
            throw new CertPathValidatorException(
                    "Certificate " + cert.getSubjectDN() + " expired", e);
        } catch (CertificateNotYetValidException e) {
            throw new CertPathValidatorException(
                    "Certificate " + cert.getSubjectDN() + " not yet valid.", e);
        } 
    } 
} 
Full Snippet Info
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        X500Principal caPrincipal = cert.getIssuerX500Principal();
        SigningPolicy policy;
        try { 
            policy = this.policyStore.getSigningPolicy(caPrincipal);
        } catch (CertStoreException e) {
            throw new CertPathValidatorException(e);
        } 
 
        if (policy == null) {
            throw new CertPathValidatorException("No signing policy for " + cert.getIssuerDN());
        } 
 
        boolean valid = policy.isValidSubject(cert.getSubjectX500Principal());
 
        if (!valid) {
            throw new CertPathValidatorException("Certificate " + cert.getSubjectDN()
                    + " violates signing policy for CA " + caPrincipal.getName());
        } 
    } 
 
Full Snippet Info
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
            // check if limited 
            if (ProxyCertificateUtil.isLimitedProxy(certType)) { 
                proxyCertValidator.setLimited(true); 
 
                if (proxyCertValidator.isRejectLimitedProxy()) { 
                    throw new CertPathValidatorException( 
                            "Limited proxy not accepted"); 
                } 
            } 
 
            // set the identity cert 
            if (!ProxyCertificateUtil.isImpersonationProxy(certType)) { 
                proxyCertValidator.setIdentityCert(cert); 
            } 
        } 
    } 
} 
Full Snippet Info
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getMessage
        // JGLOBUS-97 : anonymous clients? 
        CertPath certPath = CertificateUtil.getCertPath(x509Certificates);
        try { 
            this.result = this.validator.engineValidate(certPath, parameters);
        } catch (CertPathValidatorException exception) {
            throw new CertificateException("Path validation failed: " + exception.getMessage(), exception);
        } catch (InvalidAlgorithmParameterException exception) {
            throw new CertificateException("Path validation failed: " + exception.getMessage(), exception);
        } 
    } 
 
    /** 
     * Test if the server is trusted based on the certificate chain. 
     * 
     * @param x509Certificates The certificate chain to test for validity. 
     * @param authType         The authentication type based on the server certificate. 
     * @throws CertificateException If the path validation fails. 
     */ 
    public void checkServerTrusted(X509Certificate[] x509Certificates, String authType)
            throws CertificateException { 
Full Snippet Info
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Java 8 CertPathValidatorException Questions & Answers:

See Code Examples for Java 8 CertPathValidatorException Methods: