## 5 Secure Key Agreement and Authentication Protocol for VCC
### Key Agreement and Authentication Phase  
The vehicle and RSU must have key agreement through generating the session key for secure communication among the RSU and other OBUs. Vehicle and RSU are authenticated by TA. If the TA checks that vehicle and RSUs are legitimate entities, vehicle and RSU generate a session key. The detailed steps are given below. See Figure 6.  
**Step 1:**: vehicle \(v_{i}\) inputs \(ID_{i}\) and \(PW_{i}\). Subsequently, \(v_{i}\) extracts \(b_{i}=BE_{i}\oplus h(ID_{i}||PW_{i})\) with stored values \(BE_{i}\) in the \(OBU_{i}\). \(v_{i}\) calculates \(PE=h(PW_{i}||b_{i})\), \(a_{i}=AE_{i}\oplus h(ID_{i}||PE_{i})\), \(HID_{i}=h(ID_{i}||PW_{i}||a_{i})\), \(HPW_{i}=h(HD_{i}||PW_{i})\), \(s_{i}=HPW_{i}\oplus A_{i}\), and \(MV_{i}=VI_{i}\oplus s_{i}\) and \(VS^{\prime}_{i}=h(HD_{i}||MV_{i}||s_{i})\). Then, \(v_{i}\) checks whether \(VS^{\prime}_{i}\stackrel{{\rm{?}}}{{=}}VS_{i}\). If valid, \(v_{i}\) selects a random number \(r_{i}\) and computes \(Auth_{1}=h(r_{i}||MV_{i})\) and \(M_{1}=MV_{i}\oplus r_{i}\). Finally, \(v_{i}\) sends the message \(\{Auth_{1},M_{1},HID_{i}\}\) to the concerned \(RSU_{i}\) via an insecure channel.  
Figure 6: Key agreement and authentication phase of our proposed protocol.  
**Step 2:**: \(RSU_{j}\) selects \(r_{j}\), and computes \(B_{i}=RB_{j}\oplus r_{j}\) and \(Auth_{2}=h(ID_{RSU_{j}}||RB_{j}||r_{j})\). Then, \(RSU_{j}\) sends the values \(\{Auth_{1},M_{1},HID_{i},B_{i},RA_{j},Auth_{2}\}\) to the \(TA\) via an insecure channel.
**Step 3:**: when \(TA\) receives the message from \(RSU_{j}\), \(TA\) computes \(MV^{{}^{\prime}}_{i}=h(HID_{i}||h(x||y))\), \(r_{i}=M_{1}\oplus MV_{i}\) and \(Auth^{{}^{\prime}}_{i}=h(r_{i}||MV_{i})\). Then, \(TA\) compares \(Auth^{{}^{\prime}}_{1}\) and \(Auth_{1}\). If they are equal, \(TA\) extracts the values \(RB_{j}=h(RA_{j}||h(x||y))\) and \(r_{j}=RB_{j}\oplus B_{i}\). \(TA\) computes \(Auth^{{}^{\prime}}_{2}=h(ID_{RSU_{j}}||RB_{j}||r_{j})\) and compares it with \(Auth_{2}\). If they are same, \(TA\) generates a new secret key \(y_{new}\). \(TA\) computes \(RB_{jnew}=h(RA_{j}||h(x||y_{new})\), \(C_{i}=RB_{j}\oplus r_{i}\), \(D_{i}=MV_{i}\oplus r_{j}\), \(E_{i}=RB_{jnew}\oplus r_{i}\), \(Auth_{3}=h(RB_{j}||r_{i})\) and \(Auth_{4}=h(MV_{i}||r_{j})\). Finally, \(TA\) sends the message \(\{C_{i},D_{i},E_{i},Auth_{3},Auth_{4}\}\) to \(RSU_{j}\) through an open channel.
**Step 4:**: after receiving the values from \(TA\), \(RSU_{j}\) extracts \(r_{i}=RB_{j}\oplus C_{i}\), \(RB_{jnew}=r_{j}\oplus E_{i}\) and computes \(Auth^{{}^{\prime}}_{3}=h(RB_{j}||RB_{jnew}||r_{i})\). Then \(RSU_{j}\) checks whether \(Auth^{{}^{\prime}}_{3}\) and \(Auth_{3}\) are equal or not. If they are equal, \(RSU_{j}\) updates \(RB_{j}\) to \(RB_{jnew}\) and generates the session key \(SK=h(r_{i}||r_{j})\). \(RSU_{j}\) sends the message \(\{D_{i},Auth_{4}\}\) to \(v_{i}\) via a public channel.
**Step 5:**: \(v_{i}\) extracts the value \(r_{j}=MV_{i}\oplus D_{i}\), computes \(Auth^{{}^{\prime}}_{4}=h(MV_{i}||r_{j})\) and checks whether \(Auth^{{}^{\prime}}_{4}\) and \(Auth_{4}\) are same or not. If they are equal, \(v_{i}\) computes the session key \(SK=h(r_{i}||r_{j})\). Finally, \(v_{i}\) and concerned \(RSU_{j}\) have the same session key.