- All Implemented Interfaces:
RatchetPayload.PayloadCallback
- Enclosing class:
ECIESAEADEngine
Field Summary
Modifier and TypeFieldDescriptionbooleanWhether an ack was requested.final List<GarlicClove> Non-null, may be empty.longThe datetime value.Null or non-empty.private final PublicKeyThe sender's ratchet public key.private final RatchetSKMThe session key manager for the sender.Constructor Summary
ConstructorsConstructorDescriptionNS/NSR.PLCallback(RatchetSKM keyManager, PublicKey remoteKey) Callback for an ES payload, which unlike NS/NSR may carry an ACK to hand back to the ratchet session key manager.Method Summary
All MethodsModifier and TypeMethodDescriptionvoidgotAck(int id, int n) Process an ack field from the payload.voidProcess an ack request field from the payload.voidgotDateTime(long time) Process a datetime field from the payload.voidgotGarlic(GarlicClove clove) Process a garlic clove field from the payload.voidgotNextKey(NextSessionKey next) Process a next key field from the payload.voidgotOptions(byte[] options, boolean isHandshake) Process an options field from the payload.voidgotPadding(int paddingLength, int frameLength) Process a padding field from the payload.voidgotPN(int pn) Process a PN field from the payload.voidgotTermination(int reason) Process a termination field from the payload.voidgotUnknown(int type, int len) Process an unknown field from the payload.
Field Details
cloveSet
Non-null, may be empty.skm
The session key manager for the sender.remote
The sender's ratchet public key.datetime
public long datetimeThe datetime value.nextKeys
Null or non-empty.ackRequested
public boolean ackRequestedWhether an ack was requested.
Constructor Details
PLCallback
public PLCallback()NS/NSR.PLCallback
Callback for an ES payload, which unlike NS/NSR may carry an ACK to hand back to the ratchet session key manager.- Parameters:
keyManager- only for ES, otherwise nullremoteKey- only for ES, otherwise null
Method Details
gotDateTime
Process a datetime field from the payload.- Specified by:
gotDateTimein interfaceRatchetPayload.PayloadCallback- Parameters:
time- the peer's expiry timestamp, in ms since the epoch- Throws:
DataFormatException- on bad data
gotOptions
public void gotOptions(byte[] options, boolean isHandshake) Process an options field from the payload.Intentionally a log-only no-op. This router never emits an OPTIONS block (no option bytes are negotiated in
createPayload()) and no local state transition, tag, session key, or acknowledgement behavior is defined in terms of OPTIONS, so ignoring a received block is protocol-correct. The length and framing are already validated by the parser.- Specified by:
gotOptionsin interfaceRatchetPayload.PayloadCallback- Parameters:
options- the option bytesisHandshake- true only for message 3 part 2
gotGarlic
Process a garlic clove field from the payload.- Specified by:
gotGarlicin interfaceRatchetPayload.PayloadCallback- Parameters:
clove- the garlic clove
gotNextKey
Process a next key field from the payload.- Specified by:
gotNextKeyin interfaceRatchetPayload.PayloadCallback- Parameters:
next- the next one
gotAck
public void gotAck(int id, int n) Process an ack field from the payload.- Specified by:
gotAckin interfaceRatchetPayload.PayloadCallback- Parameters:
id- the key IDn- the message count acknowledged for that key
gotAckRequest
public void gotAckRequest()Process an ack request field from the payload.- Specified by:
gotAckRequestin interfaceRatchetPayload.PayloadCallback
gotTermination
public void gotTermination(int reason) Process a termination field from the payload.Intentionally a log-only no-op. Ratchet sessions here end by ratchet key rotation or by the session expiring in
RatchetSKM.aggressiveExpire(), never by a peer-sent TERMINATION block, and this router never emits one. The parser already rejects any block following a TERMINATION other than padding, so the framing is enforced without acting on the reason.- Specified by:
gotTerminationin interfaceRatchetPayload.PayloadCallback- Parameters:
reason- the peer's termination reason code, 0-255
gotPN
public void gotPN(int pn) Process a PN field from the payload.Intentionally a log-only no-op. The message number block is an optional advisory hint for out-of-order reassembly; ratchet decryption here is authenticated per message and does not dedupe by number, and this router never emits a PN block. Accepting and ignoring it is therefore protocol-correct.
- Specified by:
gotPNin interfaceRatchetPayload.PayloadCallback- Parameters:
pn- the peer's message number, 0-65535
gotUnknown
public void gotUnknown(int type, int len) Process an unknown field from the payload.- Specified by:
gotUnknownin interfaceRatchetPayload.PayloadCallback- Parameters:
type- the block typelen- the block length
gotPadding
public void gotPadding(int paddingLength, int frameLength) Process a padding field from the payload.- Specified by:
gotPaddingin interfaceRatchetPayload.PayloadCallback- Parameters:
paddingLength- the number of padding bytes, not including the 3-byte block headerframeLength- the total size of the frame, including all blocks and block headers