This project was tested with the OBU, RSU, and Attacker running on three different laptops. All three laptops must be connected to the same network. If you are setting it up on a new network, replace every localhost connection with the IP address of the laptop running the RSU service.
Install the required library first:
pip install cryptographyIf your environment uses a virtual environment, activate it before running the command above.
- Generate a key pair on each laptop:
python generate_keys.py-
Exchange only the public key PEM files between the laptops (for example,
obu_public.pemandrsu_public.pem). Keep each private key PEM file on its own machine. -
Update the connection address in
obu.pyandAttacker.pyto use the IP address of theRSUlaptop instead oflocalhost.Replace:
conn.connect(("localhost", 9999))with the IP address of the `RSU` laptop, for example:
conn.connect(("192.168.1.10", 9999))- Start the
RSUlaptop first:
python rsu.py- Start the
OBUlaptop:
python obu.py- Start the
Attackerlaptop if you want to test the attack scenario:
python attacker.pyDuring a normal run, the terminals should show:
generate_keys.py: key files are created for each laptop.RSU: listening on port9999, vehicle connected, OBU identity verified, and a session key established.OBU: connected to the RSU, challenge nonce sent, RSU identity verified, and a session key established.
When the attacker scenario is launched, the attacker terminal prints the impersonation attempt, and the RSU terminal should reject the fake message with an alert such as invalid signature, tampered packet, or replay attack detected.
The project presentation gives an overview of the project goals, implementation approach, experimental setup, and key findings. You can view or download it here:
Below are thumbnails of all slides. Click any image to open the full presentation PDF.










