The integration of the Internet of things and dynamic vehicles has become unavoidable in advanced transportation systems. The vehicles communicate wirelessly with other vehicles, cloud servers, and roadside units via open communication channels. The openness of the above-mentioned entities and their communication tools introduces new difficulties, such as data privacy, vulnerabilities, data integrity, and scalability. To enhance data privacy and ensure security, a lightweight authenticated privacy-preserving secure framework is presented in the Internet of vehicles deployment. The proposed scheme can achieve confidentiality, privacy, authenticity, integrity, anonymity, and perfect forward secrecy based on blockchain technology, elliptic curve cryptography, and a one-way hash function. The proposed framework is secure against well-known cyberattacks, including replay attacks, man-in-the-middle attacks, traffic analysis attacks, and DDoS attacks. The security analysis shows the robustness of the proposed scheme. Finally, the results demonstrate that the proposed framework is efficient and feasible in practice.