Top Description Inners Fields Constructors Methods
io.netty5.handler.ssl

public abstract Class SslMasterKeyHandler

extends Object
implements ChannelHandler
Class Inheritance
All Implemented Interfaces
io.netty5.channel.ChannelHandler
Known Direct Subclasses
io.netty5.handler.ssl.SslMasterKeyHandler.WiresharkSslMasterKeyHandler
Imports
io.netty5.buffer.BufferUtil, io.netty5.channel.ChannelHandler, .ChannelHandlerContext, io.netty5.util.internal.ReflectionUtil, .SystemPropertyUtil, io.netty5.util.internal.logging.InternalLogger, .InternalLoggerFactory, javax.crypto.SecretKey, javax.crypto.spec.SecretKeySpec, javax.net.ssl.SSLEngine, .SSLSession, java.lang.reflect.Field

The SslMasterKeyHandler is a channel-handler you can include in your pipeline to consume the master key & session identifier for a TLS session. This can be very useful, for instance the WiresharkSslMasterKeyHandler implementation will log the secret & identifier in a format that is consumable by Wireshark -- allowing easy decryption of pcap/tcpdumps.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
SslMasterKeyHandler.WiresharkSslMasterKeyHandler

Record the session identifier and master key to the InternalLogger named io.netty5.wireshark.

Field Summary

Modifier and TypeField and Description
private static final InternalLogger
private static final Class<?>
SSL_SESSIONIMPL_CLASS

The JRE SSLSessionImpl cannot be imported

private static final Field
SSL_SESSIONIMPL_MASTER_SECRET_FIELD

The master key field in the SSLSessionImpl

public static final String
SYSTEM_PROP_KEY

A system property that can be used to turn on/off the SslMasterKeyHandler dynamically without having to edit your pipeline.

private static final Throwable
UNAVAILABILITY_CAUSE

The unavailability cause of whether the private Sun implementation of SSLSessionImpl is available.

Constructor Summary

AccessConstructor and Description
protected
SslMasterKeyHandler()

Constructor.

Method Summary

Modifier and TypeMethod and Description
protected abstract void
accept(SecretKey
A 48-byte secret shared between the client and server.
masterKey
,
SSLSession
The current TLS session
session
)

Consume the master key for the session and the sessionId

public final void
channelInboundEvent(ChannelHandlerContext ctx, Object evt)

Overrides default io.netty5.channel.ChannelHandler.channelInboundEvent.

Gets called if a custom inbound event happened.
public static void
ensureSunSslEngineAvailability()

Ensure that SSLSessionImpl is available.

public static boolean
protected boolean

Returns:

true if it should handle, false otherwise.
masterKeyHandlerEnabled
()

Checks if the handler is set up to actually handle/accept the event.

public static SslMasterKeyHandler
public static Throwable

Returns:

the cause if unavailable. null if available.
sunSslEngineUnavailabilityCause
()

Returns the cause of unavailability.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

loggerback to summary
private static final InternalLogger logger
SSL_SESSIONIMPL_CLASSback to summary
private static final Class<?> SSL_SESSIONIMPL_CLASS

The JRE SSLSessionImpl cannot be imported

SSL_SESSIONIMPL_MASTER_SECRET_FIELDback to summary
private static final Field SSL_SESSIONIMPL_MASTER_SECRET_FIELD

The master key field in the SSLSessionImpl

SYSTEM_PROP_KEYback to summary
public static final String SYSTEM_PROP_KEY

A system property that can be used to turn on/off the SslMasterKeyHandler dynamically without having to edit your pipeline. -Dio.netty5.ssl.masterKeyHandler=true

UNAVAILABILITY_CAUSEback to summary
private static final Throwable UNAVAILABILITY_CAUSE

The unavailability cause of whether the private Sun implementation of SSLSessionImpl is available.

Constructor Detail

SslMasterKeyHandlerback to summary
protected SslMasterKeyHandler()

Constructor.

Method Detail

acceptback to summary
protected abstract void accept(SecretKey masterKey, SSLSession session)

Consume the master key for the session and the sessionId

Parameters
masterKey:SecretKey

A 48-byte secret shared between the client and server.

session:SSLSession

The current TLS session

channelInboundEventback to summary
public final void channelInboundEvent(ChannelHandlerContext ctx, Object evt)

Overrides default io.netty5.channel.ChannelHandler.channelInboundEvent.

Doc from io.netty5.channel.ChannelHandler.channelInboundEvent.

Gets called if a custom inbound event happened.

Annotations
@Override
ensureSunSslEngineAvailabilityback to summary
public static void ensureSunSslEngineAvailability()

Ensure that SSLSessionImpl is available.

Exceptions
UnsatisfiedLinkError:
if unavailable
isSunSslEngineAvailableback to summary
public static boolean isSunSslEngineAvailable()
masterKeyHandlerEnabledback to summary
protected boolean masterKeyHandlerEnabled()

Checks if the handler is set up to actually handle/accept the event. By default the SYSTEM_PROP_KEY property is checked, but any implementations of this class are free to override if they have different mechanisms of checking.

Returns:boolean

true if it should handle, false otherwise.

newWireSharkSslMasterKeyHandlerback to summary
public static SslMasterKeyHandler newWireSharkSslMasterKeyHandler()

Create a WiresharkSslMasterKeyHandler instance. This TLS master key handler logs the master key and session-id in a format understood by Wireshark -- this can be especially useful if you need to ever decrypt a TLS session and are using perfect forward secrecy (i.e. Diffie-Hellman) The key and session identifier are forwarded to the log named 'io.netty5.wireshark'.

sunSslEngineUnavailabilityCauseback to summary
public static Throwable sunSslEngineUnavailabilityCause()

Returns the cause of unavailability.

Returns:Throwable

the cause if unavailable. null if available.

io.netty5.handler.ssl back to summary

private final Class SslMasterKeyHandler.WiresharkSslMasterKeyHandler

extends SslMasterKeyHandler
Class Inheritance

Record the session identifier and master key to the InternalLogger named io.netty5.wireshark. ex. RSA Session-ID:XXX Master-Key:YYY This format is understood by Wireshark 1.6.0. https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=686d4cabb41185591c361f9ec6b709034317144b The key and session identifier are forwarded to the log named 'io.netty5.wireshark'.

Field Summary

Modifier and TypeField and Description
private static final InternalLogger
Inherited from io.netty5.handler.ssl.SslMasterKeyHandler:
SYSTEM_PROP_KEY

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
protected void
accept(SecretKey
A 48-byte secret shared between the client and server.
masterKey
,
SSLSession
The current TLS session
session
)

Implements abstract io.netty5.handler.ssl.SslMasterKeyHandler.accept.

Consume the master key for the session and the sessionId
Inherited from io.netty5.handler.ssl.SslMasterKeyHandler:
channelInboundEventensureSunSslEngineAvailabilityisSunSslEngineAvailablemasterKeyHandlerEnablednewWireSharkSslMasterKeyHandlersunSslEngineUnavailabilityCause

Field Detail

wireshark_loggerback to summary
private static final InternalLogger wireshark_logger

Constructor Detail

WiresharkSslMasterKeyHandlerback to summary
private WiresharkSslMasterKeyHandler()

Method Detail

acceptback to summary
protected void accept(SecretKey masterKey, SSLSession session)

Implements abstract io.netty5.handler.ssl.SslMasterKeyHandler.accept.

Doc from io.netty5.handler.ssl.SslMasterKeyHandler.accept.

Consume the master key for the session and the sessionId

Parameters
masterKey:SecretKey

A 48-byte secret shared between the client and server.

session:SSLSession

The current TLS session

Annotations
@Override