<span>A cyber-physical system (CPS) is a combination of physical components with computational elements to interact with the physical world. The integration of these two systems has led to an increase in security concerns. Traditional encryption algorithms designed for general-purpose computing environments may not adequately address the distinct challenges of CPS, such as limited processing power, delay, and resource-constrained hardware. Therefore, there is a pressing need to develop an encryption algorithm that is optimized for CPS security without compromising the critical real-time aspects of these systems. This research has designed a modified encryption technique named the advanced encryption standard in galois counter mode with nonce and rivest-shamir-adleman algorithm (AESGNRSA). A smart medical system is designed to monitor the health of remotely located patients. The AESGNRSA algorithm is applied to the three servers of this system. The data of 1.5 lakh patients is fed to this system to verify the effectiveness of the AESGNRSA algorithm. The performance parameters like encryption and decryption time, encryption and decryption throughput, and encrypted file size are calculated for the AESGNRSA algorithm. The comparative analysis proved that AESGNRSA has the highest performance as compared to other algorithms and it can protect CPS against many cyber-attacks.</span>