Detection and Prevention of False Data Injection Attacks in the Measurement Infrastructure of Smart Grids