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
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
FieldsModifier and TypeFieldDescriptionprotected final Cryptoprotected final Identityprotected final IdentityPublicKeyprotected final Session -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractArmHandler(Crypto crypto, Duration expireAfter, int maxAgreements, Identity identity, IdentityPublicKey peerIdentity) protectedAbstractArmHandler(Crypto crypto, Identity identity, IdentityPublicKey peerIdentity, Session session) -
Method Summary
Modifier and TypeMethodDescriptionprotected ArmHeaderprotected voidprotected voidprotected abstract AgreementgetAgreement(AgreementId agreementId) protected abstract voidinboundArmMessage(io.netty.channel.ChannelHandlerContext ctx, Object msg) protected abstract voidonNonAgreement(io.netty.channel.ChannelHandlerContext ctx) protected abstract voidremoveStaleAgreement(io.netty.channel.ChannelHandlerContext ctx, Agreement agreement) protected ObjectMethods inherited from class io.netty.handler.codec.MessageToMessageCodec
acceptInboundMessage, acceptOutboundMessage, channelRead, writeMethods inherited from class io.netty.channel.ChannelDuplexHandler
bind, close, connect, deregister, disconnect, flush, readMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
Field Details
-
crypto
-
identity
-
peerIdentity
-
session
-
-
Constructor Details
-
AbstractArmHandler
protected AbstractArmHandler(Crypto crypto, Identity identity, IdentityPublicKey peerIdentity, Session session) -
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(Agreement agreement, Nonce nonce, io.netty.buffer.ByteBuf byteBuf) throws CryptoException - Throws:
CryptoException
-
arm
- Throws:
CryptoException
-
removeStaleAgreement
protected abstract void removeStaleAgreement(io.netty.channel.ChannelHandlerContext ctx, Agreement agreement) -
getAgreement
-