Class SignedBabelMessage<T extends BabelMessage>
java.lang.Object
pt.unl.fct.di.novasys.babel2.channels.SignedBabelMessage<T>
- Type Parameters:
T- the type of the inner message payload
- All Implemented Interfaces:
BabelMessage
public final class SignedBabelMessage<T extends BabelMessage>
extends Object
implements BabelMessage
Wrapper for a
BabelMessage that optionally carries a cryptographic signature
and the identity of the sending node.
A signed message encapsulates an inner payload of type T alongside
the BabelNode sender and its digital signature bytes. If the message
is unsigned, both the sender and signature are null. Invariant: either both
sender and signature are null, or both are non-null.
-
Constructor Summary
ConstructorsConstructorDescriptionSignedBabelMessage(T innerMessage) Constructs an unsigned wrapper around the specified inner message payload.SignedBabelMessage(T innerMessage, @Nullable BabelNode sender, @Nullable byte[] signature) Constructs a signed or unsigned message wrapper. -
Method Summary
-
Constructor Details
-
SignedBabelMessage
Constructs an unsigned wrapper around the specified inner message payload.- Parameters:
innerMessage- the message payload to wrap
-
SignedBabelMessage
Constructs a signed or unsigned message wrapper.- Parameters:
innerMessage- the message payload to wrapsender- the sender identity, ornullif unsignedsignature- the digital signature bytes, ornullif unsigned- Throws:
IllegalArgumentException- if one of sender or signature is null while the other is non-null
-
-
Method Details
-
hashCode
-
equals
-
innerMessage
Returns the encapsulated inner message payload.- Returns:
- the inner message payload
-
sender
Returns the identity of the node that sent and signed this message, ornullif this message is unsigned.- Returns:
- the sender node identity, or
null
-