A method for data exchange on a communication network (2) operating according to a transmission/reception protocol, the communication network including a transmission bus (4), and a first node (E1) and a second node (EN) connected to the transmission bus (4), the method comprising the steps, carried out by the first node (E1), of:
- constructing a first and a second data frame (10) each having a frame format that is defined by said protocol and including a respective payload field (10b), said payload fields (10b) containing respective first and second information data (Data1, Data2) to be transmitted to the second node (EN);
- calculating a first message authentication code (MAC1) as a function of the first and the second information data (Data1, Data2) to be transmitted;
- constructing a third data frame (20), having a frame format that is defined by said protocol and includes a payload field (20a), and containing, in the payload field (20a), said first message authentication code (MAC1);
- transmitting to the transmission bus (4) the first, the second and the third data frames;
- the method further comprising the steps, carried out by the second node (EN), of:
- receiving from the transmission bus (4) the first, the second and the third data frames (10, 20);
- extracting the first information data (Data1) from the first data frame (10) received, the second information data (Data2) from the second data frame (10) received and the first message authentication code (MAC1;
- MAC1′) from the third data frame (20) received;
- calculating a second message authentication code (MACEXP) as a function of the first and the second information data (Data1, Data2) extracted;
- comparing the first message authentication code (MAC1;
- MAC1′) extracted with the second message authentication code (MACEXP) calculated;
- and
- accepting the first and the second data frames (10) only if the first message authentication code (MAC1;
- MAC1′) extracted is identical to the second message authentication code (MACEXP) calculated,
- wherein the step of calculating the first message authentication code (MAC1) further comprises, by the first node, calculating the first message authentication code (MAC1) as a function of a respective first count value (MC, MCnew),
- and the step of calculating the second message authentication code (MACEXP) further comprises, by the second node, calculating the second message authentication code (MACEXP) as a function of a respective second count value (MC′, MCnew),
- the method further comprising synchronizing the first count value and the second count value by:
- setting one from among the first node (E1) and the second node (E2) as a master node and the other from among the first node and the second node as a slave node;
- providing, by the master node, an updated count value (MCnew) of the respective count value;
- sending, by the master node, the updated count value to the transmission bus;
- receiving, by the slave node, the updated count value;
- and
- updating, by the slave node, the respective count value as a function of the updated count value.