public class BuildResponseRecord extends Object
Bytes 0-31 contain the hash of bytes 32-527 Bytes 32-526 contain random data. Byte 527 contains the reply.
Constructor and Description |
---|
BuildResponseRecord() |
Modifier and Type | Method and Description |
---|---|
static EncryptedBuildRecord |
create(I2PAppContext ctx,
int status,
SessionKey replyKey,
byte[] replyIV,
long responseMessageId)
Create a new encrypted response.
|
static EncryptedBuildRecord |
create(I2PAppContext ctx,
int status,
SessionKey replyKey,
byte[] replyAD,
Properties options)
Create a new encrypted response (long record).
|
static ShortEncryptedBuildRecord |
createShort(I2PAppContext ctx,
int status,
SessionKey replyKey,
byte[] replyAD,
Properties options,
int slot)
Create a new encrypted response (short record).
|
static boolean |
decrypt(EncryptedBuildRecord rec,
SessionKey key,
byte[] ad) |
static boolean |
decrypt(EncryptedBuildRecord rec,
SessionKey key,
byte[] ad,
int nonce) |
public static EncryptedBuildRecord create(I2PAppContext ctx, int status, SessionKey replyKey, byte[] replyIV, long responseMessageId)
status
- the response 0-255replyIV
- 16 bytesresponseMessageId
- unused except for debuggingpublic static EncryptedBuildRecord create(I2PAppContext ctx, int status, SessionKey replyKey, byte[] replyAD, Properties options)
status
- the response 0-255replyAD
- 32 bytesoptions
- 511 bytes max when serializedIllegalArgumentException
- if options too big or on encryption failurepublic static ShortEncryptedBuildRecord createShort(I2PAppContext ctx, int status, SessionKey replyKey, byte[] replyAD, Properties options, int slot)
status
- the response 0-255replyAD
- 32 bytesoptions
- 116 bytes max when serializedslot
- the slot number, 0-7IllegalArgumentException
- if options too big or on encryption failurepublic static boolean decrypt(EncryptedBuildRecord rec, SessionKey key, byte[] ad)
public static boolean decrypt(EncryptedBuildRecord rec, SessionKey key, byte[] ad, int nonce)