The premise of the Internet of Things (IoT) is not only to connect computers and mobile devices, but also interconnect smart buildings, homes, and cities, as well as electrical and water grids, automobiles, and airplanes. IoT will lead to the development of a wide range of advanced information services that need to be processed in real-time and require data centers with large storage and computing power. The integration of IoT with Cloud Computing can bring not only the required computational power and storage capacity, but they enable IoT services to be pervasive, cost-effective, and can be accessed from anywhere using any device (mobile or stationary). However, IoT infrastructures and services will introduce grand security challenges due to the significant increase in the attack surface, complexity, heterogeneity and number of resources. In order to deal with such challenges, in this paper we introduce an IoT Framework to build trustworthy and secure IoT applications and services. The framework enables developers to consider security issues at all IoT levels and integrate security algorithms with the functions and services offered in each layer instead of considering security in an ad-hoc and afterthought manner. We show the applicability of our methodology to secure and protect IoT services at cloud level.