-
Notifications
You must be signed in to change notification settings - Fork 2
/
Messages formatts
102 lines (44 loc) · 3.87 KB
/
Messages formatts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
1) HTTP Wrapper
http://[server_ip]:[server_port]/[message_type]/size=[message_size]/[message]
[message_type] = {"register", "publish", "query"}
[message_size] = number of bytes (characteres) in the message, in decimal, including End of String (EOS, '\0')
Exemple 1:
http://localhost:7778/register/size=63/pk|72d41281|ck|00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-"
Example 2:
http://localhost:7778/query/size=24/pk|72d41281|index|000000
Example 3:
http://localhost:7778/publish/size=631/pk|72d41281|type|123456|size|62|encrypted|dd-b1-b6-b8-22-d3-9a-76-1c-b6-c0-30-6a-e9-21-5a-00-00-00-00-00-00-00-00-00-00-00-00-73-e3-a6-f9-52-d2-97-a3-c1-10-f3-c5-05-cb-8e-1d-8b-e2-cf-cc-16-26-2c-4f-83-94-e4-9a-e0-ee-b3-9c-50-63-68-4d-21-12-f0-a6-12-bc-86-9d-e1-a3-9b-d9-f9-31-d2-7c-63-e3-40-0e-08-17-d3-d2-f8-bf-bf-c0-ee-ea-4c-b7-90-df-
2) CACIC Registration Message
WARNING: this is an insecure message, used only for test purposes. Production code must leverage attestation.
pk|[key_id]|ck|[communication_key]
[ket_id] = 8 characters + end of string character (total of 9 characters). Hexadecimal ID releated to the client. It is used to search for the client key file.
[communication_key] = sequence of 16 "xx-" triples. Each "xx" indicates the key byte value in hexadecimal.
Example:
pk|72d41281|ck|00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-
3) CACIC Publication Message
pk|[key_id]|type|[data_type]|size|[encrypted_message_size]|encrypted|[encrypted_message]
[ket_id] = 8 characters + end of string character (total of 9 characters). Hexadecimal ID releated to the client. It is used to search for the client key file.
[data_type] = 6 characters numeric decimal code indicating what type of processing must be applied to the data. "123456" is used for temperature data and "555555" is used for aggregation of temperature data.
[encrypted_message_size] = 2 digits hexadecimal number representing the number of bytes in the encrypted data.
[encrypted_message] = sequence of n "xx-" triples, where n is the encrypted_message_size. Each "xx" indicates the data byte value in hexadecimal.
Example:
pk|72d41281|type|123456|size|62|encrypted|dd-b1-b6-b8-22-d3-9a-76-1c-b6-c0-30-6a-e9-21-5a-00-00-00-00-00-00-00-00-00-00-00-00-73-e3-a6-f9-52-d2-97-a3-c1-10-f3-c5-05-cb-8e-1d-8b-e2-cf-cc-16-26-2c-4f-83-94-e4-9a-e0-ee-b3-9c-50-63-68-4d-21-12-f0-a6-12-bc-86-9d-e1-a3-9b-d9-f9-31-d2-7c-63-e3-40-0e-08-17-d3-d2-f8-bf-bf-c0-ee-ea-4c-b7-90-df-
4) CACIC Query Message
pk|[key_id]|index|[index]|size|[command_size]|command|[command]|encrypted|[encrypted_pk]
[key_id] = 8 characters + end of string character (total of 9 characters). Hexadecimal ID releated to the client. It is used to search for the client key file.
[index] = indicates the index of the datas queried from database.
[command_size] = SQL database command size.
[command] = SQL database command for searching for he queried data.
[encrypted_pk] = encrypted key id using client communication key
Example:
pk|72d41281|index|000000|size|27|command|SELET_*_from_TACIOT_where_type='123456'|encrypted|d9-07-10-91-59-e2-27-a6-b9-29-d4-91-67-a7-54-4d-00-00-00-00-00-00-00-00-00-00-00-00-34-ba-be-fa-51-84-9b-a3-
5) Consumption data
pk|[key_id]|type|123456|payload|[measurement]|permission1|[key_id_1]| ... |permissionX|[key_id_X]
[key_id] = 8 characters + end of string character (total of 9 characters). Hexadecimal ID releated to the client. It is used to search for the client key file.
[measurement] = value itself.
[key_id_i] = key ID of i'th user that can access this data.
6) Consumption aggregation data
pk|[key_id]|type|555555|payload|[command]|permission1|[key_id_1]
[key_id] = 8 characters + end of string character (total of 9 characters). Hexadecimal ID releated to the client. It is used to search for the client key file.
[command] = SQL command selecting datas for aggregation.
[key_id_i] = key ID of i'th user that can access this data.