The number of IoT devices around the world is quickly increasing. About 20 billion devices are expected to be connected to the Internet by 2020. While companies grow their market share bringing new IoT solutions, security issues are emerging as the most complex challenges to overcome. Additionally, to reduce the communication traffic among IoT devices and cloud-based solutions, and the response time for IoT time-dependent applications, the industry adopted a hierarchical paradigm based on edge computing. Edge-computing devices, with considerable storage and processing power, are strategically placed near sensor networks to process data, increasing the responsiveness of the system, especially for solutions with time constraints. In this scenario, attackers have a vast and diverse network of vulnerable devices with sufficient processing power and communication capabilities to potentially bring serious damage to cities and citizens around the world. Possible solutions require not only the integration of widely established security practices (e.g., cloud computing security solutions) but the adoption of innovative countermeasures. Possible solutions may include hardware digital signature and integrity verification to perform secure-boot, temporal, and spatial isolation using embedded virtualization, trusted communication among devices through blockchain technology, hardware-generated keys based on physical fingerprints, and the use of context information to provide context-aware security. Additionally, all these security mechanisms must be adequate to coexist on hardware-constrained devices. This chapter highlights such technologies and how they can be integrated to build secure architectures for the IoT.