org.apache.mina.transport.nio

## Class SslHelper

- java.lang.Object
- - org.apache.mina.transport.nio.SslHelper

    public class SslHelper
    extends Object

An helper class used to manage everything related to SSL/TLS establishment and management.

Author:
  Apache MINA Project

### Field Summary

Fields
`static AttributeKey<Boolean>` `NEED_CLIENT_AUTH`
`static AttributeKey<InetSocketAddress>` `PEER_ADDRESS` A session attribute key that should be set to an `InetSocketAddress`.
`static AttributeKey<Boolean>` `WANT_CLIENT_AUTH`

### Constructor Summary

Constructors
Constructor and Description
`SslHelper(IoSession session, SSLContext sslContext)` Create a new SSL Handler.

### Method Summary

Methods
`void` `init()` Initialize the SSL handshake.
`void` `processRead(AbstractIoSession session, ByteBuffer readBuffer)` Process a read ByteBuffer over a secured connection, or during the SSL/TLS Handshake.

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

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

### Field Detail

#### PEER_ADDRESS

    public static final AttributeKey<InetSocketAddress> PEER_ADDRESS

A session attribute key that should be set to an `InetSocketAddress`. Setting this attribute causes `SSLContext.createSSLEngine(String, int)` to be called passing the hostname and port of the `InetSocketAddress` to get an `SSLEngine` instance. If not set `SSLContext.createSSLEngine()` will be called.
Using this feature `SSLSession` objects may be cached and reused when in client mode.

See Also:
  `SSLContext.createSSLEngine(String, int)`

#### WANT_CLIENT_AUTH

    public static final AttributeKey<Boolean> WANT_CLIENT_AUTH

#### NEED_CLIENT_AUTH

    public static final AttributeKey<Boolean> NEED_CLIENT_AUTH

### Constructor Detail

#### SslHelper

    public SslHelper(IoSession session,
             SSLContext sslContext)

Create a new SSL Handler.

Parameters:
  `session` - The associated session

### Method Detail

#### init

    public void init()

Initialize the SSL handshake.

#### processRead

    public void processRead(AbstractIoSession session,
                   ByteBuffer readBuffer)
                     throws SSLException

Process a read ByteBuffer over a secured connection, or during the SSL/TLS Handshake.

Parameters:
  `session` - The session we are processing a read for
  `readBuffer` - The data we get from the channel
Throws:
  `SSLException` - If the unwrapping or handshaking failed