## 4 Secure Authentication and Prescription Safety Protocol
After receiving their network joining request, the TS generates shadow-IDs for each participant and stores them in its database. The shadow-IDs of each participant is to establish anonymous joining of the patient and doctor and to keep prescriptions and private data secret. SAPS is explored in a stepwise manner as follows. A. Step-I: Initialization by Patient (A)  
At the beginning, Patient (A) chooses a random number \(R_{p}\) from a finite field and computes secret parameters. After that, \(X_{A}\) is calculated by multiplying random number \(R_{p}\) by an ECC-based generator \(P\) of large order \(n\). Similarly, \(Y_{A}\) is the resultant of \(R_{p}\) and the TS's public key \(F\) that is \begin{table}
\begin{tabular}{l l} \hline \hline
**Notations** & **Descriptions** \\ \hline _TMIS_ & Telecare medical information system \\ \(E\) & A large-order finite field on elliptic curve \\ \(P\) & EC generator of a large order n \\ \(H(.)\) & Digestive Hash Function. \\ \(A\) & Patient that is participant A in TMIS \\ \(B\) & Doctor/nurse that is user B in TMIS \\ MAC & Message Authentication Code \\ \(E_{K_{A-TS}}\) & Pre-Shared key between TS and User A \\ \(E_{K_{B-TS}}\) & Pre-Shared key between TS and User B \\ \(T_{S}\) & Trusted Server as a trusted third party in TMIS \\ \(Pw_{P}\) & TS shared password for Patient \\ \(Pw_{D,N}\) & Doctor/Nurse password shared with TS \\ \(ID_{A}\), \(ID_{B}\), \(ID_{TS}\) & Masked Identities of A, B and TS respectively \\ \(E_{K_{TS-A/B}}\) & Temporary Encryption key between TS \& Ends \\ \(d\) & Private/Public key of TS \\ \(E_{E}(.)\), \(D_{k}(.)\) & Using key (k) perform Encryption/Decryption \\ \(T_{1}\), \(T_{2}\), \(T_{3}\) & User (A, B, TS) Time Stamp \\ \(N_{1}\), \(N_{2}\), \(N_{3}\) & User (A, B, TS) Nonce No \\ \(M_{A}\), \(M_{B}\) & Message at User A (Patient) \& B (Doctor/Nurse) \\ \(C_{A}\), \(C_{B}\) & Cipher Text at A and B \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Abbreviations and acronyms for Secure Authentication and Prescription Safety (SAPS). equal to \(dP\), where \(d\) is random number a from finite field selected by TS. For level 1 encryption of security credentials, a hash of \(Y_{A}\) is taken to prepare key \(H_{Y_{A}}\). Patient (A) prepares a message \(M_{A}\) that contains hash of IDs and \(PW_{p}\) as the patient's password and Message Authentication Code (MAC) is used for providing message integrity on the server side. Patient (A) calculates \(H(PW_{p}||ID_{A}||ID_{B})\) and includes PWp to keep it more secure. In our proposed scheme, an intruder is not able to get the IDs of A and B but if in any case these values are exposed, then the exact hash value cannot be calculated because of the missing PWp that is held by the Patient (A) and TS only. For transmission to the server, the patient computes cipher text \(P_{A}\) which is encrypted by the patient's generated secret key \(H_{Y_{A}}\) as shown in step (iv). After that, a cipher text \(C_{A}\) is generated using a pre-established key \(K_{A-TS}\). In step (vi), a temporary ID as \(ID_{A\_T}\) of the patient is obtained by taking the hash of the \(H(X_{A},\ P_{A},\ N_{1})\) and is used for the current session only. The new \(ID_{A\sim T}\) is never transmitted and can be calculated at the TS using \(H(X_{A},\ P_{A},\ N_{1})\) where \(N_{1}\) can be extracted after decryption. It encrypts the parameters \(\{X_{A},\ P_{A},\ T_{1}\}\) using \(K_{A-TS}\) where, \(T_{1}\) is timestamp. Patient (A) transmits \(\{ID_{A\sim T},\ C_{A}\}\) to trusted server \(\{TS\}\) for authentication. (i) \(X_{A}=R_{p}P\)  
(ii) \(Y_{A}=R_{p}F\)  
(iii) \(M_{A}=H(PW_{p}||ID_{A}||ID_{B})\)  
(iv) \(P_{A}=E_{H_{Y_{A}}}(ID_{A}||M_{A}||N_{1}||\) MAC\((M_{A})\ ||ID_{B})\)  
(v) \(C_{A}=E_{K_{A-TS}}(X_{A}||\ P_{A}||\ T_{1})\)  
(vi) \(ID_{A\sim T}=\{H(X_{A},\ P_{A}\,,N_{1})\}\)  
B. Step-II: Verification at Trusted Server  
Upon receiving \(\{ID_{A\sim T},\ C_{A}\}\) form Patient (A), the TS decrypts the cipher text \(C_{A}\) to get \((X_{A}||\ P_{A}||\ T_{1})\).