Currently, Internet of Things (IoT)-based cloud systems face several problems such as privacy leakage, failure in centralized operation, managing IoT devices, and malicious attacks. The data transmission between the cloud and healthcare IoT needs trust and secure transmission of Electronic Health Records (EHRs). IoT-enabled healthcare equipment is seen in hospitals that have been implementing the technology for many years. Nonetheless, medical agencies fail to consider the security risk associated with healthcare IoT devices, which are readily compromised and cause potential threats to authentication and encryption procedures. Existing cloud computing methods like homomorphic encryption and the elliptic curve cryptography are unable to meet the security, identity, authentication, and security needs of healthcare IoT devices. The majority of conventional healthcare IoT algorithms lack secure data transmission. Therefore, fog computing is introduced to overcome the problems of IoT device verification, authentication, and identification for scalable and secure transmission of data. In this research manuscript, fog computing includes a hybrid mathematical model: Elliptic Curve Cryptography (ECC) and Proxy Re-encryption (PR) with Enhanced Salp Swarm Algorithm (ESSA) for IoT device verification, identification, and authentication of EHRs. ESSA is incorporated into the PR algorithm to determine the optimal key size and parameters of the PR algorithm. Specifically, in the ESSA, a Whale Optimization Algorithm (WOA) is integrated with the conventional Salp Swarm Algorithm (SSA) to enhance its global and local search processes. The primary objective of the proposed mathematical model is to further secure data sharing in the real time services. The extensive experimental analysis shows that the proposed model approximately reduced 60 Milliseconds (ms) to 18 milliseconds of processing time and improved 25% to 3% of reliability, compared to the traditional cryptographic algorithms. Additionally, the proposed model obtains a communication cost of 4260 bits with a memory usage of 680 bytes in the context of security analysis.