- java.lang.Object
-
- io.netty5.handler.ssl.SslMasterKeyHandler
-
- All Implemented Interfaces:
ChannelHandler
public abstract class SslMasterKeyHandler extends Object implements ChannelHandler
TheSslMasterKeyHandleris 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 theSslMasterKeyHandler.WiresharkSslMasterKeyHandlerimplementation will log the secret & identifier in a format that is consumable by Wireshark -- allowing easy decryption of pcap/tcpdumps.
-
-
Field Summary
Fields Modifier and Type Field Description static StringSYSTEM_PROP_KEYA system property that can be used to turn on/off theSslMasterKeyHandlerdynamically without having to edit your pipeline.
-
Constructor Summary
Constructors Modifier Constructor Description protectedSslMasterKeyHandler()Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidaccept(SecretKey masterKey, SSLSession session)Consume the master key for the session and the sessionIdvoidchannelInboundEvent(ChannelHandlerContext ctx, Object evt)Gets called if a custom inbound event happened.static voidensureSunSslEngineAvailability()Ensure that SSLSessionImpl is available.static booleanisSunSslEngineAvailable()protected booleanmasterKeyHandlerEnabled()Checks if the handler is set up to actually handle/accept the event.static SslMasterKeyHandlernewWireSharkSslMasterKeyHandler()Create aSslMasterKeyHandler.WiresharkSslMasterKeyHandlerinstance.static ThrowablesunSslEngineUnavailabilityCause()Returns the cause of unavailability.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty5.channel.ChannelHandler
bind, channelActive, channelExceptionCaught, channelInactive, channelRead, channelReadComplete, channelRegistered, channelShutdown, channelUnregistered, channelWritabilityChanged, close, connect, deregister, disconnect, flush, handlerAdded, handlerRemoved, isSharable, pendingOutboundBytes, read, register, sendOutboundEvent, shutdown, write
-
-
-
-
Field Detail
-
SYSTEM_PROP_KEY
public static final String SYSTEM_PROP_KEY
A system property that can be used to turn on/off theSslMasterKeyHandlerdynamically without having to edit your pipeline.-Dio.netty5.ssl.masterKeyHandler=true- See Also:
- Constant Field Values
-
-
Method Detail
-
ensureSunSslEngineAvailability
public static void ensureSunSslEngineAvailability()
Ensure that SSLSessionImpl is available.- Throws:
UnsatisfiedLinkError- if unavailable
-
sunSslEngineUnavailabilityCause
public static Throwable sunSslEngineUnavailabilityCause()
Returns the cause of unavailability.- Returns:
- the cause if unavailable.
nullif available.
-
isSunSslEngineAvailable
public static boolean isSunSslEngineAvailable()
-
accept
protected abstract void accept(SecretKey masterKey, SSLSession session)
Consume the master key for the session and the sessionId- Parameters:
masterKey- A 48-byte secret shared between the client and server.session- The current TLS session
-
channelInboundEvent
public final void channelInboundEvent(ChannelHandlerContext ctx, Object evt)
Description copied from interface:ChannelHandlerGets called if a custom inbound event happened.- Specified by:
channelInboundEventin interfaceChannelHandler
-
masterKeyHandlerEnabled
protected boolean masterKeyHandlerEnabled()
Checks if the handler is set up to actually handle/accept the event. By default theSYSTEM_PROP_KEYproperty is checked, but any implementations of this class are free to override if they have different mechanisms of checking.- Returns:
- true if it should handle, false otherwise.
-
newWireSharkSslMasterKeyHandler
public static SslMasterKeyHandler newWireSharkSslMasterKeyHandler()
Create aSslMasterKeyHandler.WiresharkSslMasterKeyHandlerinstance. 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'.
-
-