To deliver security services (integrity, confidentiality, authentication, availability), it is necessary that the communicating nodes share cryptographic keys for encryption and authentication. However, it is well known that the encryption systems represent the first line of defense against all types of attacks. Furthermore, cryptographic techniques must be designed to detect the execution of the most dangerous attacks. In addition, these techniques must be small to fit the limited resources of the WSN. The aims of this chapter are to discuss the mechanisms used to secure communications; to show their main adaptations required for adoption in smart sensors, which are described in the literature, particularly in terms of key management and distribution; and finally, to detail the different solutions proposed in the literature to secure the communication of smart and constrained sensor networks in the internet of things based on cryptography and intrusion detection systems.