Encryption is one of the most critical and mandatory technique to provide security in outsourced data. Message passing is the most unsecure place of transfer of crucial information and these messages passing are made end-to-end encryption to avoid a centralised security agent to access the data. Existing methods of encryption only provide end-to-end encryption which is not feasible for certain situations like implementing authentication. When the end-to-end encryption is made, the messages are always not known to the central authentication agent like CBI, in this paper, we provide a two-side decryption algorithm that can be decrypted by two entities (one receiver and the other is the central authentication agent) thus improving the message passing security by allowing the centralised authentication agent to read the transferring words. We implemented this two-way decryption in trip database dataset, and the experiment results prove that our proposed algorithm improves the security of message passing of electronic medical records in public cloud while comparing with existing encryption algorithms. Thus we made with quantitative research based on the previous techniques compared based on the various types of key generation occurs in the algorithms. © 2021 Inderscience Enterprises Ltd.. All rights reserved.