Package org.drasyl.node.handler.crypto
Class AbstractArmHandler
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.ChannelDuplexHandler
io.netty.handler.codec.MessageToMessageCodec<ArmHeader,io.netty.buffer.ByteBuf>
org.drasyl.node.handler.crypto.AbstractArmHandler
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelInboundHandler
,io.netty.channel.ChannelOutboundHandler
- Direct Known Subclasses:
LongTimeArmHandler
,PFSArmHandler
@UnstableApi
public abstract class AbstractArmHandler
extends io.netty.handler.codec.MessageToMessageCodec<ArmHeader,io.netty.buffer.ByteBuf>
Skeleton handler that arms (encrypt) outbound and disarms (decrypt) inbound messages. Messages
that could not be (dis-)armed are dropped.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Crypto
protected final IdentityPublicKey
protected final Session
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractArmHandler
(Crypto crypto, Duration expireAfter, int maxAgreements, Identity identity, IdentityPublicKey peerIdentity) protected
AbstractArmHandler
(Crypto crypto, IdentityPublicKey peerIdentity, Session session) -
Method Summary
Modifier and TypeMethodDescriptionprotected ArmHeader
protected void
protected void
protected abstract Agreement
getAgreement
(AgreementId agreementId) protected abstract void
inboundArmMessage
(io.netty.channel.ChannelHandlerContext ctx, Object msg) protected abstract void
onNonAgreement
(io.netty.channel.ChannelHandlerContext ctx) protected abstract void
removeStaleAgreement
(io.netty.channel.ChannelHandlerContext ctx, Agreement agreement) protected Object
unarm
(io.netty.channel.ChannelHandlerContext ctx, Agreement agreement, Nonce nonce, io.netty.buffer.ByteBuf byteBuf) Methods inherited from class io.netty.handler.codec.MessageToMessageCodec
acceptInboundMessage, acceptOutboundMessage, channelRead, write
Methods inherited from class io.netty.channel.ChannelDuplexHandler
bind, close, connect, deregister, disconnect, flush, read
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
-
crypto
-
peerIdentity
-
session
-
-
Constructor Details
-
AbstractArmHandler
-
AbstractArmHandler
protected AbstractArmHandler(Crypto crypto, Duration expireAfter, int maxAgreements, Identity identity, IdentityPublicKey peerIdentity) throws CryptoException - Throws:
CryptoException
-
-
Method Details
-
encode
-
decode
-
inboundArmMessage
-
onNonAgreement
protected abstract void onNonAgreement(io.netty.channel.ChannelHandlerContext ctx) -
unarm
protected Object unarm(io.netty.channel.ChannelHandlerContext ctx, Agreement agreement, Nonce nonce, io.netty.buffer.ByteBuf byteBuf) throws CryptoException - Throws:
CryptoException
-
arm
protected ArmHeader arm(io.netty.channel.ChannelHandlerContext ctx, Agreement agreement, io.netty.buffer.ByteBuf msg) throws CryptoException - Throws:
CryptoException
-
removeStaleAgreement
protected abstract void removeStaleAgreement(io.netty.channel.ChannelHandlerContext ctx, Agreement agreement) -
getAgreement
-