Class SignatureHandler
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<I>
org.drasyl.peer.connection.handler.SimpleChannelDuplexHandler<Message,Message>
org.drasyl.peer.connection.handler.SignatureHandler
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelInboundHandler
,io.netty.channel.ChannelOutboundHandler
Acts as a guard for in- and outbound messages.
Signs automatically outbound messages.
Validates automatically inbound messages and drops them, iff a signature is invalid or if a validation is impossible, e.g. the public key of the sender is unknown. In this case, drop information is written to the log.
Signs automatically outbound messages.
Validates automatically inbound messages and drops them, iff a signature is invalid or if a validation is impossible, e.g. the public key of the sender is unknown. In this case, drop information is written to the log.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
channelRead0
(io.netty.channel.ChannelHandlerContext ctx, Message msg) Is called for each message of typeSimpleChannelDuplexHandler
on inbound channel.protected void
channelWrite0
(io.netty.channel.ChannelHandlerContext ctx, Message msg, io.netty.channel.ChannelPromise promise) Is called for each message of typeSimpleChannelDuplexHandler
on the outbound channel.Methods inherited from class org.drasyl.peer.connection.handler.SimpleChannelDuplexHandler
acceptOutboundMessage, bind, close, connect, deregister, disconnect, flush, read, write
Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelRead
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
Field Details
-
SIGNATURE_HANDLER
- See Also:
-
-
Constructor Details
-
SignatureHandler
-
-
Method Details
-
channelRead0
Description copied from class:SimpleChannelDuplexHandler
Is called for each message of typeSimpleChannelDuplexHandler
on inbound channel.- Specified by:
channelRead0
in classSimpleChannelDuplexHandler<Message,
Message> - Parameters:
ctx
- theChannelHandlerContext
which thisSimpleChannelDuplexHandler
belongs tomsg
- the message to handle
-
channelWrite0
protected void channelWrite0(io.netty.channel.ChannelHandlerContext ctx, Message msg, io.netty.channel.ChannelPromise promise) Description copied from class:SimpleChannelDuplexHandler
Is called for each message of typeSimpleChannelDuplexHandler
on the outbound channel.- Specified by:
channelWrite0
in classSimpleChannelDuplexHandler<Message,
Message> - Parameters:
ctx
- theChannelHandlerContext
which thisSimpleChannelDuplexHandler
belongs tomsg
- the message to handlepromise
- the corresponding promise
-