## 4 Proposed Scheme
### Session Key Exchange Phase  
Before accessing devices and data, the authentication process is conducted. Before authentication, a key must be exchanged between the remote user and the server. We follow a simple and strong symmetric key exchange in Algorithm 1. Session key exchange processes are described as follows:  
**Step 1:** The doctor enters identity as \(ID_{D}\) and password as \(PSW_{D}\) in the device (smartphone). The device computes hash-based identity as \(HID_{D}=\text{h}(ID_{D})\) and hash-based password as \(HPSW_{D}=\text{h}(ID_{D}\parallel PSW_{D})\). The device sends \(HID_{D}\) to the server for verification. When the server receives the login information of the remote user, then the server verifies it against its database. If the login information is not correct, then the server terminates the connection. If the login information is correct, then the server randomly generates two larger numbers, \(N_{1}\) and \(N_{2}\). The server computes \(N_{1}^{*}=(N_{1}\oplus HPSW_{D})\), \(N_{2}^{*}=(N_{2}\oplus HPSW_{D})\), and sends them to the remote user. The doctor receives the values of \(N_{1}^{*}\) and \(N_{2}^{*}\) from the server and derives \(N_{1}\) and \(N_{2}\) from \((N_{1}^{*}\oplus HPSW_{D})\) and \((N_{2}^{*}\oplus HPSW_{D})\), respectively. **Step 2:** The doctor generates a larger random number \(N_{D}\). The random number's size is 128 bits. The doctor's device multiplies the random number \(N_{D}\) with \(N_{1}\), adds \(N_{1}\), and computes the result, as shown in Equation (3). The device multiplies \(Res_{D}\) with the second number \(N_{2}\), adds both numbers \(N_{1}\) and \(N_{2}\), and calculates the final result \(FR_{D}\) as shown in Equation (4). The device sends \(FR_{D}\) to the server for a session key of size 128 bits calculation. The final result \(FR_{D}\) is not a key. So, if an intruder catches it, then the intruder cannot retrieve the key. \[Res_{D}=(N_{D}\times N_{1})+N_{1} \tag{3}\]  
\[FR_{D}=(Res_{D}\times N_{2})+N_{1}+N_{2} \tag{4}\]  
**Step 3:** When the server receives the final result \(FR_{D}\) by the doctor's device, then the server extracts the hidden number \(N_{D}\) by using both numbers \(N_{1}\) and \(N_{2}\), respectively. The server subtracts the numbers \(N_{1}\) and \(N_{2}\) and obtains the result \(Res_{S}\) as shown in Equation (5). \[Res_{S}=FR_{D}-(N_{1}+N_{2}) \tag{5}\]  
The server extracts \(N_{D}\), as presented in Equation (6). \[N_{D}=(Res_{S}/(N_{1}\times N_{2}))-1 \tag{6}\]  
**Step 4:** Similarly, the server generates a larger random number of \(N_{S}\) and sends \(FR_{S}\) to the doctor. The doctor extracts the hidden number \(N_{S}\) by following the same procedure, as shown above. **Step 5:** When both sides have shared secret numbers \(N_{D}\) and \(N_{S}\) with each other, then both sides compute bitwise XOR of \(N_{D}\) with \(N_{S}\), calculate mod with M, and obtain the final session key \(K_{S}\) on both sides secretly, as shown in Equation (7), where M is a variable that stores the larger value of size 128 bits. \[K_{S}=(N_{D}\oplus N_{S})\ mod\ M \tag{7}\]  
The same session key is exchanged between the remote user (doctor) and the server. The key would be used in security services such as mutual authentication, data confidentiality, and data integrity over vulnerable public networks. Figure 3 shows the complete process of session key exchange and mutual authentication among server and remote user. ```
0: M is a variable that stores the value of size 128 bits.