|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.data.i2np.BuildRequestRecord
public class BuildRequestRecord
Hold the tunnel request record, managing its encryption and decryption. Cleartext:
bytes 0-3: tunnel ID to receive messages as bytes 4-35: local router identity hash bytes 36-39: next tunnel ID bytes 40-71: next router identity hash bytes 72-103: AES-256 tunnel layer key bytes 104-135: AES-256 tunnel IV key bytes 136-167: AES-256 reply key bytes 168-183: reply IV byte 184: flags bytes 185-188: request time (in hours since the epoch) bytes 189-192: next message ID bytes 193-222: uninterpreted / random padding
Field Summary | |
---|---|
static int |
IV_SIZE
|
static int |
PEER_SIZE
we show 16 bytes of the peer hash outside the elGamal block |
Constructor Summary | |
---|---|
BuildRequestRecord()
|
|
BuildRequestRecord(ByteArray data)
|
Method Summary | |
---|---|
void |
createRecord(I2PAppContext ctx,
long receiveTunnelId,
Hash peer,
long nextTunnelId,
Hash nextHop,
long nextMsgId,
SessionKey layerKey,
SessionKey ivKey,
SessionKey replyKey,
byte[] iv,
boolean isInGateway,
boolean isOutEndpoint)
Populate this instance with data. |
boolean |
decryptRecord(I2PAppContext ctx,
PrivateKey ourKey,
Hash ourIdent,
ByteArray encryptedRecord)
Decrypt the data from the specified record, writing the decrypted record into this instance's buffer (but not overwriting the array contained within the old buffer) |
void |
encryptRecord(I2PAppContext ctx,
PublicKey toKey,
Hash toPeer,
byte[] out,
int outOffset)
Encrypt the record to the specified peer. |
ByteArray |
getData()
|
boolean |
readIsInboundGateway()
The current hop is the inbound gateway. |
boolean |
readIsOutboundEndpoint()
The current hop is the outbound endpoint. |
SessionKey |
readIVKey()
Tunnel IV encryption key that the current hop should use |
SessionKey |
readLayerKey()
Tunnel layer encryption key that the current hop should use |
Hash |
readNextIdentity()
Read the next hop from the record. |
long |
readNextTunnelId()
What tunnel ID the next hop receives messages on. |
boolean |
readOurIdentityMatches(Hash ourIdentity)
true if the identity they expect us to be is who we are |
long |
readReceiveTunnelId()
what tunnel ID should this receive messages on |
byte[] |
readReplyIV()
IV that should be used to encrypt the reply |
SessionKey |
readReplyKey()
Session key that should be used to encrypt the reply |
long |
readReplyMessageId()
What message ID should we send the request to the next hop with. |
long |
readRequestTime()
Time that the request was sent, truncated to the nearest hour |
void |
setData(ByteArray data)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int IV_SIZE
public static final int PEER_SIZE
Constructor Detail |
---|
public BuildRequestRecord(ByteArray data)
public BuildRequestRecord()
Method Detail |
---|
public ByteArray getData()
public void setData(ByteArray data)
public long readReceiveTunnelId()
public boolean readOurIdentityMatches(Hash ourIdentity)
public long readNextTunnelId()
public Hash readNextIdentity()
public SessionKey readLayerKey()
public SessionKey readIVKey()
public SessionKey readReplyKey()
public byte[] readReplyIV()
public boolean readIsInboundGateway()
public boolean readIsOutboundEndpoint()
public long readRequestTime()
public long readReplyMessageId()
public void encryptRecord(I2PAppContext ctx, PublicKey toKey, Hash toPeer, byte[] out, int outOffset)
bytes 0-15: SHA-256-128 of the current hop's identity (the toPeer parameter) bytes 15-527: ElGamal-2048 encrypted block
public boolean decryptRecord(I2PAppContext ctx, PrivateKey ourKey, Hash ourIdent, ByteArray encryptedRecord)
public void createRecord(I2PAppContext ctx, long receiveTunnelId, Hash peer, long nextTunnelId, Hash nextHop, long nextMsgId, SessionKey layerKey, SessionKey ivKey, SessionKey replyKey, byte[] iv, boolean isInGateway, boolean isOutEndpoint)
receiveTunnelId
- tunnel the current hop will receive messages onpeer
- current hop's identitynextTunnelId
- id for the next hop, or where we send the reply (if we are the outbound endpoint)nextHop
- next hop's identity, or where we send the reply (if we are the outbound endpoint)nextMsgId
- message ID to use when sending on to the next hop (or for the reply)layerKey
- tunnel layer key to be used by the peerivKey
- tunnel IV key to be used by the peerreplyKey
- key to be used when encrypting the reply to this build requestiv
- iv to be used when encrypting the reply to this build requestisInGateway
- are we the gateway of an inbound tunnel?isOutEndpoint
- are we the endpoint of an outbound tunnel?
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |