# Class OpenSSLContext

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

All Implemented Interfaces:
  `SSLContext`

public class OpenSSLContext extends Object implements SSLContext

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `OpenSSLContext(SSLHostConfigCertificate certificate, List<String> negotiableProtocols)`

- ## Method Summary

  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)`
  `SSLEngine`
  `createSSLEngine()`
  `void`
  `destroy()`
  `X509Certificate[]`
  `getAcceptedIssuers()`
  `X509Certificate[]`
  `getCertificateChain(String alias)`
  `String`
  `getEnabledProtocol()`
  `SSLSessionContext`
  `getServerSessionContext()`
  `SSLServerSocketFactory`
  `getServerSocketFactory()`
  `SSLParameters`
  `getSupportedSSLParameters()`
  `void`
  `init(KeyManager[] kms, TrustManager[] tms, SecureRandom sr)`
  Setup the SSL_CTX.
  `void`
  `setEnabledProtocol(String protocol)`

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### OpenSSLContext

    public OpenSSLContext(SSLHostConfigCertificate certificate, List<String> negotiableProtocols) throws SSLException
    Throws:
      `SSLException`

- ## Method Details

  - ### getEnabledProtocol

    public String getEnabledProtocol()

  - ### setEnabledProtocol

    public void setEnabledProtocol(String protocol)

  - ### destroy

    public void destroy()
    Specified by:
      `destroy` in interface `SSLContext`

  - ### checkConf

    protected static boolean checkConf(OpenSSLConf conf, long cctx) throws Exception
    Throws:
      `Exception`

  - ### applyConf

    protected static boolean applyConf(OpenSSLConf conf, long cctx, long ctx) throws Exception
    Throws:
      `Exception`

  - ### init

    public void init(KeyManager[] kms, TrustManager[] tms, SecureRandom sr) throws KeyManagementException
    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.
    Throws:
      `KeyManagementException` - if an error occurs

  - ### addCertificate

    public void addCertificate(SSLHostConfigCertificate certificate) throws Exception
    Throws:
      `Exception`

  - ### getServerSessionContext

    public SSLSessionContext getServerSessionContext()
    Specified by:
      `getServerSessionContext` in interface `SSLContext`

  - ### createSSLEngine

    public SSLEngine createSSLEngine()
    Specified by:
      `createSSLEngine` in interface `SSLContext`

  - ### getServerSocketFactory

    public SSLServerSocketFactory getServerSocketFactory()
    Specified by:
      `getServerSocketFactory` in interface `SSLContext`

  - ### getSupportedSSLParameters

    public SSLParameters getSupportedSSLParameters()
    Specified by:
      `getSupportedSSLParameters` in interface `SSLContext`

  - ### getCertificateChain

    public X509Certificate[] getCertificateChain(String alias)
    Specified by:
      `getCertificateChain` in interface `SSLContext`

  - ### getAcceptedIssuers

    public X509Certificate[] getAcceptedIssuers()
    Specified by:
      `getAcceptedIssuers` in interface `SSLContext`