Package org.apache.tomcat.util.net.openssl

## Class OpenSSLContext

- java.lang.Object
- - org.apache.tomcat.util.net.openssl.OpenSSLContext

- All Implemented Interfaces:
    `SSLContext`

      public class OpenSSLContext
      extends java.lang.Object
      implements SSLContext

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected long` | `cctx` |
    `protected long` | `ctx` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `OpenSSLContext​(SSLHostConfigCertificate certificate, java.util.List<java.lang.String> negotiableProtocols)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addCertificate​(SSLHostConfigCertificate certificate)` |
    `protected static boolean` | `applyConf​(OpenSSLConf conf, long cctx, long ctx)` |
    `protected static boolean` | `checkConf​(OpenSSLConf conf, long cctx)` |
    `javax.net.ssl.SSLEngine` | `createSSLEngine()` |
    `void` | `destroy()` |
    `protected void` | `finalize()` |
    `java.security.cert.X509Certificate[]` | `getAcceptedIssuers()` |
    `java.security.cert.X509Certificate[]` | `getCertificateChain​(java.lang.String alias)` |
    `java.lang.String` | `getEnabledProtocol()` |
    `javax.net.ssl.SSLSessionContext` | `getServerSessionContext()` |
    `javax.net.ssl.SSLServerSocketFactory` | `getServerSocketFactory()` |
    `javax.net.ssl.SSLParameters` | `getSupportedSSLParameters()` |
    `void` | `init​(javax.net.ssl.KeyManager[] kms, javax.net.ssl.TrustManager[] tms, java.security.SecureRandom sr)` | Setup the SSL_CTX.
    `void` | `setEnabledProtocol​(java.lang.String protocol)` |

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

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

- - ### Field Detail

    - #### cctx

          protected final long cctx

    - #### ctx

          protected final long ctx

  - ### Constructor Detail

    - #### OpenSSLContext

          public OpenSSLContext​(SSLHostConfigCertificate certificate,
                                java.util.List<java.lang.String> negotiableProtocols)
                         throws javax.net.ssl.SSLException

      Throws:
        `javax.net.ssl.SSLException`

  - ### Method Detail

    - #### getEnabledProtocol

          public java.lang.String getEnabledProtocol()

    - #### setEnabledProtocol

          public void setEnabledProtocol​(java.lang.String protocol)

    - #### destroy

          public void destroy()

      Specified by:
        `destroy` in interface `SSLContext`

    - #### checkConf

          protected static boolean checkConf​(OpenSSLConf conf,
                                             long cctx)
                                      throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### applyConf

          protected static boolean applyConf​(OpenSSLConf conf,
                                             long cctx,
                                             long ctx)
                                      throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### init

          public void init​(javax.net.ssl.KeyManager[] kms,
                           javax.net.ssl.TrustManager[] tms,
                           java.security.SecureRandom sr)

      Setup the SSL_CTX.
      Specified by:
        `init` in interface `SSLContext`
      Parameters:
        `kms` - Must contain a KeyManager of the type `OpenSSLKeyManager`
        `tms` - Must contain a TrustManager of the type `X509TrustManager`
        `sr` - Is not used for this implementation.

    - #### addCertificate

          public void addCertificate​(SSLHostConfigCertificate certificate)
                              throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### getServerSessionContext

          public javax.net.ssl.SSLSessionContext getServerSessionContext()

      Specified by:
        `getServerSessionContext` in interface `SSLContext`

    - #### createSSLEngine

          public javax.net.ssl.SSLEngine createSSLEngine()

      Specified by:
        `createSSLEngine` in interface `SSLContext`

    - #### getServerSocketFactory

          public javax.net.ssl.SSLServerSocketFactory getServerSocketFactory()

      Specified by:
        `getServerSocketFactory` in interface `SSLContext`

    - #### getSupportedSSLParameters

          public javax.net.ssl.SSLParameters getSupportedSSLParameters()

      Specified by:
        `getSupportedSSLParameters` in interface `SSLContext`

    - #### getCertificateChain

          public java.security.cert.X509Certificate[] getCertificateChain​(java.lang.String alias)

      Specified by:
        `getCertificateChain` in interface `SSLContext`

    - #### getAcceptedIssuers

          public java.security.cert.X509Certificate[] getAcceptedIssuers()

      Specified by:
        `getAcceptedIssuers` in interface `SSLContext`

    - #### finalize

          protected void finalize()
                           throws java.lang.Throwable

      Overrides:
        `finalize` in class `java.lang.Object`
      Throws:
        `java.lang.Throwable`