Security and Privacy Issues in Sensor Networks and IoT