java.lang.Object
net.i2p.router.crypto.ratchet.RatchetPayload.Block
net.i2p.router.crypto.ratchet.RatchetPayload.PaddingBlock
Enclosing class:
RatchetPayload

public static class RatchetPayload.PaddingBlockextends RatchetPayload.Block
Padding block for ratchet payload size alignment and obfuscation.
  • Field Details

    • sz

      private int sz
      Encoded size of the clove block.
    • ctx

      private final I2PAppContext ctx
      The app context.
  • Constructor Details

    • PaddingBlock

      public PaddingBlock(int size)
      Size of the zero-filled padding.
      Parameters:
      size - padding size, with zero-filled data
  • Method Details

    • setSize

      void setSize(int size)
      Set the padding size, for reuse.
      Parameters:
      size - the new padding size
    • getDataLength

      public int getDataLength()
      Data length of the block.
      Specified by:
      getDataLength in class RatchetPayload.Block
      Returns:
      the size of the block, NOT including the 3 byte header (type and size)
    • writeData

      public int writeData(byte[] tgt, int off)
      Writes the block to the output buffer at the given offset.
      Specified by:
      writeData in class RatchetPayload.Block
      Parameters:
      tgt - the target buffer
      off - the offset in tgt where the block data starts
      Returns:
      the offset just past the data written to tgt