Class FullSignedBabelMessageSerializer<T extends BabelMessage>

java.lang.Object
pt.unl.fct.di.novasys.babel2.channels.BasicSignedBabelMessageSerializer<T>
pt.unl.fct.di.novasys.babel2.channels.FullSignedBabelMessageSerializer<T>
Type Parameters:
T - the type of the inner BabelMessage
All Implemented Interfaces:
BabelNetworkMessageSerializer<SignedBabelMessage<T>>, BabelNetworkSerializer<SignedBabelMessage<T>>

public class FullSignedBabelMessageSerializer<T extends BabelMessage> extends BasicSignedBabelMessageSerializer<T>
Extended serializer for SignedBabelMessage instances capable of both signing outgoing messages and forwarding already-signed messages.

When serializing an unsigned message (where SignedBabelMessage.signature() is null), this serializer uses the local PrivateKey and BabelNode identity to compute a digital signature over the serialized inner message bytes and appends the sender and signature to the output buffer. If the message already possesses a signature and sender, they are forwarded directly. Deserialization and verification behavior are inherited from BasicSignedBabelMessageSerializer.

  • Constructor Details

    • FullSignedBabelMessageSerializer

      public FullSignedBabelMessageSerializer(PrivateKey key, BabelNode myself, BabelNetworkMessageSerializer<T> innerSerializer)
      Constructs a full signed message serializer with explicit private key and local node identity.
      Parameters:
      key - the private key used to compute signatures
      myself - the local node identity
      innerSerializer - the delegate serializer for the inner message
    • FullSignedBabelMessageSerializer

      public FullSignedBabelMessageSerializer(BabelNetworkMessageSerializer<T> innerSerializer, Babel runtime)
      Constructs a full signed message serializer by extracting the private key and local identity from the active Babel runtime.
      Parameters:
      innerSerializer - the delegate serializer for the inner message
      runtime - the Babel runtime containing node identity and key pair
  • Method Details