Cybersecurity and energy management in the smart grid