Extra Systems

CYPHERNET

fingerprint files


Digital fingerprints contain two subscriber identifiers (client_id and server_id), connection type (CLIENT_MODE), and the size of the prologue (by means of which the session key is agreed upon between subscribers during the get_common_key procedure) with a random "salt" (different for each client), protected by a hash and encrypted with RSA by an open (by name only) key of the central server. It should be emphasized that we do not publish this key anywhere and do not transfer it to anyone - that is why fingerprints are made by us. Such a security policy of Extra Systems completely deprives any intruder of the opportunity to hack the Cypher Net system in this area as well.

It is necessary to save the size of the prologue in the fingerprint file in order to ensure the correct operation of the connect_server procedure on the central server. The fact is that in different deliveries the hash size may differ, which would lead to a change in the size of the prologue. The central server does not delve into all these subtleties, but only ensures the transfer between subscribers of an object, the size of which it receives from fingerprint in the variable prolog_size.

The fingerprint files are created by us (at the time of transfer of the product to the customer) using the following algorithm:

#define FINGERPRINT_CLIENT_MODE_BYTE	2

typedef struct finger_print
{
	unsigned char mixed_item[ITEM_SIZE * 2 * 3];
	unsigned char mixed_hash[HARD_HASH_SIZE];
} FINGERPRINT;


void make_fingerprint(PEERID client_id, PEERID server_id) {
	unsigned char solt[ITEM_SIZE * 3];
	unsigned char *client;
	unsigned char *server;
	unsigned char *prolog;
	int i,j,k, file_handle, prolog_size;
	unsigned char packed_value[PACKED_VALUE_LENTH], unpacked_value[VALUE_LENTH];
	unsigned char crypted_value[VALUE_LENTH];
	char str_buf[4096];
	FINGERPRINT client_finger_print;
	file_handle = open("public_0", O_RDONLY);
	read(file_handle, str_buf, 4096);
	close(file_handle);
	str_to_value(strtok(str_buf, " "), encrypt_rsa_key.modulus);
	str_to_value(strtok(NULL, " "), encrypt_rsa_key.exponent);
	init_hard_hash();
	prolog_size = PACKED_VALUE_LENTH + HASH_SIZE;
	client = (unsigned char *) &client_id;
	server = (unsigned char *) &server_id;
	prolog = (unsigned char *) &prolog_size;
	fill_random_buffer(solt, sizeof(solt));
	for (i = j = k = 0; i < ITEM_SIZE; ) {
		client_finger_print.mixed_item[k++] = solt[i++];
		client_finger_print.mixed_item[k++] = client[j++];
	}
	for (j = 0; j < ITEM_SIZE; ) {
		client_finger_print.mixed_item[k++] = solt[i++];
		client_finger_print.mixed_item[k++] = server[j++];
	}
	for (j = 0; j < ITEM_SIZE; ) {
		client_finger_print.mixed_item[k++] = solt[i++];
		client_finger_print.mixed_item[k++] = prolog[j++];
	}
	client_finger_print.mixed_item[FINGERPRINT_CLIENT_MODE_BYTE] = CLIENT_MODE_INPUT;
	get_hard_hash(client_finger_print.mixed_item, sizeof(client_finger_print.mixed_item), client_finger_print.mixed_hash);
	memset(packed_value, 0, PACKED_VALUE_LENTH);
	memcpy(packed_value, &client_finger_print, sizeof(FINGERPRINT));
	unpack_value(packed_value, unpacked_value);
	long_power_mod(unpacked_value, encrypt_rsa_key.exponent, encrypt_rsa_key.modulus, crypted_value);
	pack_value(crypted_value, packed_value);
	sprintf(str_buf, "fingerprints/fingerprint_i_%d_%d", client_id, server_id);
	file_handle = creat(str_buf, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
	write(file_handle, packed_value, PACKED_VALUE_LENTH);
	close(file_handle);
	client_finger_print.mixed_item[FINGERPRINT_CLIENT_MODE_BYTE] = CLIENT_MODE_OUTPUT;
	get_hard_hash(client_finger_print.mixed_item, sizeof(client_finger_print.mixed_item), client_finger_print.mixed_hash);
	memset(packed_value, 0, PACKED_VALUE_LENTH);
	memcpy(packed_value, &client_finger_print, sizeof(FINGERPRINT));
	unpack_value(packed_value, unpacked_value);
	long_power_mod(unpacked_value, encrypt_rsa_key.exponent, encrypt_rsa_key.modulus, crypted_value);
	pack_value(crypted_value, packed_value);
	sprintf(str_buf, "fingerprints/fingerprint_o_%d_%d", client_id, server_id);
	file_handle = creat(str_buf, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
	write(file_handle, packed_value, PACKED_VALUE_LENTH);
	close(file_handle);
}

The content of this page is also available in French, German, Ukrainian and Russian.


© Extra Systems, 2024 Extra Web Top