Cryptographic and Network Primitives

From xx network wiki
Jump to navigation Jump to search
This is a team contributed page
Each cMix Node and Gateway have a unique identity defined by a TLS credentials (a certificate and private key pair) and an identification file. These files are extremely important to back up and store securely. Loss of these files will make it impossible to reconnect a Node or Gateway to the network. If following the default guide, these files are named cmix-cert.crt, cmix-key.key, cmix-IDF.json, gateway-cert.crt, gateway-key.key, and gateway-IDF.json. Refer to the Lost Certificate and Important Files Policy for more information.

There are various cryptographic primitives used in the xx network; some are provided by xx network and some are generated by the Node operator.

Primitives Provided by xx network

The following primitives are provided to you by xx network, either emailed directly or they are downloaded from public repositories.

Permissioning TLS Certificate Provided inside the tarball A TLS certificate is provided to be used to identify the Permissioning server.
Permissioning Server Address Provided inside the tarball The DNS address of the Permissioning server is pre-populated inside the YAML files for Node and Gateway.
Wrapper Script Bucket Address Provided inside the tarball The IP address the Wrapper Script uses to update the binaries. It is pre-populated in the Wrapper Script.
Log Bucket Address Provided inside the tarball The IP address the Wrapper Script uses to upload logs to. It is pre-populated in the Wrapper Script.
cMix Cyclic Group Provided as part of the NDF on initial registration The cMix cyclic group is the modulo cyclic group in which cMix operations are conducted. At launch, this will be defined by a 2048-bit strong and safe prime with a generator of 2.
E2E Cyclic Group Provided as part of the NDF on initial registration The E2E cyclic group is the modulo cyclic group in which end to end encryption operations by clients will be conducted. At launch, this will be defined by a 3192-bit strong and safe prime with a generator of 2.

Primitives Created by the Node Operator

The following primitives are generated prior to and during the initial registration of the Node. More details about generation can be found in Generate TLS Credentials.

TLS Credentials

The TLS credentials are generated as X.509, SHA-256, RSA 4096-bits, and are recommended to last 730 days (2 years). The generated credentials include:

  • Node TLS certificate
  • Node private key
  • Gateway TLS certificate
  • Gateway private key

ID File (IDF)

IDs are 264 bits and consist of a 256-bit hash (BLAKE2b) of a salt and the RSA public key from the Node’s TLS certificate appended with a 8 bits that describe the ID type.

ID = Hash(Node_PubKey, Salt) + TYPE

Due to the construction of the ID, the ownership of the ID can be proved under RSA’s cryptographic assumptions. Due to the hash, IDs are unpredictably generated in a large sparse space so it is overwhelmingly improbable that independently generated IDs will ever collide, so no central checking of ID generation is necessary.

The last byte of the ID is a type byte which describes what type of entity it belongs to. The options for type are:

Type Hex Note
Generic 0x00 Used for one-off entities such as the Permissioning server
Gateway 0x01 Used for Gateways
Node 0x02 Used for Nodes
User 0x03 Used for clients on the network
Group 0x04 Used for each group chat

On first run, the Node automatically generates the ID and saves it to a JSON file with the following structure.

{
	"id": "4YtvGZrivai2EIZew8OOOE1YtYW/LvzhooDyAVp6yxQC",

The ID of the Node or Gateway, presented as a base 64 encoded string.

	"type": "node",

The type of ID is shown here for readability.

	"salt": [155, 19, 124, 4, 101, 32, 154, 84, 32, 100, 8, 236, 220, 228, 161, 237, 62, 124, 81, 33, 164, 69, 10, 20, 59, 209, 181, 157, 250, 186, 67, 247],

The salt used to generate the ID.

	"idBytes": [225, 139, 111, 25, 154, 226, 189, 168, 182, 16, 134, 94, 195, 195, 142, 56, 77, 88, 181, 133, 191, 46, 252, 225, 162, 128, 242, 1, 90, 122, 203, 20, 2],

The ID of the Node or Gateway, presented as an array of bytes.

	"hexNodeID": "0xe18b6f199ae2bda8b610865ec3c38e384d58b585bf2efce1a280f2015a7acb14",
}

The ID of the Node or Gateway, presented as a hexadecimal number.