final class SslUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) static int |
NOT_ENCRYPTED
data is not encrypted
|
(package private) static int |
NOT_ENOUGH_DATA
Not enough data in buffer to parse the record length
|
(package private) static int |
SSL_CONTENT_TYPE_ALERT
alert
|
(package private) static int |
SSL_CONTENT_TYPE_APPLICATION_DATA
application data
|
(package private) static int |
SSL_CONTENT_TYPE_CHANGE_CIPHER_SPEC
change cipher spec
|
(package private) static int |
SSL_CONTENT_TYPE_EXTENSION_HEARTBEAT
HeartBeat Extension
|
(package private) static int |
SSL_CONTENT_TYPE_HANDSHAKE
handshake
|
(package private) static int |
SSL_RECORD_HEADER_LENGTH
the length of the ssl record header (in bytes)
|
Modifier | Constructor and Description |
---|---|
private |
SslUtils() |
Modifier and Type | Method and Description |
---|---|
private static int |
getEncryptedPacketLength(java.nio.ByteBuffer buffer) |
(package private) static int |
getEncryptedPacketLength(java.nio.ByteBuffer[] buffers,
int offset) |
(package private) static int |
getEncryptedPacketLength(ByteBuf buffer,
int offset)
Return how much bytes can be read out of the encrypted data.
|
(package private) static void |
notifyHandshakeFailure(ChannelHandlerContext ctx,
java.lang.Throwable cause) |
private static short |
shortBE(java.nio.ByteBuffer buffer,
int offset) |
private static short |
shortBE(ByteBuf buffer,
int offset) |
(package private) static ByteBuf |
toBase64(ByteBufAllocator allocator,
ByteBuf src)
Same as
Base64.encode(ByteBuf, boolean) but allows the use of a custom ByteBufAllocator . |
(package private) static javax.net.ssl.SSLHandshakeException |
toSSLHandshakeException(java.lang.Throwable e)
Converts the given exception to a
SSLHandshakeException , if it isn't already. |
private static short |
unsignedByte(byte b) |
private static int |
unsignedShortBE(java.nio.ByteBuffer buffer,
int offset) |
private static int |
unsignedShortBE(ByteBuf buffer,
int offset) |
(package private) static void |
zeroout(ByteBuf buffer)
Fills the
ByteBuf with zero bytes. |
(package private) static void |
zerooutAndRelease(ByteBuf buffer)
Fills the
ByteBuf with zero bytes and releases it. |
static final int SSL_CONTENT_TYPE_CHANGE_CIPHER_SPEC
static final int SSL_CONTENT_TYPE_ALERT
static final int SSL_CONTENT_TYPE_HANDSHAKE
static final int SSL_CONTENT_TYPE_APPLICATION_DATA
static final int SSL_CONTENT_TYPE_EXTENSION_HEARTBEAT
static final int SSL_RECORD_HEADER_LENGTH
static final int NOT_ENOUGH_DATA
static final int NOT_ENCRYPTED
static javax.net.ssl.SSLHandshakeException toSSLHandshakeException(java.lang.Throwable e)
SSLHandshakeException
, if it isn't already.static int getEncryptedPacketLength(ByteBuf buffer, int offset)
ByteBuf
.buffer
- The ByteBuf
to read from. Be aware that it must have at least
SSL_RECORD_HEADER_LENGTH
bytes to read,
otherwise it will throw an IllegalArgumentException
.#SslUtils#NOT_ENOUGH_DATA
if not enough data is present in the
ByteBuf
. This will return NOT_ENCRYPTED
if
the given ByteBuf
is not encrypted at all.java.lang.IllegalArgumentException
- Is thrown if the given ByteBuf
has not at least SSL_RECORD_HEADER_LENGTH
bytes to read.private static int unsignedShortBE(ByteBuf buffer, int offset)
private static short shortBE(ByteBuf buffer, int offset)
private static short unsignedByte(byte b)
private static int unsignedShortBE(java.nio.ByteBuffer buffer, int offset)
private static short shortBE(java.nio.ByteBuffer buffer, int offset)
static int getEncryptedPacketLength(java.nio.ByteBuffer[] buffers, int offset)
private static int getEncryptedPacketLength(java.nio.ByteBuffer buffer)
static void notifyHandshakeFailure(ChannelHandlerContext ctx, java.lang.Throwable cause)
static void zerooutAndRelease(ByteBuf buffer)
ByteBuf
with zero bytes and releases it.static ByteBuf toBase64(ByteBufAllocator allocator, ByteBuf src)
Base64.encode(ByteBuf, boolean)
but allows the use of a custom ByteBufAllocator
.Base64.encode(ByteBuf, boolean)