# A V2V Identity Authentication and Key Agreement Scheme Based on Identity-Based Cryptograph
## 6 Security Analysis and Experimental Validation
### Experimental Validation  
Based on the preliminary research, we establish an experimental validation environment according to the V2V identity authentication and key agreement scheme proposed in this paper. We use software to simulate the KMC which is used to generate the equipment private key according to the equipment public key. The cryptographic algorithm uses SM9. We simulated C-V2X equipment (vehicle) with a computer which installed self-developed software. The software is developed by C/C# language in the Microsoft Visual Studio environment. The experimental validation environment architecture is shown in Figure 4.  
The experimental process is divided into three steps: initialization process, identity authentication and key agreement process, and encryption communication process. In the initialization phase, we first set the VIDs for Vehicle A and Vehicle B, respectively. Here, Vehicle 1 VID is \"010001A010100001000001000010001\", and Vehicle 2 VID is \"010001A0101000010000020100001\". Then, Vehicle A and Vehicle B apply for the equipment private key from the respective KMCs. The KMC calls the private key generation function (GetPrivateKey) of the SM9 algorithm, uses the VID as a parameter, and generates the private key corresponding to the VID. The KMC gives the private key to the vehicle in an internal security way (here, the private key is imported to the vehicle using offline media). The initialization of the equipment is complete. In the identity authentication and key agreement phase, Vehicle A sends an authentication request to Vehicle B. Vehicle A generates authentication data (including random number, \(r1\), system time, \(T\), etc. ), calls the encryption function (Encrypt) of the SM9 algorithm and uses the Vehicle B public key (_VID B_) as the encryption key to encrypt the authentication data, and sends it to Vehicle B. Vehicle B receive data from Vehicle A, calls the decryption function (Decrypt) of the SM9 algorithm and uses the Vehicle B private key (obtained from KMC and stored locally) as the decryption key to decrypt the data, and  
Figure 4: Experiment Environment. verifies whether the time has expired. Vehicle B generates authentication data (including random number, \(r2\), etc. ), calls the encryption function (Encrypt) of the SM9 algorithm and uses the Vehicle A public key (_VID A_) as the encryption key to encrypt the authentication data, and sends it to Vehicle A. Vehicle A call the decryption function (Decrypt) of the SM9 algorithm and uses the Vehicle A private key (obtained from KMC and stored locally) as the decryption key to decrypt the response data, verifies whether the time has expired, obtains the authentication data, and verifies the authentication data. Vehicle A uses the authentication data to calculate the working key (\(r1\) XOR \(r2\)), calls the encryption function (Encrypt) of the SM4 algorithm and uses the working key as the encryption key to encrypt the authentication success message (\"success\"), and sends the message to Vehicle B. Vehicle B uses the same method to calculate the working key, decrypt the data, and obtain the authentication success message (\"success\"); the authentication is successful. In the encryption communication phase, Vehicle A uses the working key with the SM4 cryptographic algorithm to encrypt the communication data and send it to Vehicle B. Vehicle B uses the working key to decrypt the data and obtain plaintext information. The experiment simulates the identity authentication and key agreement process between the equipment and proves the scheme is effective and can be applied in the vehicle networking system. The experiment uses C/C# language to program and realize the vehicle authentication process. The authentication process simulation with software is shown in Figure 5.  
This scheme based on identity-based cryptograph technology, uses the VID as the equipment public key, does not need to establish a CA, and does not need certificate management.