final class SslUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
SSL_CONTENT_TYPE_ALERT
alert
|
static int |
SSL_CONTENT_TYPE_APPLICATION_DATA
application data
|
static int |
SSL_CONTENT_TYPE_CHANGE_CIPHER_SPEC
change cipher spec
|
static int |
SSL_CONTENT_TYPE_HANDSHAKE
handshake
|
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 |
---|---|
(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) |
(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 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. |
public static final int SSL_CONTENT_TYPE_CHANGE_CIPHER_SPEC
public static final int SSL_CONTENT_TYPE_ALERT
public static final int SSL_CONTENT_TYPE_HANDSHAKE
public static final int SSL_CONTENT_TYPE_APPLICATION_DATA
public static final int SSL_RECORD_HEADER_LENGTH
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
.-1
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.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)