The role that vehicular fog computing based on the Fifth Generation (5G) can play in improving traffic management and motorist safety is growing quickly. The use of wireless technology within a vehicle raises issues of confidentiality and safety. Such concerns are optimal targets for conditional privacy-preserving authentication (CPPA) methods. However, current CPPA-based systems face a challenge when subjected to attacks from quantum computers. Because of the need for security and anti-piracy features in fog computing when using a 5G-enabled vehicle system, the L-CPPA scheme is proposed in this article. Using a fog server, secret keys are generated and transmitted to each registered car via a 5G-Base Station (5G-BS) in the proposed L-CPPA system. In the proposed L-CPPA method, the trusted authority, rather than the vehicle’s Onboard Unit (OBU), stores the vehicle’s master secret data to each fog server. Finally, the computation cost of the suggested L-CPPA system regards message signing, single verification and batch verification is 694.161 ms, 60.118 ms, and 1348.218 ms, respectively. Meanwhile, the communication cost is 7757 bytes.