Most recent edit on 2007-07-28 20:20:22 by MatthewToseland [fix formatting again]
Additions:
Old Packet Format
Key setup
Link Packets
Deletions:
Old Packet Format
=Key setup=
=Link Packets=
Edited on 2007-07-28 20:20:03 by MatthewToseland [fix formatting]
Additions:
=Key setup=
=Link Packets=
Deletions:
Key setup
Link Packets
Oldest known version of this page was edited on 2007-07-28 20:19:43 by MatthewToseland [OldPacketFormat]
Page view:
Old Packet Format
The packet format currently used by Freenet 0.7. See
the proposed new packet format, which is somewhat more secure.
Key setup
A four-stage Station-To-Station protocol variant, soon to be replaced with JFKi.
Authentication/link setup packets are super-encrypted with a temporary setup key derived from the identities of the nodes involved. The plaintext (the actual STS exchange) is padded with between 0 and 100 bytes of random data, is encrypted, and an IV and hash of the plaintext are prepended. Thus the packets are variable size and contain no recognisable bytes. The key exchange produces a single session key which is used in both directions. For more details, check the source! :)
Link Packets
Packet:
- Hash of plaintext (32 bytes)
- Plaintext encrypted using session key in PCFB mode (= CFB as we use 256/256 rijndael), with IV = the above hash
Plaintext:
- Sequence number (4 bytes)
- Random padding (12 bytes)
- Version = 0 (1 byte)
- Sequence number (4 bytes) - may be -1 if no messages included, otherwise incremented on each packet sent
- Real sequence number (4 bytes) - only included if sequence number = -1
- Reference sequence number (4 bytes) - last seen sequence number of *incoming* packets
- Number of acks (1 byte, unsigned)
- Ack's (1 byte, unsigned offsets from the reference sequence number)
- Number of retransmit requests
- Retransmit requests (as ack's)
- Number of ack requests
- Ack requests (relative to seqno/real seqno)
- Number of forgotten packets
- Forgotten packet numbers (relative to seqno/real seqno)
- Number of messages (1 byte unsigned)
- Messages
Note that much of the above is dictated by the current rather bizarre custom retransmission/acknowledgement algorithm. The
NewPacketFormat includes a much better algorithm for retransmission, based on TCP.