Data sharing services based on massive IoT data have been widely used in various fields such as health monitoring and image recognition, providing users with more reliable, efficient, and flexible data services and significantly improving the user service quality. With the popularization of IoT applications, the usage rate of IoT data is getting higher and higher. Due to the dangerous network environment, the security of IoT data faces challenges. On the one hand, attacks such as data tampering can lead to the failure of IoT tasks, and on the other hand, the intrusion of malicious users can lead to the collapse of the entire IoT network. In recent years, many protection schemes used for IoT data security have been proposed. However, security flaws still exist in these schemes. Therefore, to solve the data security and identity security issues in the IoT data sharing process, in this paper, we propose a TEE-and-Blockchain-supported IoT data sharing architecture(TEBDS), which combines on-chain and off-chain methods to meet the security requirements of the IoT data sharing framework. Therein, the consortium blockchain realizes the protection of on-chain IoT data and the access control of IoT users. An Intel SGX-based Distributed Storage System (SDSS) is proposed to secure off-chain data. Besides, an incentive mechanism is developed to facilitate the whole system. Security analysis shows that TEBDS meets the requirements of data security and identity security. Experimental results show that TEBDS has better performance than the centralized method SPDS.