# FAIDM for Medical Privacy Protection in 5G Telemedicine Systems
## 3 Proposed Scheme
### Mutual Authentication and Key Agreement Phase  
After the constrained node joins the remote server node alliance as a remote server node member, it can use the services not only provided by the registered services provider but also other services provider in the same remote server node alliance. When the constrained node applies for remote server node services, the gateway node and constrained node will executive mutual authentication to ensure the further interaction between the gateway node and constrained node is secure and validated. Figure 5. illustrates process of mutual authentication and key agreement phase. Detailed descriptions are stated as follows:  
Step 1 Constrained node \(CN_{\bar{y}\bar{i}}\) chooses a random number \(a_{\bar{y}\bar{i}}\), computes \(\mu_{\bar{y}\bar{i}}\) and \(C_{t}\), and sends (\(C_{t}\), \(ID_{\bar{y}\bar{i}}\)) to gateway node \(GW_{t}\).  
\[\mu_{\bar{y}\bar{i}}=T_{s_{\bar{y}\bar{i}}}(a_{\bar{y}\bar{i}})\bmod p \tag{7}\]  
\[C_{t}=(T_{a_{t}}(\mu_{\bar{y}\bar{i}}\|a_{\bar{y}\bar{i}}\|Cert_{GW_{i}\to CN _{\bar{y}\bar{i}}})\bmod p)P_{t} \tag{8}\]  
Figure 5: Mutual authentication and key agreement phase of proposed scheme.  
Step 2: Upon receiving \((C_{t},\ ID_{ij})\), gateway node \(GW_{t}\) obtains \((\mu_{ij}||a_{ij}||(\textit{Cert}_{GW_{i}\to CN_{ij}})\) by decrypting \(P_{t}\) and verifies \(\textit{Cert}_{GW_{i}\to CN_{ij}}\) is valid. If \(\textit{Cert}_{GW_{i}\to CN_{ij}}\) is valid, gateway node \(GW_{t}\) progresses to steps below, or gateway node \(GW_{t}\) abandons request.  
\[(\mu_{ij}||a_{ij}||(\textit{Cert}_{GW_{i}\to CN_{ij}}=)\left(T_{d}(C_{t})\ \text{mod}\ p\right)/P_{t} \tag{9}\]  
Step 3: Gateway node \(GW_{t}\) computes \((\omega_{t},\)\(sk_{GW_{t}\leftrightarrow CN_{ij}}\), \(P_{i}\), \(P_{\bar{i}}\), \(P_{t}\), \(K\), \(\textit{MAC}_{GW_{t}})\) and sends \((\textit{MAC}_{GW_{t}},\ \omega_{t})\) to the constrained node \(CN_{ij}\).  
\[\omega_{t}=T_{s_{t}}(a_{\bar{i}})\ \text{mod}\ p \tag{10}\]  
\[sk_{GW_{t}\leftrightarrow CN_{\bar{i}}}=H_{3}(T_{s_{t}}(\mu_{\bar{i}})\ \text{mod}\ p) \tag{11}\]  
\[P_{i}=H_{2}(ID_{i}) \tag{12}\]  
\[P_{\bar{i}j}=H_{2}(Q_{\bar{i}j},\ ID_{i}) \tag{13}\]  
\[P_{t}=H_{1}(ID_{i}) \tag{14}\]  
\[K=(P_{i}||Q_{0})\bigoplus(P_{\bar{i}}||Q_{\bar{i}})\bigoplus(P_{t}||Q_{\bar{ i}})\bigoplus(sk_{GW_{t}\leftrightarrow CN_{\bar{i}}}||\omega_{t}) \tag{15}\]  
\[\textit{MAC}_{GW_{t}}=h_{K}(P_{t},\ P_{\bar{i}j},\ \mu_{\bar{i}}) \tag{16}\]  
Step 4: Upon receiving \((\textit{MAC}_{GW_{t}},\ \omega_{t})\), constrained node \(CN_{\bar{i}}\) computes \((sk^{\prime}_{GW_{t}\leftrightarrow CN_{\bar{i}}})\), \(K^{\prime})\) and verifies \(\textit{MAC}_{GW_{t}}\). If result of verification is true, constrained node \(CN_{\bar{i}}\) computes \(\textit{MAC}_{CN_{\bar{i}}}\) and sends \(\textit{MAC}_{CN_{\bar{i}}}\) to gateway node \(GW_{t}\).  
\[sk^{\prime}_{GW_{t}\leftrightarrow CN_{\bar{i}}}=H_{3}(T_{s_{\bar{i}}}( \omega_{t})\ \text{mod}\ p) \tag{17}\]  
\[K^{\prime}=(P_{i}||Q_{0})\bigoplus(P_{\bar{i}}||Q_{\bar{i}})\bigoplus(P_{t}|| Q_{\bar{i}})\bigoplus(sk^{\prime}_{GW_{t}\leftrightarrow CN_{\bar{i}}}|| \omega_{t}) \tag{18}\]  
\[h_{K^{\prime}}(P_{t},\ P_{\bar{i}j},\ \mu_{\bar{i}})\ \text{?}\ =\ \textit{MAC}_{GW_{t}} \tag{19}\]  
\[\textit{MAC}_{CN_{\bar{i}}}=h_{sk^{\prime}_{GW_{t}\leftrightarrow CN_{\bar{i} }}}(P_{\bar{i}j},\ P_{t},\omega_{t}) \tag{20}\]  
Step 5: Upon receiving \(\textit{MAC}_{CN_{\bar{i}}}\), gateway node \(GW_{t}\) verifies \(\textit{MAC}_{CN_{\bar{i}}}\). If the result of verification is true, mutual authentication and key agreement is completed.  
\[h_{sk_{GW_{t}\leftrightarrow CN_{\bar{i}}}}(P_{\bar{i}j},\ P_{t},\omega_{t}) \ \text{?}=\textit{MAC}_{CN_{\bar{i}}} \tag{21}\]