smol changes
busy day today
This commit is contained in:
parent
c8bb3ceafd
commit
c5b50246a7
2 changed files with 60 additions and 10 deletions
66
protocol.md
66
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 |
|
||||
<table>
|
||||
<thead>
|
||||
<th colspan="100">
|
||||
<center>
|
||||
ID 0: Key Exchange<br />
|
||||
Requester
|
||||
</center>
|
||||
</th>
|
||||
</thead>
|
||||
<thead>
|
||||
<th colspan="2">#</th>
|
||||
<th>Region</th>
|
||||
<th>Type</th>
|
||||
<th>Enum</th>
|
||||
</thead>
|
||||
<tr style="text-align: center;">
|
||||
<td colspan="2">1</td>
|
||||
<td>Step</td>
|
||||
<td>Byte</td>
|
||||
<td><i>s ∈ [0, 2]</i></td>
|
||||
</tr>
|
||||
<tr style="text-align: center;">
|
||||
<td><i>s = 0</i></td>
|
||||
<td>2</td>
|
||||
<td>Generator</td>
|
||||
<td>Byte</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
#### Client to Server
|
||||
|
||||
0. Diffie-Hellman key exchange
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<th colspan="100">
|
||||
<center>
|
||||
ID 0: Key Exchange<br />
|
||||
Responder
|
||||
</center>
|
||||
</th>
|
||||
</thead>
|
||||
<thead>
|
||||
<th>#</th>
|
||||
<th>Region</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th>Type</th>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>1</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## 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.
|
||||
|
||||
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.
|
|
@ -17,5 +17,7 @@ namespace CircleScape.Encryption {
|
|||
Secret = RNG.NextPrime(512 / 8);
|
||||
Modulus = RNG.NextPrime(512 / 8);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue