## 4 The Proposed Scheme: LDAKM-EIoT
### Authentication and Key Agreement Phase  
The key management procedure helps to secure the authentication and key management among IoT devices and cloud servers by the involvement of a trusted edge node. The upcoming steps are essential to achieve this goal. **A1. **: When an IoT device, say \(D_{i}\), wants to initiate secure data transmission to a cloud server, first of all, \(D_{i}\) needs to compute the following parameters. \(D_{i}\) picks a random nonce \(r_{d_{i}}\) and current timestamp \(T_{1}\) and calculates \(M_{1}=h(AD_{i}||T_{1})\ \oplus r_{d_{i}}\) and \(M_{2}=h(AD_{i}||\ T_{1}||\ TID_{D_{i}}||RID_{D_  
**A3. **: After the arrival of message \(Msg_{2}\) at time \(T_{2}^{*}\), \(CS_{j}\) verifies the timeliness of \(T_{2}\) by checking if \(|T_{2}-T_{2}^{*}|\leq\Delta\)\(T\) is valid. After successful verification of \(T_{2}\), \(CS_{j}\) computes \(TID_{D_{i}}=TID_{D_{i}}^{\prime}\oplus h(ACS_{j}\,||T_{2})\), \(h(ren_{n_{1}}\,||T_{1}\,||AD_{i}\,||ID_{D_{i}}\,||r_{d_{i}}\,||TC_{D_{i}})=M_{3} \oplus h(ACS_{j}||\,RID_{CS_{j}})\) and \(M_{4}^{\prime}=h(TID_{D_{i}}\)\(||T_{2}\,||RID_{CS_{j}}\,||ACS_{j}\,||RID_{CS_{j}})\). After that, \(CS_{j}\) checks whether \(M_{4}^{\prime}=M_{4}\) is satisfied. If it is valid, the \(EN\) is authenticated by \(CS_{j}\). Otherwise, \(CS_{j}\) halts the session with the \(EN\) immediately. Furthermore, \(CS_{j}\) picks up a random nonce \(r_{cs_{j}}\) and current timestamp \(T_{3}\) and computes \(M_{5}=r_{cs_{j}}\oplus h(T_{2}||\,\,ACS_{j}||\,\,RID_{CS_{j}})\). Then, \(CS_{j}\) computes the session key shared with \(D_{i}\) as \(SK_{CS_{j}-D_{i}}=h(TID_{D_{i}}||\,\,T_{3}||\,\,h(ren_{n_{1}}\,||T_{1}\,||AD_{i} \,||ID_{D_{i}}\,||r_{d_{i}}\,||TC_{D_{i}})\)\(||h(r_{CS_{j}}\,||ACS_{j}\,||\,|ID_{CS_{j}}\,||T_{3})\), \(M_{6}=h(SK_{CS_{j}-D_{i}}\,||T_{3})\), and \(M_{7}=h(r_{cs_{j}}\,||T_{2}\,||T_{3}\,||ACS_{j}\,||RID_{CS_{j}})\). After computing these values, \(CS_{j}\) sends the message \(Msg_{3}=\{M_{5},\,M_{6},\,M_{7},\,T_{3}\}\) to the \(EN\) via an open channel. **A4. **: After arrival of message \(Msg_{3}\) at time \(T_{3}^{*}\), the \(EN\) verifies the timeliness of \(T_{3}\) by checking if \(|T_{3}-T_{3}^{*}|\leq\Delta\)\(T\) is valid. Upon successful validation of \(T_{3}\), the \(EN\) calculates \(r_{cs_{j}}=M_{5}\oplus h(T_{2}\,||ACS_{j}\,||RD_{CS_{j}})\) and \(M_{7}^{\prime}=h(r_{cs_{j}}||\,\,T_{2}||\,\,T_{3}||\,\,ACS_{j}||\,\,RID_{CS_{ j}})\). Next, the \(EN\) checks whether \(M_{7}^{\prime}=M_{7}\), and if it holds, \(CS_{j}\) is authenticated by the \(EN\). Otherwise, the \(EN\) halts the session with \(CS_{j}\) instantly. Furthermore, the \(EN\) selects a random nonce \(r_{en_{2}}\) along with current timestamp \(T_{4}\) and computes \(M_{8}=h(AD_{i}||TC_{D_{i}})\oplus h(ren_{n_{2}}\,||T_{4}),\,\alpha=h(RID_{D_{i} }\,||T_{C_{D_{i}}}\,||T_{4})\oplus h(ren_{n_{1}}\,||T_{1}\,||AD_{i}\,||ID_{D_{i }}\,||T_{C_{D_{i}}})\), \(\beta=h(r_{cs_{j}}||\,\,ACS_{j}||\,\,ID_{CS_{j}}\,||T_{3}\,\,\oplus h(h(ren_{n_{ 2}}\,||T_{4})\,\,||AD_{i}||TC_{D_{j}})\) and \(M_{9}=h(M_{6}||\,\,M_{8}||\,\,h(ren_{n_{2}}\,||T_{4})\,\,||T_{3}\,||T_{4})\). After computing these values, the \(EN\) picks a new temporary identity \(TID_{D_{i}}^{new}\) for \(D_{i}\) and calculates \(M_{10}=h(M_{9}\,\,||T_{3}\,\,||T_{4}\,\,|AD_{i}\,\,||TC_{D_{i}}\,\,||TID_{D_{i }})\oplus TID_{D_{i}}^{new}\). The \(EN\) also replaces \(TID_{D_{i}}\) with \(TID_{D_{i}}^{new}\) in its database. Finally, the \(EN\) sends the message \(Msg_{4}=\{M_{8},\,\alpha,\,\beta,\,M_{9},\,M_{10},\,T_{3},\,T_{4}\}\) to \(EN\) via an open channel. **A5. **: After arrival of message \(Msg_{4}\) at time \(T_{4}^{*}\), \(D_{i}\) verifies the timeliness of \(T_{4}\) by checking if \(|T_{4}-T_{4}^{*}|\leq\Delta\)\(T\) is valid.