This paper analyzes the impacts of various data integrity based cyber attacks on power electronic hardware present in electric vehicle (EV) chargers and proposes an universally applicable hardware-based countermeasure algorithm to protect the onboard charging (OBC) systems. The effectiveness of the proposed defense mechanism is comprehensively analyzed by testing the system against several recurring cyberattack triggered faults in the OBC. To evaluate the impact of various cyberattacks on the system, two different power electronic topologies of EV OBC are taken into consideration. Further on, single phase and three phase charger topologies are simulated in MATLAB/Simulink to comprehend the impact of various faults occuring as a result of different data integrity attack scenarios, and to validate the effectiveness of the proposed algorithm. Quantitative analysis of the results demonstrates that the proposed intelligent data processing algorithm, implemented in the charger's main controller, can be effectively used with different charging architectures / topologies proving its universal application against cyberattacks on the OBC systems.