With the rapid development of Internet of Things (IoT) technology, Narrowband IoT (NB-IoT) has been widely adopted in smart cities, smart homes, and industrial automation due to its low power consumption, wide coverage, low cost, and high reliability. However, the associated security issues have become a critical factor hindering its further development. This paper aims to explore the security challenges in NB-IoT communication networks using encryption algorithms. Through theoretical analysis and model construction, a comprehensive security solution is proposed. Initially, the paper reviews the fundamental principles and application scenarios of NB-IoT, analyzing the current challenges in network security, including data leakage, device tampering, and man-in-the-middle attacks. Subsequently, a security framework based on lightweight encryption algorithms is introduced, leveraging the strengths of both symmetric and asymmetric encryption to ensure security while reducing computational and communication overheads. Additionally, the application of blockchain technology in NB-IoT security is discussed, enhancing data credibility and system resilience against attacks through its decentralized nature. Theoretical derivations and simulation analyses confirm the effectiveness and feasibility of the proposed security framework. The results demonstrate that this framework significantly enhances the security performance of NB-IoT networks, providing theoretical support and practical guidance for the secure development of IoT.