Class BuildResponseRecord

java.lang.Object
net.i2p.data.i2np.BuildResponseRecord

public class BuildResponseRecord extends Object
Class that creates an encrypted tunnel build message record. The reply record is the same size as the request record (528 bytes). When decrypted:
 Bytes 0-31 contain the hash of bytes 32-527
 Bytes 32-526 contain random data.
 Byte 527 contains the reply.
  • Constructor Details

    • BuildResponseRecord

      public BuildResponseRecord()
  • Method Details

    • create

      public static EncryptedBuildRecord create(I2PAppContext ctx, int status, SessionKey replyKey, byte[] replyIV, long responseMessageId)
      Create a new encrypted response. AES only for ElGamal routers.
      Parameters:
      status - the response 0-255
      replyIV - 16 bytes
      responseMessageId - unused except for debugging
      Returns:
      a 528-byte response record
    • create

      public static EncryptedBuildRecord create(I2PAppContext ctx, int status, SessionKey replyKey, byte[] replyAD, Properties options)
      Create a new encrypted response (long record). ChaCha/Poly only for ECIES routers.
      Parameters:
      status - the response 0-255
      replyAD - 32 bytes
      options - 511 bytes max when serialized
      Returns:
      a 528-byte response record
      Throws:
      IllegalArgumentException - if options too big or on encryption failure
      Since:
      0.9.48
    • createShort

      public static ShortEncryptedBuildRecord createShort(I2PAppContext ctx, int status, SessionKey replyKey, byte[] replyAD, Properties options, int slot)
      Create a new encrypted response (short record). ChaCha/Poly only for ECIES routers.
      Parameters:
      status - the response 0-255
      replyAD - 32 bytes
      options - 116 bytes max when serialized
      slot - the slot number, 0-7
      Returns:
      a 218-byte response record
      Throws:
      IllegalArgumentException - if options too big or on encryption failure
      Since:
      0.9.51
    • decrypt

      public static boolean decrypt(EncryptedBuildRecord rec, SessionKey key, byte[] ad)
    • decrypt

      public static boolean decrypt(EncryptedBuildRecord rec, SessionKey key, byte[] ad, int nonce)