Search in sources :

Example 16 with CertificateException

use of javax.security.cert.CertificateException in project XobotOS by xamarin.

the class OpenSSLSessionImpl method createPeerCertificateChain.

/**
     * Provide a value to initialize the volatile peerCertificateChain
     * field based on the native SSL_SESSION
     */
private javax.security.cert.X509Certificate[] createPeerCertificateChain() throws SSLPeerUnverifiedException {
    try {
        javax.security.cert.X509Certificate[] chain = new javax.security.cert.X509Certificate[peerCertificates.length];
        for (int i = 0; i < peerCertificates.length; i++) {
            byte[] encoded = peerCertificates[i].getEncoded();
            chain[i] = javax.security.cert.X509Certificate.getInstance(encoded);
        }
        return chain;
    } catch (CertificateEncodingException e) {
        SSLPeerUnverifiedException exception = new SSLPeerUnverifiedException(e.getMessage());
        exception.initCause(exception);
        throw exception;
    } catch (CertificateException e) {
        SSLPeerUnverifiedException exception = new SSLPeerUnverifiedException(e.getMessage());
        exception.initCause(exception);
        throw exception;
    }
}
Also used : SSLPeerUnverifiedException(javax.net.ssl.SSLPeerUnverifiedException) CertificateEncodingException(java.security.cert.CertificateEncodingException) CertificateException(javax.security.cert.CertificateException) X509Certificate(java.security.cert.X509Certificate)

Example 17 with CertificateException

use of javax.security.cert.CertificateException in project robovm by robovm.

the class OpenSSLSessionImpl method createPeerCertificateChain.

/**
     * Provide a value to initialize the volatile peerCertificateChain
     * field based on the native SSL_SESSION
     */
private javax.security.cert.X509Certificate[] createPeerCertificateChain() throws SSLPeerUnverifiedException {
    try {
        javax.security.cert.X509Certificate[] chain = new javax.security.cert.X509Certificate[peerCertificates.length];
        for (int i = 0; i < peerCertificates.length; i++) {
            byte[] encoded = peerCertificates[i].getEncoded();
            chain[i] = javax.security.cert.X509Certificate.getInstance(encoded);
        }
        return chain;
    } catch (CertificateEncodingException e) {
        SSLPeerUnverifiedException exception = new SSLPeerUnverifiedException(e.getMessage());
        exception.initCause(exception);
        throw exception;
    } catch (CertificateException e) {
        SSLPeerUnverifiedException exception = new SSLPeerUnverifiedException(e.getMessage());
        exception.initCause(exception);
        throw exception;
    }
}
Also used : SSLPeerUnverifiedException(javax.net.ssl.SSLPeerUnverifiedException) CertificateEncodingException(java.security.cert.CertificateEncodingException) CertificateException(javax.security.cert.CertificateException) X509Certificate(java.security.cert.X509Certificate)

Aggregations

CertificateException (javax.security.cert.CertificateException)17 CertificateEncodingException (java.security.cert.CertificateEncodingException)3 X509Certificate (java.security.cert.X509Certificate)3 CertificateEncodingException (javax.security.cert.CertificateEncodingException)3 X509Certificate (javax.security.cert.X509Certificate)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 IOException (java.io.IOException)2 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 NoSuchProviderException (java.security.NoSuchProviderException)2 PublicKey (java.security.PublicKey)2 LinkedHashMap (java.util.LinkedHashMap)2 SSLPeerUnverifiedException (javax.net.ssl.SSLPeerUnverifiedException)2 Attribute (cz.metacentrum.perun.core.api.Attribute)1 AttributeNotExistsException (cz.metacentrum.perun.core.api.exceptions.AttributeNotExistsException)1 InternalErrorException (cz.metacentrum.perun.core.api.exceptions.InternalErrorException)1 WrongAttributeValueException (cz.metacentrum.perun.core.api.exceptions.WrongAttributeValueException)1 SideEffect (dalvik.annotation.SideEffect)1 TpmModuleException (gov.niarl.his.privacyca.TpmModule.TpmModuleException)1 IHisPrivacyCAWebService2 (gov.niarl.his.webservices.hisPrivacyCAWebService2.IHisPrivacyCAWebService2)1 BasicSSLSessionInfo (io.undertow.server.BasicSSLSessionInfo)1