From c5b50246a73fdf683e1a7c8f31065158dcd3f064 Mon Sep 17 00:00:00 2001 From: Malloc of Kuzkycyziklistan Date: Thu, 18 May 2017 16:03:35 -0500 Subject: [PATCH] smol changes busy day today --- protocol.md | 68 +++++++++++++++++++++++++++----- server/Encryption/KeyExchange.cs | 2 + 2 files changed, 60 insertions(+), 10 deletions(-) diff --git a/protocol.md b/protocol.md index 7181155..d1505dd 100644 --- a/protocol.md +++ b/protocol.md @@ -32,30 +32,78 @@ All numbers, unless otherwise specified, are the string representation of a base ### Packet IDs +A packet ID may have a specific "direction" of communication, in that an endpoint may either act as a _requester_ or a _responder_. A _requester_ is an endpoint that drives all of the communication on that specific packet ID, while the _responder_ is responsible for providing a timely response to the requests. A _responder_ for a specific packet ID should never send that packet ID unsolicited; either the packet will be ignored or the other endpoint will close the connect. Any packet ID marked as bidirectional may be initiated by either endpoint at any time. + #### Server to Client -0. Diffie-Hellman key exchange -| Region | | | Length | -| ------ | --- | --- | ------ | -| test | a | b | c | + + + + + + + + + + + + + + + + + + + + + + + +
+
+ ID 0: Key Exchange
+ Requester +
+
#RegionTypeEnum
1StepBytes ∈ [0, 2]
s = 02GeneratorByte
#### Client to Server -0. Diffie-Hellman key exchange - + + + + + + + + + + + + + + + +
+
+ ID 0: Key Exchange
+ Responder +
+
#RegionType
1
## Sockstamps Because epoch time is not standardized across systems, an intermediate layer of date/time transmission must be used between the client and server so as to handle time dependent interactions. Therefore, a "sockstamp" will be used in place of the context-dependent implementations of epoch time. -A sockstamp is a sequence of six bytes that represent a fully qualified date and time. For the best use of space without obfuscating the data too much, the year's lower four bits and the four bits signifying the month are shared in the same byte, but no other components are joined. +A sockstamp is a sequence of six bytes that represent a fully qualified date and time on the Gregorian calendar. For the best use of space without obfuscating the data too much, the year's lower four bits and the four bits signifying the month are shared in the same byte, but no other components are joined. -The 12 bits signifying the year are an unsigned quanitity, and indicate the number of years since 0 AD; anything that happened before the year 1 AD cannot be represented in this format, but this should never be necessary. The effective range of years that can be expressed by this format is 0 AD to 4095 AD. +The 12 bits signifying the year are an unsigned quanitity, and indicate the number of years since 0 AD; any date prior to the year of Christ's birth cannot be represented in this format, but this should never be necessary. The effective range of years that can be expressed by this format is 1 AD to 4095 AD. Because the year 0 AD is not a legal year in the Gregorian calendar, this value should never be zero. -The indexed list below indicates which byte (the MSB being byte 1) contains what information: +The indexed list below indicates which byte (first byte being the MSB) contains what information: 1. Upper 8 bits of the year quantifier. 2. Upper 4 bits are the four least significant bits of the 12-bit year quantifier. The lower 4 bits are the month quantifier, ranging from 0 to 11. 3. Day of month quanitifier. Ranges from 0 to 30. 4. Hour quantifier. Ranges from 0 to 23. 5. Minute quantifier. Ranges from 0 to 59. -6. Second quantifier. Ranges from 0 to 59. \ No newline at end of file +6. Second quantifier. Ranges from 0 to 59. + +In the event that an endpoint cannot evaluate a date required by the protocol as a result of some error, an error sockstamp will be sent in its place. An error sockstamp takes the form of zeroes in all bits. If an endpoint receives a sockstamp where the year quantifier is zero but any other quantifiers are nonzero, there is a communication error and the endpoint must close the connection. \ No newline at end of file diff --git a/server/Encryption/KeyExchange.cs b/server/Encryption/KeyExchange.cs index e4033a6..d0cb98b 100644 --- a/server/Encryption/KeyExchange.cs +++ b/server/Encryption/KeyExchange.cs @@ -17,5 +17,7 @@ namespace CircleScape.Encryption { Secret = RNG.NextPrime(512 / 8); Modulus = RNG.NextPrime(512 / 8); } + + } }