org.apache.commons.ssl

## Class JavaImpl

- java.lang.Object
- - org.apache.commons.ssl.JavaImpl

Direct Known Subclasses:
  Java13, Java14

    public abstract class JavaImpl
    extends java.lang.Object

Since:
  30-Jun-2006
Author:
  Credit Union Central of British Columbia, www.cucbc.com, juliusdavies@cucbc.com

### Field Summary

Fields
`private static JavaImpl` `HANDLER`

### Constructor Summary

Constructors
Constructor and Description
`JavaImpl()`

### Method Summary

Methods
`protected abstract java.lang.Object` `buildKeyManagerFactory(java.security.KeyStore ks, char[] pass)`
`protected abstract java.net.Socket` `buildPlainSocket(SSL ssl, java.lang.String remoteHost, int remotePort, java.net.InetAddress localHost, int localPort, int connectTimeout)`
`protected abstract java.lang.RuntimeException` `buildRuntimeException(java.lang.Exception cause)`
`protected abstract javax.net.ssl.SSLServerSocket` `buildServerSocket(SSL ssl)`
`protected abstract javax.net.ssl.SSLSocket` `buildSocket(SSL ssl)`
`protected abstract javax.net.ssl.SSLSocket` `buildSocket(SSL ssl, java.lang.String remoteHost, int remotePort, java.net.InetAddress localHost, int localPort, int connectTimeout)`
`protected abstract javax.net.ssl.SSLServerSocketFactory` `buildSSLServerSocketFactory(java.lang.Object ssl)`
`protected abstract javax.net.ssl.SSLSocketFactory` `buildSSLSocketFactory(java.lang.Object ssl)`
`protected abstract java.lang.Object` `buildTrustManagerFactory(java.security.KeyStore ks)`
`protected abstract void` `checkTrusted(java.lang.Object trustManager, java.security.cert.X509Certificate[] chain, java.lang.String authType)`
`protected static java.net.Socket` `connect(java.net.Socket s, javax.net.SocketFactory sf, java.lang.String remoteHost, int remotePort, java.net.InetAddress localHost, int localPort, int timeout, SSL ssl)`
`protected abstract java.net.Socket` `connectSocket(java.net.Socket s, javax.net.SocketFactory sf, java.lang.String remoteHost, int remotePort, java.net.InetAddress localHost, int localPort, int timeout, SSL ssl)`
`static java.net.Socket` `createPlainSocket(SSL ssl, java.lang.String remoteHost, int remotePort, java.net.InetAddress localHost, int localPort, int connectTimeout)`
`static javax.net.ssl.SSLServerSocket` `createServerSocket(SSL ssl)`
`static javax.net.ssl.SSLSocket` `createSocket(SSL ssl)`
`static javax.net.ssl.SSLSocket` `createSocket(SSL ssl, java.lang.String remoteHost, int remotePort, java.net.InetAddress localHost, int localPort, int connectTimeout)`
`static void` `downgrade()`
`protected abstract void` `enabledProtocols(java.lang.Object o, java.lang.String[] enabledProtocols)`
`static java.lang.String` `getIssuerX500(java.security.cert.X509Certificate cert)`
`static java.lang.Object[]` `getKeyManagers(java.lang.Object keyManagerFactory)`
`static java.security.cert.Certificate[]` `getPeerCertificates(javax.net.ssl.SSLSession session)`
`static javax.net.ssl.SSLServerSocketFactory` `getSSLServerSocketFactory(java.lang.Object sslContext)`
`static javax.net.ssl.SSLSocketFactory` `getSSLSocketFactory(java.lang.Object sslContext)`
`static java.lang.String` `getSubjectX500(java.security.cert.X509Certificate cert)`
`static java.lang.Object[]` `getTrustManagers(java.lang.Object trustManagerFactory)`
`abstract java.lang.String` `getVersion()`
`static java.lang.Object` `init(SSL ssl, TrustChain trustChain, KeyMaterial keyMaterial)`
`protected abstract java.lang.Object` `initSSL(SSL ssl, TrustChain tc, KeyMaterial km)`
`static boolean` `isJava13()`
`static void` `load()`
`static java.lang.Object` `newKeyManagerFactory(java.security.KeyStore ks, char[] password)`
`static java.lang.RuntimeException` `newRuntimeException(java.lang.Exception cause)`
`static java.lang.Object` `newTrustManagerFactory(java.security.KeyStore ks)`
`protected abstract java.lang.String` `retrieveIssuerX500(java.security.cert.X509Certificate cert)`
`protected abstract java.lang.Object[]` `retrieveKeyManagers(java.lang.Object keyManagerFactory)`
`protected abstract java.security.cert.Certificate[]` `retrievePeerCerts(javax.net.ssl.SSLSession sslSession)`
`protected abstract java.lang.String` `retrieveSubjectX500(java.security.cert.X509Certificate cert)`
`protected abstract java.lang.Object[]` `retrieveTrustManagers(java.lang.Object trustManagerFactory)`
`static void` `setEnabledProtocols(java.lang.Object o, java.lang.String[] enabledProtocols)`
`static void` `setWantClientAuth(java.lang.Object o, boolean wantClientAuth)`
`static void` `testTrust(java.lang.Object trustManager, java.security.cert.X509Certificate[] chain, java.lang.String authType)`
`static void` `uprade()`
`protected abstract void` `wantClientAuth(java.lang.Object o, boolean wantClientAuth)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### HANDLER

    private static JavaImpl HANDLER

### Constructor Detail

#### JavaImpl

    public JavaImpl()

### Method Detail

#### downgrade

    public static void downgrade()

#### isJava13

    public static boolean isJava13()

#### uprade

    public static void uprade()

#### getVersion

    public abstract java.lang.String getVersion()

#### buildKeyManagerFactory

    protected abstract java.lang.Object buildKeyManagerFactory(java.security.KeyStore ks,
                                          char[] pass)
                                                        throws java.security.NoSuchAlgorithmException,
                                                               java.security.KeyStoreException,
                                                               java.security.UnrecoverableKeyException

Throws:
  `java.security.NoSuchAlgorithmException`
  `java.security.KeyStoreException`
  `java.security.UnrecoverableKeyException`

#### retrieveKeyManagers

    protected abstract java.lang.Object[] retrieveKeyManagers(java.lang.Object keyManagerFactory)

#### buildTrustManagerFactory

    protected abstract java.lang.Object buildTrustManagerFactory(java.security.KeyStore ks)
                                                          throws java.security.NoSuchAlgorithmException,
                                                                 java.security.KeyStoreException

Throws:
  `java.security.NoSuchAlgorithmException`
  `java.security.KeyStoreException`

#### retrieveTrustManagers

    protected abstract java.lang.Object[] retrieveTrustManagers(java.lang.Object trustManagerFactory)

#### retrieveSubjectX500

    protected abstract java.lang.String retrieveSubjectX500(java.security.cert.X509Certificate cert)

#### retrieveIssuerX500

    protected abstract java.lang.String retrieveIssuerX500(java.security.cert.X509Certificate cert)

#### retrievePeerCerts

    protected abstract java.security.cert.Certificate[] retrievePeerCerts(javax.net.ssl.SSLSession sslSession)
                                                                   throws javax.net.ssl.SSLPeerUnverifiedException

Throws:
  `javax.net.ssl.SSLPeerUnverifiedException`

#### buildSSLSocketFactory

    protected abstract javax.net.ssl.SSLSocketFactory buildSSLSocketFactory(java.lang.Object ssl)

#### buildSSLServerSocketFactory

    protected abstract javax.net.ssl.SSLServerSocketFactory buildSSLServerSocketFactory(java.lang.Object ssl)

#### buildSocket

    protected abstract javax.net.ssl.SSLSocket buildSocket(SSL ssl)
                                                    throws java.io.IOException

Throws:
  `java.io.IOException`

#### buildSocket

    protected abstract javax.net.ssl.SSLSocket buildSocket(SSL ssl,
                                      java.lang.String remoteHost,
                                      int remotePort,
                                      java.net.InetAddress localHost,
                                      int localPort,
                                      int connectTimeout)
                                                    throws java.io.IOException

Throws:
  `java.io.IOException`

#### buildPlainSocket

    protected abstract java.net.Socket buildPlainSocket(SSL ssl,
                                   java.lang.String remoteHost,
                                   int remotePort,
                                   java.net.InetAddress localHost,
                                   int localPort,
                                   int connectTimeout)
                                                 throws java.io.IOException

Throws:
  `java.io.IOException`

#### connectSocket

    protected abstract java.net.Socket connectSocket(java.net.Socket s,
                                javax.net.SocketFactory sf,
                                java.lang.String remoteHost,
                                int remotePort,
                                java.net.InetAddress localHost,
                                int localPort,
                                int timeout,
                                SSL ssl)
                                              throws java.io.IOException

Throws:
  `java.io.IOException`

#### buildServerSocket

    protected abstract javax.net.ssl.SSLServerSocket buildServerSocket(SSL ssl)
                                                                throws java.io.IOException

Throws:
  `java.io.IOException`

#### wantClientAuth

    protected abstract void wantClientAuth(java.lang.Object o,
                      boolean wantClientAuth)

#### enabledProtocols

    protected abstract void enabledProtocols(java.lang.Object o,
                        java.lang.String[] enabledProtocols)

#### buildRuntimeException

    protected abstract java.lang.RuntimeException buildRuntimeException(java.lang.Exception cause)

#### initSSL

    protected abstract java.lang.Object initSSL(SSL ssl,
                           TrustChain tc,
                           KeyMaterial km)
                                         throws java.security.NoSuchAlgorithmException,
                                                java.security.KeyStoreException,
                                                java.security.cert.CertificateException,
                                                java.security.KeyManagementException,
                                                java.io.IOException

Throws:
  `java.security.NoSuchAlgorithmException`
  `java.security.KeyStoreException`
  `java.security.cert.CertificateException`
  `java.security.KeyManagementException`
  `java.io.IOException`

#### checkTrusted

    protected abstract void checkTrusted(java.lang.Object trustManager,
                    java.security.cert.X509Certificate[] chain,
                    java.lang.String authType)
                                  throws java.security.cert.CertificateException

Throws:
  `java.security.cert.CertificateException`

#### init

    public static java.lang.Object init(SSL ssl,
                        TrustChain trustChain,
                        KeyMaterial keyMaterial)
                                 throws java.security.NoSuchAlgorithmException,
                                        java.security.KeyStoreException,
                                        java.security.cert.CertificateException,
                                        java.security.KeyManagementException,
                                        java.io.IOException

Throws:
  `java.security.NoSuchAlgorithmException`
  `java.security.KeyStoreException`
  `java.security.cert.CertificateException`
  `java.security.KeyManagementException`
  `java.io.IOException`

#### newRuntimeException

    public static java.lang.RuntimeException newRuntimeException(java.lang.Exception cause)

#### getSSLSocketFactory

    public static javax.net.ssl.SSLSocketFactory getSSLSocketFactory(java.lang.Object sslContext)

#### getSSLServerSocketFactory

    public static javax.net.ssl.SSLServerSocketFactory getSSLServerSocketFactory(java.lang.Object sslContext)

#### getSubjectX500

    public static java.lang.String getSubjectX500(java.security.cert.X509Certificate cert)

#### getIssuerX500

    public static java.lang.String getIssuerX500(java.security.cert.X509Certificate cert)

#### newKeyManagerFactory

    public static java.lang.Object newKeyManagerFactory(java.security.KeyStore ks,
                                        char[] password)
                                                 throws java.security.NoSuchAlgorithmException,
                                                        java.security.KeyStoreException,
                                                        java.security.UnrecoverableKeyException

Throws:
  `java.security.NoSuchAlgorithmException`
  `java.security.KeyStoreException`
  `java.security.UnrecoverableKeyException`

#### getKeyManagers

    public static java.lang.Object[] getKeyManagers(java.lang.Object keyManagerFactory)

#### newTrustManagerFactory

    public static java.lang.Object newTrustManagerFactory(java.security.KeyStore ks)
                                                   throws java.security.NoSuchAlgorithmException,
                                                          java.security.KeyStoreException

Throws:
  `java.security.NoSuchAlgorithmException`
  `java.security.KeyStoreException`

#### getTrustManagers

    public static java.lang.Object[] getTrustManagers(java.lang.Object trustManagerFactory)

#### createSocket

    public static javax.net.ssl.SSLSocket createSocket(SSL ssl)
                                                throws java.io.IOException

Throws:
  `java.io.IOException`

#### createSocket

    public static javax.net.ssl.SSLSocket createSocket(SSL ssl,
                                       java.lang.String remoteHost,
                                       int remotePort,
                                       java.net.InetAddress localHost,
                                       int localPort,
                                       int connectTimeout)
                                                throws java.io.IOException

Throws:
  `java.io.IOException`

#### createPlainSocket

    public static java.net.Socket createPlainSocket(SSL ssl,
                                    java.lang.String remoteHost,
                                    int remotePort,
                                    java.net.InetAddress localHost,
                                    int localPort,
                                    int connectTimeout)
                                             throws java.io.IOException

Throws:
  `java.io.IOException`

#### connect

    protected static java.net.Socket connect(java.net.Socket s,
                          javax.net.SocketFactory sf,
                          java.lang.String remoteHost,
                          int remotePort,
                          java.net.InetAddress localHost,
                          int localPort,
                          int timeout,
                          SSL ssl)
                                      throws java.io.IOException

Throws:
  `java.io.IOException`

#### createServerSocket

    public static javax.net.ssl.SSLServerSocket createServerSocket(SSL ssl)
                                                            throws java.io.IOException

Throws:
  `java.io.IOException`

#### setWantClientAuth

    public static void setWantClientAuth(java.lang.Object o,
                         boolean wantClientAuth)

#### setEnabledProtocols

    public static void setEnabledProtocols(java.lang.Object o,
                           java.lang.String[] enabledProtocols)

#### getPeerCertificates

    public static java.security.cert.Certificate[] getPeerCertificates(javax.net.ssl.SSLSession session)
                                                                throws javax.net.ssl.SSLPeerUnverifiedException

Throws:
  `javax.net.ssl.SSLPeerUnverifiedException`

#### testTrust

    public static void testTrust(java.lang.Object trustManager,
                 java.security.cert.X509Certificate[] chain,
                 java.lang.String authType)
                          throws java.security.cert.CertificateException

Throws:
  `java.security.cert.CertificateException`

#### load

    public static void load()