Securing the IoT from the network layer to the application layer