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

This code example shows how to use the following methods:
    throws CertificateException { 
    X509TrustManager tm = trustManagerRef.get();
    if (tm != null) {
      tm.checkClientTrusted(chain, authType);
    } else { 
      throw new CertificateException("Unknown client chain certificate: " +
                                     chain[0].toString());
    } 
  } 
 
  @Override 
  public void checkServerTrusted(X509Certificate[] chain, String authType)
    throws CertificateException { 
    X509TrustManager tm = trustManagerRef.get();
    if (tm != null) {
      tm.checkServerTrusted(chain, authType);
    } else { 
      throw new CertificateException("Unknown server chain certificate: " +
                                     chain[0].toString());
    } 
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:
        throws CertificateException, NoSuchAlgorithmException,  
            SignatureException, InvalidKeyException 
    { 
        if (!isAlgIdEqual(c.getSignatureAlgorithm(), c.getTBSCertificate().getSignature()))
        { 
            throw new CertificateException("signature algorithm in TBS cert not same as outer cert");
        } 
 
        DEREncodable params = c.getSignatureAlgorithm().getParameters();
 
        // TODO This should go after the initVerify? 
        X509SignatureUtil.setSignatureParameters(signature, params);
 
        signature.initVerify(key);
 
        signature.update(this.getTBSCertificate());
 
        if (!signature.verify(this.getSignature()))
        { 
            throw new InvalidKeyException("Public key presented not for certificate signature");
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:getMessage
        { 
            return builder.build(validatingKeyInfo);
        } 
        catch (CertificateException e)
        { 
            throw new OperatorCreationException("Unable to process certificate: " + e.getMessage(), e);
        } 
    } 
} 
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
     * Assertion: constructs CertificateException when <code>cause</code> is 
     * null 
     */ 
    public void testCertificateException04() { 
        Throwable cause = null;
        CertificateException tE = new CertificateException(cause);
        assertNull("getMessage() must return null.", tE.getMessage());
        assertNull("getCause() must return null", tE.getCause());
    } 
 
    /** 
     * Test for <code>CertificateException(Throwable)</code> constructor 
     * Assertion: constructs CertificateException when <code>cause</code> is 
     * not null 
     */ 
    public void testCertificateException05() { 
        CertificateException tE = new CertificateException(tCause);
        if (tE.getMessage() != null) {
            String toS = tCause.toString();
            String getM = tE.getMessage();
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:
            try { 
                // Try Bouncy Castle if the current JVM didn't have sun.security.x509. 
                paths = BouncyCastleSelfSignedCertGenerator.generate(fqdn, keypair, random);
            } catch (Throwable t2) {
                logger.debug("Failed to generate a self-signed X.509 certificate using Bouncy Castle:", t2);
                throw new CertificateException(
                        "No provider succeeded to generate a self-signed certificate. " + 
                                "See debug log for the root cause."); 
            } 
        } 
 
        certificate = new File(paths[0]);
        privateKey = new File(paths[1]);
    } 
 
    /** 
     * Returns the generated X.509 certificate file in PEM format. 
     */ 
    public File certificate() {
        return certificate;
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:printStackTrace
        try { 
            CertificateFactory cf = CertificateFactory.getInstance("X.509");
            caInput = new BufferedInputStream(cert);
            ca = cf.generateCertificate(caInput);
        } catch (CertificateException e1) {
            e1.printStackTrace();
        } finally { 
            try { 
                if (caInput != null) {
                    caInput.close();
                } 
            } catch (IOException e) {
                e.printStackTrace();
            } 
        } 
 
        // Create a KeyStore containing our trusted CAs 
        String keyStoreType = KeyStore.getDefaultType();
        KeyStore keyStore = null;
        try { 
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:getMessage
		} catch (final KeyStoreException e) {
			throw new CLIStatusException(e, CloudifyErrorMessages.INVALID_KEYSTORE_FILE.getName(), e.getMessage());
		} catch (final NoSuchAlgorithmException e) {
			throw new CLIStatusException(e, CloudifyErrorMessages.INVALID_KEYSTORE_FILE.getName(), e.getMessage());
		} catch (final CertificateException e) {
			throw new CLIStatusException(e, CloudifyErrorMessages.INVALID_KEYSTORE_FILE.getName(), e.getMessage());
		} 
	} 
} 
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
     * Assertion: constructs CertificateException when <code>cause</code> is 
     * null 
     */ 
    public void testCertificateException04() { 
        Throwable cause = null;
        CertificateException tE = new CertificateException(cause);
        assertNull("getMessage() must return null.", tE.getMessage());
        assertNull("getCause() must return null", tE.getCause());
    } 
 
    /** 
     * Test for <code>CertificateException(Throwable)</code> constructor 
     * Assertion: constructs CertificateException when <code>cause</code> is 
     * not null 
     */ 
    public void testCertificateException05() { 
        CertificateException tE = new CertificateException(tCause);
        if (tE.getMessage() != null) {
            String toS = tCause.toString();
            String getM = tE.getMessage();
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:
            X509Certificate[] certificateChain;
            try { 
                certificateChain = KeyChain.getCertificateChain(context, alias);
            } catch (KeyChainException e) {
                logError(alias, "certificate chain", e);
                throw new CertificateException(e);
            } catch (InterruptedException e) {
                logError(alias, "certificate chain", e);
                throw new CertificateException(e);
            } 
 
            PrivateKey privateKey;
            try { 
                privateKey = KeyChain.getPrivateKey(context, alias);
            } catch (KeyChainException e) {
                logError(alias, "private key", e);
                throw new CertificateException(e);
            } catch (InterruptedException e) {
                logError(alias, "private key", e);
                throw new CertificateException(e);
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:
        throws CertificateException, NoSuchAlgorithmException,  
            SignatureException, InvalidKeyException 
    { 
        if (!isAlgIdEqual(c.getSignatureAlgorithm(), c.getTBSCertificate().getSignature()))
        { 
            throw new CertificateException("signature algorithm in TBS cert not same as outer cert");
        } 
 
        DEREncodable params = c.getSignatureAlgorithm().getParameters();
 
        // TODO This should go after the initVerify? 
        X509SignatureUtil.setSignatureParameters(signature, params);
 
        signature.initVerify(key);
 
        signature.update(this.getTBSCertificate());
 
        if (!signature.verify(this.getSignature()))
        { 
            throw new InvalidKeyException("Public key presented not for certificate signature");
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Java 8 CertificateException Questions & Answers:

See Code Examples for Java 8 CertificateException Methods: