# Homomorphic Encryption Based Privacy-Preservation for IoMT
## 3 Proposed Scheme
### Workflow of the Proposed Scheme
#### 3.2.2 Secure Data Transmission  
Performing secure encryption and generating keys directly on computationally challenged IoMT sensor devices is challenging. Replay attacks and delay attacks are a constant threat when sending unsecured plaintext data across the network. An attacker reading a packet and sending it at a later time is termed a replay attack. In contrast, delay Attacks are caused by an attacker intercepting the packet, suspending sending it to its destination address, and sending it at a later time. Timestamps in combination with nonce value are used to prevent attackers from replay and delay attacks. The IoT device sends timestamps and nonce values as a part of the packet header, using the MAC address header to the physical base station. The base station accepts packets from the device based on a time tolerance and sends a reply to the device of the packet being received on time. However, an attacker can send the packet repeatedly at a later time as a flood attack to negatively affect the base station's performance. Including the nonce value with the timestamp secures the base station by dropping all delayed packets using the same nonce value as the previous packet. A successful attack results in an IoT device not using the same network channel to communicate with the base station. However, this method is not secure. The attacker resets the timestamp clock on the sensor and forces it to send future packets with incorrect parameters, causing all packets to be dropped. [PERSON] et al. (2017) proposed a secure time synchronization protocol mechanism for IoT devices by coordinating the clock with the father and grandfather nodes. Other device nodes are ignored as they are also vulnerable to being malicious nodes. A spanning tree-based protocol protects the device from fake timestamps. The proposed scheme includes the protocol as shown in Figure 3, ensures the IoMT device clock is reset to the correct time, and the process is as follows:  
1. The device communicates with nodes that are part of its local cluster to correctly reset the time and ignores other devices as they can provide incorrect timestamps. 2. The device sends a message to a VEN included in the cluster and requests for an ACK reply. The selection of VEN to communicate with is based on the distance to the physical device. 3. The VEN records both the timestamps of when the packet was sent by the device, recorded as \(tsmp_{1}\) and when the message is received as \(tsmp_{2}\). The second timestamp indicates that the message received is within the acceptable threshold value. 4. The ACK reply message sent back by the VEN to the device includes \(tsmp_{3}\) which indicates when the VEN sent the ACK message. The device records the received ACK message as \(tsmp_{4}\). 5. The clock difference calculated by the device measures \(tsmp_{1},\;tsmp_{2},\;tsmp_{3},\;tsmp_{4}\), received during its communication with the VEN. The difference is calculated as: \[\Delta\;(d_{i},\;v_{i})=\frac{(tsmp_{2}-tsmp_{1})-(tsmp_{4}-tsmp_{3})}{2}\]
6. The VEN further sends a message to the cluster head node for time confirmation and requests an ACK message as a reply. 7. The cluster head node receives the message and records \(tsmp_{6}\). The ACK reply message sent back to the VEN now includes both \(tsmp_{6}\) and \(tsmp_{7}\). 8. The message is forwarded at the received time to the device. The device records the received message's \(tsmp_{8}\). The device now has further knowledge of the clock time difference between the cluster head and the device based on the received \(tsmp_{1},\ tsmp_{2},\ tsmp_{3},\ \dots\dots,\ tsmp_{8}\). The clock difference is measured as follows:  
\[\Delta\ (d_{i},\ cen)=\frac{(tsmp_{6}-tsmp_{1})-(tsmp_{8}-tsmp_{7})}{2}\]  
For additional security, the acceptable threshold value margin of error is calculated based on a single hop between the device, VEN, and cluster head.