# A Secure IoT-Based Authentication System in Cloud Computing Environment
## 3 Proposed Scheme
### Authentication Phase  
When the user \(U_{i}\) needs to retrieve services from the cloud server \(S_{j}\), this authentication must start to make sure of the legitimacy of both the user and the cloud server. After the authentication phase is completed, the user will negotiate a session key \(SK\). By this session key, \(U_{i}\) can connect with \(S_{j}\) securely. The processes of the authentication phase are shown as follows and Figure 3.  
Figure 1: The flowchart of the user registration phase. Figure 2: The flowchart of the cloud server registration phase. Step 1: When user \(U_{i}\) attempts to connect to cloud server \(S_{j}\), he/she inserts the smart card into a reader machine and keys in \(ID_{i}\) and \(PW_{i}\). Then, the smart card selects a random number \(r_{u}\) and calculates \(n_{i}=C_{3}\oplus h(ID_{i}||PW_{i})\). Then, the smart card checks \(h(ID_{i}||PW_{i}||n_{i})^{2}=C_{4}\) to verify the identity and password. If the verification passed, the smart card will calculate \(A_{i}=C_{1}\oplus h(ID_{i}||n_{i})\), \(B_{i}=C_{2}\oplus h(PW_{i}||n_{i})\), \(D_{1}=A_{i}\oplus r_{u}\), \(D_{2}=h(r_{u}||PID_{i}||ID_{cs})\oplus ID_{i}\), and \(D_{3}=h(ID_{i}||PID_{i}||r_{u})\). Finally, the smart card sends \(M_{1}=\{PID_{i},D_{1},D_{2},D_{3}\}\) to \(S_{j}\). Step 2: When \(S_{j}\) receives \(M_{1}\), \(S_{j}\) selects a new pseudo-identity \(PSID^{\prime}\) and a random number \(r_{s}\) to calculate \(D_{4}=A_{i}\oplus r_{s}\), \(D_{5}=h(r_{s}||PSID_{j}||ID_{cs})\oplus SID_{j}\), \(D_{6}=B_{i}\oplus PSID^{\prime}_{j}\oplus h(r_{s}||PSID_{j})\), and \(D_{7}=h(SID_{j}||PSID_{j}||PSID_{6})\). Then, \(S_{j}\) sends message \(M_{2}=\{M_{1},PSID_{j},D_{4},D_{5},D_{6},D_{7}\}\) to \(CS\). Step 3: Once \(CS\) receives \(M_{2}\), \(CS\) uses the secret key \(x\) to compute \(r_{u}=D_{1}\oplus h(PID_{i}||ID_{cs}||x)\) and \(ID_{i}=D_{2}\oplus h(r_{u}||PID_{i}||ID_{cs})\) and then checks whether \(ID_{i}\) is valid and \(D_{3}?=h(ID_{i}||PID_{i}||r_{u})\) or not. If the \(ID_{i}\) is in its database and \(D_{3}=h(ID_{i}||PID_{i}||r_{u})\), it means that \(U_{i}\) is legal. For the cloud server \(S_{j}\), \(CS\) uses the secret key \(x\) to compute \(r_{s}=D_{4}\oplus h(PSID_{j}||ID_{cs}||x)\), \(SID_{j}=D_{5}\oplus h(r_{s}||PSID_{j}||D_{cs})\), \(PSID^{\prime}_{j}=D_{6}\oplus h(SID_{j}||||x)\oplus h(r_{s}||STD_{j})\), and then checks whether \(SID_{j}\) is in the database and \(D_{7}=h(SID_{j}||||D_{cs}||x)\) and \(D_{7}=h(SID_{j}||||x)\) and \(D_{7}=h(SID_{j}||||x)\). Figure 3: The processes of the authentication phase. \(h(SID_{i}||PSID_{j}||PSID_{j}^{\prime}||PsID_{6})\). If both conditions hold, it means that \(S_{j}\) is legal. The processes of authentication phase will be stopped when any verification is wrong; otherwise, \(CS\) selects a random number \(r_{cs}\) to compute the session key \(SK_{cs}=h(r_{u}\oplus r_{cs}\oplus r_{cs})\) for this round. Subsequently, for \(S_{j}\), \(CS\) computes \(D_{8}=h(PSID_{j}^{\prime}||ID_{cs}||x)\oplus h(r_{s}||PSID_{j}^{\prime})\), \(D_{9}=h(PSID_{j}^{\prime}||r_{s}||PSID_{j})\oplus(r_{u}\oplus r_{cs})\), and \(D_{10}=h(SK_{cs}||D_{8}||D_{9}||h(SID_{j}||x))\). For \(U_{i}\), \(CS\) selects a new pseudo-identity \(PID_{i}^{\prime}\) to compute \(D_{11}=PID_{i}^{\prime}\oplus h(ID_{i}||x)\oplus h(r_{u}||ID_{i})\), \(D_{12}=h(PID_{i}^{\prime}||D_{cs}||x)\oplus h(r_{u}||PID_{i}^{\prime})\), \(D_{13}=h(PID_{i}^{\prime}||r_{u}||PID_{i})\oplus(r_{s}\oplus r_{cs})\), and \(D_{14}=h(SK_{cs}||D_{12}||D_{13}||h(ID_{i}||x))\). Finally, \(CS\) sends the message \(M_{3}\) = {\(D_{8}\), \(D_{9}\), \(D_{10}\), \(D_{11}\), \(D_{12}\), \(D_{13}\), \(D_{14}\)} to \(S_{j}\). Step 4: While \(S_{j}\) receives \(M_{3}\), \(S_{j}\) uses \(PSID_{j}^{\prime}\) and \(r_{s}\) to extract \((r_{u}\oplus r_{cs})\) from \(D_{9}\), i.e., \(r_{u}\oplus r_{cs}=D_{9}\oplus h(PSID_{j}^{\prime}||r_{s}||PSID_{j})\). Then, \(S_{j}\) checks \(D_{10}?=h(SK_{s}||D_{8}||D_{9}||B_{j})\), where \(SK_{s}=h(r_{u}\oplus r_{s}\oplus r_{cs})\).