Eulora's Communication Protocol, restated.
This is the current take on an ongoing effort towards specification, last revised January 21st, 2021.
1. Overall Goals:
1.1. All communications between clients and server to be encrypted.
1.2. Clients to be able to receive from server any data they lack (including maps, skins, sound or video content etcetera), on demand.
1.3. Clients to be able to choose and adjust both the level of security and their volume of communications with the server, as they will ultimately have to pay for the load that they generate.
2. Explicit Dependencies :
2.1. Eucrypt for RSA with Keccak-based OAEP and Serpent symmetric ciphering.
3. Data Structures :
3.0. Basic types :
char / uint8 (1 byte) ;
uint16 (2 byte) ;
uint32 (4 byte) ;
uint64 (8 byte) ;
floati (4 byte) ;
3.1. Special types :
hash (128 bits) ;
chunk [of file] (bitfield, 11760 bits) ;
serpent-packet (1472 bytes) ;
rsa-messageii (1872 bitsiii) ;
rsa-packetiv (1470 bytes) ;
object (size of 104 bitsv : uint32vi followed by 3 uint16s representing positionvii followed by 3 uint8s representing rotationviii ) ;
legacy-text (size of n+n/256+1 bytes ; where the leading byte is the bytecount of the 2nd segment and the 2nd segment is the bytecount of the third segment).ix
text (2 byte hearder containing the ~total~ byte length ; up to 1470 bytes of text ).
4. Serpent Packetsx :
4.1. Serpent Key Set :
uint8 (type ID, =100), followed by
uint8 (count of keys in this set, n), followed by
n*(4*int64 + uint32) (32 bytes each key followed by a 4 byte ID calculated through crc32xi ), followed by
an uint8 flag (LSB bit set -- keys to be used to talk to client ; MSB set -- key to be used to talk to server ; client-set MSB is ignored), followed by
uint16 (message countxii), followed by
padding to Serpent-message length.
4.2. Serpent Keys Lifecycle Management :
uint8 (type ID, =102), followed by
uint8 (count of server keys requested), followed by
uint8 (count of client keys requested), followed by
uint8 (idxiii of serpent key preferred for further inbound Serpent-messages), followed by
uint8 (count of burned keys in this message), followed by
n*int8 (id of burned key), followed by
uint16 (message count), followed by
padding to Serpent-message length.
4.4.a. File Request, manifest
uint8 (type ID, =3), followed by
hash (corresponding to the sought filexiv), followed by
uint8 (manifest packets sought count, 0=all), followed by
n* uint16 (manifest packet index sought), followed by
padding to Serpent-message length.
4.4.b. File Transfer, manifest (always sent and only sent in response to ID 3)
uint8 (type ID, =4), followed by
uint16 (count of manifest packets for this filexv), followed by
uint16 (index of current packet in list above), followed by
uint8 (fragment countxvi), followed by
n* uint64 (hash of the nth fragment of manifested file).
uint16 (keccak hash of foregoing), followed by
padding to Serpent-message length.
4.4.c. File Request, chunks
uint8 (type ID, =5), followed by
hash (corresponding to the sought file), followed by
uint8 (file chunks sought count), followed by
n* uint64 (the hash of fragment sought), followed by
padding to Serpent-message length.
4.4.d. File Transfer, non-last chunk (always sent and only sent in response to ID 5)
uint8 (type ID, =6), followed by
chunk.
4.4.f. File Transfer, last chunk (sent at most once per ID 3)
uint8 (type ID, =7), followed by
uint16 (bytesize of useful part of the chunk followingxvii, followed by
chunk.xviii
4.5. Client Actionxix :
uint8 (type ID, =8), followed by
text (fully specified action, see section 7), followed by
uint16 (message count), followed by
padding to Serpent-message length.
4.6. World Bulletinxx :
uint8 (type ID, =9), followed by
uint32 (id of top level itemxxi), followed by
uint8 (count of objects), followed by
object listxxii, followed by
uint16 (message count), followed by
padding to Serpent-message length.
4.7. Object Request :
uint8 (type ID, =10), followed by
uint8 (count of objects), followed by
n*int32 (id of object), followed by
uint16 (message count), followed by
padding to Serpent-message length.
4.8. Object Info :
uint8 (type ID, =11), followed by
uint8 (count of objects), followed by
n times uint32 (id of object) and text (object properties, as per extant game structures, including art files needed and so onxxiii), followed by
uint16 (message count), followed by
padding to Serpent-message length.
5. RSA Packetsxxiv :
5.1. RSA key set.xxv
uint8 (equal to 251 to indicate packet contains a new RSA key), followed by
uint8 (protocol version), followed by
uint16 (subversion), followed by
uint32 (IP of serverxxvi), followed by
uint32 (IP of clientxxvii), followed by
uint64 (keccak hash of client binary), followed by
uint64 (e of RSA key), followed by
uint8*490 (N of RSA key), followed by
uint64 (preferred padding -- the magic value of 0x13370000 requests random padding ; all other values will be used as such, bitwise, ie like an infinite-length OTP consisting of the value repeated), followed by
uint16 (message count), followed by
padding to RSA-message length, 1424 (5616-8-8-16-32-64-64-3920-64-16) bits exactly.
5.2. Serpent key setxxviii :
uint8 (equal to 157 to indicate packet contains new Serpent keys), followed by
uint8 (count of keysxxix in this set, n ; n
Sunday, 20 May, Year 10 d.Tr.