# Authentication and Billing for Dynamic Wireless EV Charging in an Internet of Electric Vehicles
## 5 Proposed Authentication and Billing Scheme
### Registration and Authentication Phase  
When EV \(e\) enters the charging lane, it has to communicate with the CSC to obtain a pseudonym, \(p\in\mathcal{P}_{i}\), and a session key, \(k_{p}\in\mathcal{K}_{i}\). To authenticate with the CSC and obtain the session key, EV \(e\) sends its real identity and its energy demand, \(reqE\), in \(m_{3}\):\(\{t_{e},t_{e},reqE,\text{SIG}_{gk_{c}}\}\). To ensure the privacy of EV information, the calculation of the energy demand is performed on the on-board unit (OBU) of the EV, based on the current EV SoC, \(SoC_{0}\), the desired final SoC, \(SoC_{f}\), and the maximum EV battery capacity, \(E_{max}\), using the expression,  
\[reqE=(SoC_{f}-SoC_{0})E_{max}, \tag{1}\]  
where the desired final SoC is estimated by each EV based on its remaining trip distance, its average traveling velocity and the average EV energy consumption rate [6; 28]. The message \(m_{3}\) is then signed using the signing key of EV \(e\) and is encrypted using the public key of the CSC, \(E_{pk_{C}}(m_{3})\). In response, the CSC calculates the estimated number of charging segments, \(N\), that need to be activated to meet the energy demand of the EV, given the rated power of each charging segment owned by \(PO_{i}\), \(P_{rated_{i}}\), and the nominal driving velocity on the charging lane, \(v_{i}\), using the expression,  
\[N=\left\lceil\frac{reqE}{P_{rated_{i}}}\frac{v_{i}}{L_{i}}\right\rceil, \tag{2}\]  
where \(L_{i}\) is the length of each charging segment assuming equally sized segments, and \(\lceil.\rceil\) is used to round up to the nearest integer value of \(N\). The rated segment power and the nominal lane crossing velocity, \(v_{i}\), are assumed to be predetermined by the Charging Management and Coordination System (CMCS), which runs different supply and demand management programs to ensure grid load balancing and maximal demand coverage. Nevertheless, since this work particularly focuses on proposing a fast, reliable and privacy-preserving authentication and billing scheme for DWC systems, the specifications of the charging coordination process including load distribution and scheduling are beyond the scope of this work. Upon verifying that the EV energy demand can be addressed by \(N\leq\mathcal{S}_{i}\) segments on the DWC lane owned by \(PO_{i}\), the CSC selects a pseudonym \(p\) from the list of unassigned pseudonyms and sends it back to the EV \(e\) with the corresponding session key, \(k_{p}\), after signing the message with its key, \(m_{4}\):\(\{t_{e},t_{C},p,k_{p},\text{SIG}_{gk_{c}}\}\), and encrypting it with the EV public key, \(E_{pk_{c}}(m_{4})\). The CSC then activates a countdown timer, \(T\), and waits for a response from the EV, which shall include the hash chain request in \(m_{5}\):\(\{HashChReq,p,t_{e},SIG_{gk_{c}}\}\). In case of timer expiry, a timer expiry flag, \(f_{T}\), is shared with the EV, and the authentication processis terminated. The value of the timer, \(T\), must acknowledge the expected transmission delay for the communication between the EV and the CSC, yet must not be excessively long to avoid undesirable channel occupancy, which allows unauthorized channel access and leads to network congestion. If \(m_{5}\) is received before timer expiry, the CSC responds by generating a hash chain, \(\mathcal{H}_{i}^{N}(h_{0})\), where \(h_{0}\) is selected randomly. The CSC accordingly generates a number of hash keys sufficient to charge EV \(e\) according to the value of \(N\) estimated earlier by the CSC using Equation (2), based on the EV energy demand shared by the EV in \(m_{3}\). The message sent by the CSC is, \(m_{6}\):\(\{h_{0},h_{1},h_{2},\ldots,h_{N},t_{C},\text{SIG}_{gk_{C}}\}\) and is encrypted as \(E_{pk_{e}}(m_{6})\). When the EV receives the packet, it decrypts the message and verifies the signature of the CSC. If the verification succeeds, the EV stores the \(N\) hash keys to be used for authentication with the charging segments. Algorithm 1 presents the detailed procedure taking place at the CSC to register and authenticate the EVs.