1. Introduction
Within the rapidly evolving Internet of Things (IoT) ecosystem, where interconnected devices generate and exchange sensitive data, ensuring robust security and privacy is paramount. Modular exponentiation, a fundamental operation underpinning publickey cryptosystems like RSA, plays a pivotal role in safeguarding data during transmission and storage.
The Rivest–Shamir–Adleman (RSA) algorithm, a cornerstone of publickey cryptography, leverages the computational difficulty of factoring large prime numbers. This intrinsic complexity forms the basis for its robust security, enabling secure key exchange and encrypted communication across diverse applications.
However, within the realm of IoT devices, limited processing power and resource constraints pose a significant challenge. Efficiently executing computationally intensive operations like modular exponentiation, crucial for utilizing RSA’s full potential, often proves difficult for these resourceconstrained devices.
Cloud computing emerges as a viable solution, offering ondemand access to vast computational resources through a payperuse model. By outsourcing computationally demanding tasks like modular exponentiation to a thirdparty cloud server, even resourcescarce IoT devices can leverage the power of RSA for robust data security. This costeffective approach ensures their uninterrupted participation in secure communication protocols without compromising performance or energy efficiency.
However, outsourcing sensitive data to a cloud service introduces a new layer of security considerations. Maintaining data integrity and confidentiality while utilizing cloud resources necessitates the implementation of robust security measures, such as a “secure outsourcing” of computation.
By effectively navigating the interactions between IoT devices and the cloud, we can leverage the combined strengths of both to achieve a future where secure and efficient communication becomes the cornerstone of a truly connected world.
1.1. Related Works
The exploration of outsourcing computationally expensive tasks has been a primary focus for researchers over an extended period. Broadly, research on outsourcing computation is progressing along two distinct trajectories.
One outsourcing model, proposed by [
1,
2], aims to evaluate any computational function and resolve all outsourcing computations concurrently. However, this model relies on complex cryptographic tools, rendering it timeconsuming and costly.
In contrast, another model targets specific outsourcing tasks. For instance, refs. [
3,
4] proposed taskspecific outsourcing for polynomial evaluation, while refs. [
5,
6,
7] focused on modular exponentiation. This model concentrates on particular computational tasks.
Modular exponentiation has consistently been at the forefront of cryptographic tools, primarily utilized for ensuring secure communication, key exchange protocols, message authentication, and more. Within cryptographic algorithms based on the discrete logarithm, modular exponentiation emerges as a complex and widely employed operation. Numerous studies have focused on securely outsourcing modular exponentiation. Hohenberger and Lysyanskaya [
5] introduced the pioneering solution under the assumption of one malicious entity in a twoserver model. Chen et al. [
6] proposed a more efficient algorithm under the same assumption, including an initial algorithm targeting the outsourcing of simultaneous modular exponentiations. Ding et al. [
8] proposed an outsourcing algorithm aiming to achieve a high level of checkability of the cloud’s output. Zhou et al. [
9] presented a secure outsourcing algorithm for exponentiation under a single untrusted program model, incorporating a secure verification scheme with elevated checkability. However, Rangasamy and Kuppusamy [
10] identified a vulnerability in the ExpSOS algorithm, where its security could be compromised if two modular exponentiations with the same exponent were delegated to the server. Ren et al. [
11] proposed two algorithms for outsourcing modular exponentiation capable of detecting malicious behaviors of servers. Subsequently, Su et al. [
12] introduced two new algorithms for outsourcing single as well as composite modular exponentiation using a single untrusted cloud. Nevertheless, Bouillaguet et al. [
13] conducted a cryptanalysis on all existing outsourcing schemes (including Su et al. [
12]) and proposed latticebased attacks to breach security in all the existing schemes of outsourcing modular exponentiation.
Additionally, research has explored outsourcing applications of modular exponentiation. For instance, Zhang et al. [
14] devised a secure outsourcing algorithm for RSA decryption, involving modular exponentiation. Furthermore, Hu et al. [
15] proposed a modification to the cloud computing phase of the ExpSOS algorithm [
9], employing Parallel Binary Modular Exponentiation (PBME) for cloudside computation. Hu et al. [
15] also applied their algorithm to outsource the computation of modular exponentiation necessary for secure message communication between two users,
${U}_{1}$ and
${U}_{2}$, using the RSA algorithm.
1.2. Our Contributions
In this work, we first take a critical view of the most wellknown outsourcing protocol, Hu et al. [
15] outsourcing protocol for the RSA algorithm, and then address the security issues related to their outsourcing modular exponentiation algorithm. The work can be summarized as follows:
Overview: Provides a comprehensive overview of Hu et al.’s outsourcing protocol for the RSA algorithm [
15].
Flaws and Deficiencies: Identify the flaws and security deficiencies in Hu et al.’s protocol.
Proposed Solution: Introduces a novel solution to rectify these deficiencies, supported by an indepth security and performance analysis.
Verification in Malicious Cloud: Incorporates the omitted verification steps in Hu et al. ’s protocol, considering a fully malicious cloud environment [
16].
We have assumed a security and system model similar to Hu et al. ([
15], Section II). These definitions are widely used and were proposed by Hohenberger and Lysyanskaya [
5].
2. Description of Hu et al. [15] Protocol
To start with, we investigate Hu et al. ’s outsourcing algorithm, which involves a resourcelimited user
U delegating the task of computing modular exponentiation
to a trustworthy yet curious cloud
C, where
b is the base and the exponent
e and the modulus
$N=pq$ with
p and
q being two distinct large primes.
The cloud computing approach suggested by Hu et al. [
15] relies on the Binary Modular Exponentiation (BME) algorithm, which represents the exponent
e in binary form. Algorithm 1 contains the pseudocode for the BME algorithm. In Algorithm 1, the base is taken as
${B}_{base}$, the exponent
${E}_{exp}={({e}_{n1}{e}_{n2}\cdots {e}_{1}{e}_{0})}_{2}$ is considered in binary form (i.e.,
${e}_{i}=0$ or 1), and the modulus is chosen as
N. Algorithm 1, proposed by Hu et al., provides the result
${R}_{result}={B}_{base}^{{E}_{exp}}\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}N$ for the inputs
${B}_{base}$,
${E}_{exp}$ and modulus
N.
Algorithm 1 The algorithm BME [15] 
Input: A base ${B}_{base}$, the exponent ${E}_{exp}={({e}_{n1}{e}_{n2}\cdots {e}_{1}{e}_{0})}_{2}$ in binary representation, the modulus N Output: ${R}_{result}={B}_{base}^{{E}_{exp}}\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}N$${R}_{result}\leftarrow 1$ // Initialize result to 1 for $i=n1$ to 0 do // Loop through each bit of the exponent (reverse order) ${R}_{result}\leftarrow {R}_{result}^{2}\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}N$ // Square the result and take modulo N if ${e}_{i}=1$ then ${R}_{result}\leftarrow {R}_{result}\xb7{B}_{base}\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}N$ //Multiply by base ${B}_{base}$ if ${e}_{i}$ is 1, and take modulo N end return ${R}_{result}$ // Return the final result

Subsequently, Hu et al. [
15] provided a parallel computing algorithm for cloudside computation. This algorithm, Parallel Binary Modular Exponentiation (PBME), described in Algorithm 2, is a parallel computing algorithm extension of Algorithm 1 with each component of the output
${X}_{result}=({x}_{0},{x}_{1},\cdots ,{x}_{n1})$ computed parallelly.
As follows from Algorithm 2, for the exponent
${E}_{exp}={({e}_{n1}{e}_{n2}\cdots {e}_{1}{e}_{0})}_{2}$, if
${e}_{i}=1$, then
${x}_{i}$ takes the value
${B}_{base}$ and squares it
i times, or else if
${e}_{i}=0$, then
${x}_{i}$ takes the value 1. Here,
${x}_{i}$’s are the results of each parallel computation and collectively
Algorithm 2 The algorithm PBME [15] 
Input: A base ${B}_{base}$, the binary representation of the exponent ${E}_{exp}={({e}_{n1}{e}_{n2}\cdots {e}_{1}{e}_{0})}_{2}$, the modulus N Output: ${X}_{result}=({x}_{0},{x}_{1},\cdots ,{x}_{n1})$for $i=0$ to $n1$ do // Loop through each bit of the exponent if ${e}_{i}\ne 0$ then // Check if the current bit is nonzero ${x}_{i}\leftarrow {B}_{base}$; // Initialize ${x}_{i}$ with base ${B}_{base}$ for $j=1$ to i do // Square ${x}_{i}$, i times ${x}_{i}\leftarrow {x}_{i}^{2}\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}N$; // Square ${x}_{i}$ and take modulo N end for // End of inner loop else // If the current bit is zero ${x}_{i}\leftarrow 1$; // Set ${x}_{i}$ to 1 end if // End of if statement end for // End of outer loop return ${X}_{result}$ // Return the resulting array ${X}_{result}$

Hu et al. introduced Algorithm 2 for achieving secure parallel outsourcing of modular exponentiation. This algorithm allows a user U to delegate the task of computing modular exponentiation of the base b, exponent e, and modulus N to an honestbutcurious cloud C to compute the result $R={b}^{e}\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}N$. The secure outsourcing of modular exponentiation is illustrated in Algorithm 3.
To provide an overview, Algorithm 3 entails the following steps:
User U generates a secret key to conceal the modulus N.
Encrypting the base b and exponent e as B and E, respectively.
Outsourcing the computation of modular exponentiation to the cloud C for the encrypted system.
Eventually, retrieving the original problem’s result from the encrypted result.
Algorithm 3 Hu et al.’s outsourcing model [15] 
Input: The base and exponent $b,e\in {\mathbb{R}}_{N}$, the modulus N Output: The result $R={b}^{e}\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}N$ Key Generation: $KeyGen({1}^{k},N)\to (p,L)$ U selects a large prime p at random and computes $L\leftarrow pN$, then keeps the secret key $SK=\{p,N\}$ and public key $PK=\left\{L\right\}$. Encryption: $Enc(b,e)\to (B,E)$U selects random integers $r,k\in {\mathbb{R}}_{N}$. U computes $B\leftarrow (b+rN)\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}L$, $E\leftarrow e+k\varphi \left(N\right)$. U outsources $(B,E,PK)$ to the cloud. Computing Outsourcing: $C(B,E,PK)\to {R}_{1}$C computes ${R}_{1}\leftarrow C(B,E,PK)={B}^{E}\left(\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}L\right)$ Exponent E is presented in binary form, and each part is computed in parallel using Algorithm 2. C gets the product of all parts and returns the result ${R}_{1}$ to U. Decryption: $Dec({R}_{1},SK)\to R$ U computes $R\leftarrow Dec({R}_{1},SK)={R}_{1}\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}N$ 
As RSA is an application of modular exponentiation, Hu et al. utilized Algorithm 3 to delegate the computation of the RSA cryptosystem for transmitting a plaintext T between two IoT devices, ${U}_{1}$ and ${U}_{2}$, which have limited resources.
The parallel secure outsourcing protocol for the RSA algorithm developed by Hu et al. ([
15], Protcol 2) involves taking the
plaintext message T, which
${U}_{1}$ wants to send to
${U}_{2}$, as input. To accomplish this,
${U}_{1}$ generates a keypair
$(e,d)$ for a modulus
$n=pq$, where
p and
q are two large primes such that
$ed\equiv 1\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}\varphi \left(n\right)$. Subsequently,
${U}_{1}$ delegates the computation of the RSA encryption to a cloud server, receives the result from the cloud, and forwards the encrypted message, the decryption key
d, and modulus
n to
${U}_{2}$. The detailed procedure of the algorithm is outlined in Algorithm 4 (exactly as mentioned in ([
15], Protocol 2)).
In an overview, Algorithm 4 illustrates the following:
${U}_{1}$ generates keys, i.e., a decryption key $K{P}_{2}=\{d,n\}$, secret key $SK=\{{p}^{\prime},T\}$, and public key $PK=\left\{L\right\}$
${U}_{1}$ encrypts the plaintext message T and exponent e as B and E, respectively.
${U}_{1}$ outsources the computation of ${B}^{E}\phantom{\rule{4.44443pt}{0ex}}\left(\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}L\right)$ to cloud C.
${U}_{1}$ forwards the decryption key $K{P}_{2}$ along with encrypted result ${F}_{1}$ to ${U}_{2}$.
${U}_{2}$ retrieves the original message F by decrypting the ecnrypted result ${F}_{1}$ using decryption key $K{P}_{2}$
Algorithm 4 Hu et al.s outsourcing for RSA algorithm [15] 
Input: The plaintext message T Output: The plaintext message F Key Generation: $KeyGen({1}^{k},T)\to (e,d,{p}^{\prime},L)$Enduser ${U}_{1}$ generates two large primes p and q and calculates $n\leftarrow pq$, $\varphi \left(n\right)\leftarrow (p1)(q1)$. ${U}_{1}$ chooses a random integer e as encryption key such that $gcd(e,\varphi (n\left)\right)=1$ and $2\le e\le \varphi \left(n\right)1$. ${U}_{1}$ computes d as decryption key such that $ed\equiv 1\left(\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}\varphi \right(n\left)\right)$ ${U}_{1}$ generates another large prime ${p}^{\prime}$ and computes $L\leftarrow {p}^{\prime}T$, then gets the decryption key $K{P}_{2}=\{d,n\}$, secret key $SK=\{{p}^{\prime},T\}$, and public key $PK=\left\{L\right\}$ Encryption: $Enc(T,e)\to (B,E)$U selects two random integers $r,k\in {\mathbb{R}}_{N}$ U computes $B\leftarrow (b+rN)$ and $E\leftarrow e+k\varphi \left(N\right)$ U outsource $(B,E,PK)$ to the cloud. Computing Outsourcing: $C(B,E,PK)\leftarrow {F}_{1}$Cloud C computes ${F}_{1}\leftarrow C(B,E,PK)={B}^{E}\left(\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}L\right)$. Exponent E is presented in a binary way, each part computed in parallel. C gets the product of all parts and sends the result ${F}_{1}$ to ${U}_{1}$. Message Forwarding: $\mathbb{F}({F}_{1},K{P}_{2})$Decryption: $Dec({F}_{1},K{P}_{2})\to F$ 
2.1. Drawbacks
Our analysis of Algorithms 3 and 4 reveals several security and usability drawbacks.
2.1.1. Algorithm 3
This algorithm closely resembles the ExpSOS algorithm by Zhou et al. [
9], differing only in cloud computation methods. However, Rangasamy and Kuppusamy [
10] presented a polynomialtime attack on ExpSOS that recovers the modulus
N when two modular exponentiations with the same exponent are delegated. This attack applies here as well, allowing any probabilistic polynomialtime (PPT) adversary to retrieve
N.
2.1.2. Algorithm 4
Several errors exist in Hu et al.’s RSA implementation:
Misinterpretation of RSA for message communication:
 –
The algorithm misinterprets the intended use of RSA for secure message communication.
Incorrect outsourcing protocol:
 –
The RSA outsourcing protocol is presented incorrectly. When using RSA for message transfer from sender ${U}_{1}$ to receiver ${U}_{2}$, ${U}_{2}$ (not ${U}_{1}$) generates the key pair $(e,d)$ and modulus $N=pq$ (p and q are large primes).
Public key misuse:
 –
The public key $(e,N)$ allows any user, including ${U}_{1}$, to send an encrypted message to ${U}_{2}$, who then uses the private key d for decryption. However, the algorithm claims ${U}_{1}$ generates $(e,d,N)$, requiring them to create a new key pair for each message, rendering it impractical and inefficient.
Insecure key transmission:
 –
${U}_{1}$ transmits the key pair (secret key) $K{P}_{2}=\{d,N\}$ along with the encrypted message ${F}_{1}$ through an insecure channel. This exposes the original message T to potential adversaries on the channel.
Computationally infeasible encryption:
 –
In the Encryption phase, ${U}_{1}$ computes $E\leftarrow e+k\varphi \left(N\right)$. However, if the RSA algorithm is to be correctly followed, ${U}_{1}$ lacks access to $\varphi \left(N\right)$, and computing it for any given N is infeasible for a resourceconstrained user.
Note 1. Deviations from Secure RSA Communication:
We highlight two key issues with Algorithm 4 alongside the drawbacks mentioned above regarding its adherence to the secure RSA message communication scheme:
1. Incorrect Key Distribution: Algorithm 4 assumes user ${U}_{1}$ has access to both the public key $(e,N)$ and the private key d. In RSA, only the receiver (${U}_{2}$ in this case) holds the private key, while the public key is widely distributed. Allowing ${U}_{1}$ access to d contradicts this fundamental principle and compromises message security.
2.
Inconsistent Plaintext Usage: The algorithm exhibits inconsistencies in its usage of the plaintext message T. Initially, T is correctly identified as the user’s plaintext. However, two errors emerge in subsequent stages:
Stage 4 of Key Generation utilizes the secret modulus L as ${p}^{\prime}T$, a meaningless expression as T is considered as plaintext, which further deviates from expected operations.
The Encryption phase employs b instead of T as the plaintext, further adding to the confusion and potentially leading to incorrect operations.
These inconsistencies, combined with the incorrect key distribution, render Algorithm 4 unsuitable for secure message communication and highlight the need for careful adherence to standard cryptographic protocols.
3. Reproducing Hu et al.’s Protocol for RSA
Considering the misinterpretation and typing mistakes in ([
15], Section VI, Protocol 2), we reproduce the protocol for secure message communication using the RSA algorithm while considering the following points:
In the scenario of secret message communication between two endusers ${U}_{1}$ and ${U}_{2}$, if ${U}_{1}$ wants to send a plaintext T securely to ${U}_{2}$, ${U}_{1}$ should use the public key $(e,N)$ generated by ${U}_{2}$.
${U}_{2}$ generates the key pair $(e,d)$ for a given modulus only once for the entire session of message transfer as e and N are made public for any user to send a message. Thus, the values of e, d, and N are fixed.
In practice, during message transfer, the value
e is chosen to be a very small integer compared to the security parameter, whereas the size of
d is almost as large as the modulus
N. Thus, RSA encryption is computationally less challenging for a user than RSA decryption. As Vergnaud [
17] mentioned, the encryption key is often a small key of a 16bit integer, and
e can take values up to
${2}^{16}+1=\mathrm{65,537}$.
First, we reproduce Hu et al.’s protocol for secure message communication using the RSA algorithm, where outsourcing the RSA decryption computation is performed with the help of an honestbutcurious cloud server C.
Note 2. We noticed that the outsourcing algorithm proposed by Hu et al. [15] assumes the cloud to be an honestbutcurious model. Therefore, the Verification step is missing in both the algorithms (Algorithms 3 and 4).
Algorithm 5 sketches the Hu et al. algorithm properly in terms of how it is supposed to be with proper interpretation of RSA communication and without any typographical errors.
Algorithm 5 Reproduced Hu et al. [15] outsourcing for RSA decryption 
Input: The plaintext T to be sent by ${U}_{1}$ Output: The plaintext T to be received by ${U}_{2}$ Key Generation: $KeyGen({1}^{k},N)\to (e,d)$${U}_{2}$ generates two large primes p and q ($p\ne q$) and computes $N=pq$ and $\varphi \left(N\right)=(p1)(q1)$. ${U}_{2}$ keeps p and q as secret. ${U}_{2}$ chooses a random integer e as public encryption key such that $gcd(e,\varphi (N\left)\right)=1$ and $2\le e\le \varphi \left(N\right)1$. ${U}_{2}$ computes d as private decryption key such that $ed\equiv 1\left(\mathrm{mod}\varphi \right(N\left)\right)$ ${U}_{2}$ makes the pair $(e,N)$ public, and keep d as secret. Encryption: $Enc(T,e)\to {T}^{e}\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}L$${U}_{1}$ generates a large prime ${p}^{\prime}$ and computes $L={p}^{\prime}N$ where secret key $SK=\{{p}^{\prime},N\}$, and public key $PK=\left\{L\right\}$. ${U}_{1}$ encrypt the plaintext T to $F={T}^{e}\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}L$. Message Forwarding: ${U}_{1}\to (F,L)\to {U}_{2}$Secure Outsourcing:${U}_{2}$ selects two random integers $r,k\in {\mathbb{R}}_{N}$ ${U}_{2}$ computes $B\leftarrow (F+rN)$ and $D\leftarrow d+k\varphi \left(N\right)$ ${U}_{2}$ outsource $(B,D,L)$ to the cloud. Computing Outsourcing: $C(B,D,L)\leftarrow {F}_{1}$Cloud C computes ${F}_{1}\leftarrow C(B,D,L)={B}^{D}\left(\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}L\right)$. C sends the result ${F}_{1}$ to ${U}_{2}$. Decryption: $Dec\left({F}_{1}\right)\to T$ 
Now, we present an attack on this reproduced Algorithm 5 of Hu et al. and claim that an adversarial cloud can learn the value $\varphi \left(N\right)$ (and hence the prime factors of N) while remaining an honest party.
3.1. Attack against Algorithm 5
In this section, we present an attack on the reproduced Hu et al. outsourcing protocol for secure message communication using the RSA algorithm. Our attack is based on multiple delegations and is similar to the attack by Rangasamy and Kuppusamy [
10] on the Zhou et al. [
9] protocol. We take into consideration the fact that both endusers,
${U}_{1}$ and
${U}_{2}$, have limited resources. For
${U}_{2}$, the values of
$e,d$, and
N are fixed because
$(e,N)$ is the public key that can be used by anyone to send a secret message to
${U}_{2}$, which also means that the value of
d remains the same throughout the communication. (
d is the modular inverse of
e modulo
$\varphi \left(N\right)$, which is unique. Since
$(e,N)$ is fixed, so is
d).
Now, we consider the user
${U}_{1}$ communicating two encrypted texts (
${T}_{1}$ encrypted to
${F}_{1}$ and
${T}_{2}$ encrypted to
${F}_{2}$ using the public exponent
e and the modulus
${L}_{1}={p}_{1}^{\prime}N$ and
${L}_{2}={p}_{2}^{\prime}N$) to
${U}_{2}$. Upon
Decryption,
${U}_{2}$ selects random integers
${r}_{1},{k}_{1},{r}_{2},{k}_{2}\in {\mathbb{R}}_{N}$ and computes
and outsources
$({B}_{1},{D}_{1},{L}_{1})$ and
$({B}_{2},{D}_{2},{L}_{2})$ to the cloud.
An adversarial cloud
${C}^{\prime}$ performs the operation
to obtain a multiple of
$\varphi \left(N\right)$. Given an RSA modulus
$N=pq$ and a multiple of its Euler’s totient function
$\varphi \left(N\right)$, Rabin’s PPT algorithm (Rabin et al. [
18]) produces the factorization
$(p,q)$ in anticipated polynomial time
$\mathcal{O}(log{\left(N\right)}^{3})$.
3.2. The Fix for Algorithm 5 against Our Attack
Here, we propose a modification to the outsourcing model proposed by Hu et al. [
15] for secure message communication using the RSA algorithm. To address the security issues in Algorithm 5, we introduce our fix to Algorithm 5 with proper interpretation of RSA communication.
Additionally, we consider a scenario where an enduser ${U}_{1}$ needs to send a secure message to another user ${U}_{2}$ with the help of an untrustworthy fully malicious cloud/server. Thus, we introduce the verification step that has been missing in Algorithms 4 and 5. We begin by considering the scenario where the end users ${U}_{1}$ and ${U}_{2}$ are resourceconstrained. User ${U}_{1}$ wants to send the message T to ${U}_{2}$.
3.2.1. Correctness of Algorithm 6
We demonstrate the validity of our solution for Hu et al.’s outsourcing model concerning the RSA algorithm. This clarification confirms that our algorithm adheres to the RSA communication assumptions and indeed provides accurate results when outsourced.
${U}_{2}$ computes $L={p}^{\prime}N$ for some random large prime ${p}^{\prime}$ and makes $(e,L)$ public and keeps d, ${p}^{\prime}$ and N as secret, where $ed\equiv 1\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}\varphi \left(N\right)$.
${U}_{1}$ computes $F={T}^{e}\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}L$ and sends it to ${U}_{2}$.
${U}_{2}$ computes $B=F+rN\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}L$ and $R={2}^{t}$ and $D\equiv dR\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}\varphi \left(N\right)$ (i.e., $D=dR+k\varphi \left(N\right)$ for some integer k).
${U}_{2}$ sends $(B,D,L)$ and $(B,t,L)$ to the cloud C.
C computes ${F}_{1}={B}^{D}\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}L$ and ${R}_{1}={B}^{R}\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}L$
This shows the correctness of our algorithm.
Algorithm 6 Our fix for Hu et al.’s Outsourcing Model for RSA algorithm 
Input: The plaintext T to be sent by ${U}_{1}$ Output: The plaintext T to be received by ${U}_{2}$ Key Generation: $KeyGen({1}^{k},N)\to (e,d)$${U}_{2}$ generates two large primes p and q ($p\ne q$) and computes $N=pq$ and $\varphi \left(N\right)=(p1)(q1)$. ${U}_{2}$ keeps p and q as secret. ${U}_{2}$ chooses a random integer e as public encryption key such that $gcd(e,\varphi (N\left)\right)=1$ and $2\le e\le \varphi \left(N\right)1$. ${U}_{2}$ computes d as private decryption key such that $ed\equiv 1\left(\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}\varphi \right(N\left)\right)$ ${U}_{2}$ computes $L={p}^{\prime}N$ where ${p}^{\prime}\in \mathbb{N}$ is a large prime. ${U}_{2}$ makes the pair $(e,L)$ public, and keep d as secret. Encryption: $Enc(T,e)\to {T}^{e}\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}L$Message Forwarding: ${U}_{1}\to F\to {U}_{2}$Secure Outsourcing:${U}_{2}$ selects a random integer $r\in \mathbb{Z}$. ${U}_{2}$ computes $B\leftarrow (F+rN)\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}L$ ${U}_{2}$ generates $R\leftarrow {2}^{t}$ for some fixed integer t and $D\leftarrow dR\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}\varphi \left(N\right)$. ${U}_{2}$ outsource the tuples $(B,D,L)$ and $(B,R,L)$ to the cloud. Computing Outsourcing: $C(B,D,L)\leftarrow {F}_{1}$, $C(B,R,L)\leftarrow {R}_{1}$Cloud C computes ${F}_{1}\leftarrow C(B,D,L)={B}^{D}\left(\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}L\right)$ and ${R}_{1}\leftarrow C(B,R,L)={B}^{R}(\mathrm{mod}L)$. C sends the result ${F}_{1}$ and ${R}_{1}$ to ${U}_{2}$. Verification: ${U}_{2}({F}_{1},{R}_{1},F)\to 0\cup 1$
Upon receiving ${F}_{1}$ and ${R}_{1}$ from cloud C, ${U}_{2}$ checks whether the results satisfy
Decryption: $Dec({F}_{1},{R}_{1},N)\to T$If the results ${F}_{1}$ and ${R}_{1}$ passes the verification step, ${U}_{2}$ proceeds for the decryption. ${U}_{2}$ calculates $T={F}_{1}\xb7{R}_{1}\left(\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}N\right)$ to get the plaintext T.

3.2.2. Security Analysis of Algorithm 6
We discuss the security of our proposed fix as outlined in Algorithm 6. We begin by listing the entities that are made public and can be accessed either by other users or the cloud.
The public exponent e and public modulus L are shared by ${U}_{2}$ publicly, where $L={p}^{\prime}N$.
It is assumed that the cloud knows all the abovementioned entities.
As evident from Algorithm 6, the equation representing the decryption process is given by:
where
D and
R have specific relations with
$\varphi \left(N\right)$ and
t, respectively.
The equation $D+R\equiv d+{k}_{1}\varphi \left(N\right)\phantom{\rule{4.44443pt}{0ex}}\left(\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}\varphi \left(N\right)\right)$ implies the existence of an integer ${k}_{1}$ such that the sum of D and R equals the sum of d and ${k}_{1}$ multiplied by Euler’s totient function of N ($\varphi \left(N\right)$).
If the cloud C has access to the value of $\varphi \left(N\right)$, it can compute the secret key of ${U}_{2}$ and breach its security.
However, our previously described attack in
Section 3.1 will not work since
D remains unchanged for multiple delegations (ref. Note 1).
Instead, we now discuss a potential passive attack that can be used to compute the value of $\varphi \left(N\right)$.
We follow the attack for exponent splitting as proposed by Mefenza and Vergnaud ([
19], Section 3). Using the values
e,
D, and
R, we obtain:
Thus, the polynomial $f(x,y)=1+x(N+y)$ has a root $({k}^{*},1pq)$ modulo ${e}^{\prime}$ where ${e}^{\prime}=e(D+R)$. However, the value $N=pq$ is not made public by ${U}_{2}$ and guessing the value N has probability $\frac{1}{\varphi \left(N\right)}$.
Another possible way to approach the attack is to take the polynomial
$f(x,y)=1+xy$ that has a root
$({k}^{*},\varphi \left(N\right))$ modulo
${e}^{\prime}$ (ref. Mefenza and Vergnaud [
19]). Here,
$y=\varphi \left(N\right)$ has the size
$y\simeq N$. Considering the sizes of
$e\simeq {N}^{\alpha}$,
$d\simeq {N}^{\beta}$,
$D\simeq {N}^{\delta}$,
${k}^{*}\simeq {N}^{\alpha +{\beta}_{1}+\delta}$, and
${e}^{\prime}\simeq {N}^{1+\alpha +{\beta}_{1}}$ (
$\beta =1+{\beta}_{1}$) and following the latticebased attack of Mefenza and Vergnaud [
19], we evaluate the condition for the existence of a solution to the equation
$f(x,y)=1+xy=0\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}{e}^{\prime}$ as:
where
$\mathcal{L}$ is the lattice of dimension
w that is generated using the polynomial
$f(x,y)$. However, since now
$y\simeq N$, we obtain the condition for having a solution to
$f(x,y)=0\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}{e}^{\prime}$ as:
which simplifies to:
Maximizing the value of
$\delta $ by taking
${\tau}_{\mathrm{max}}=12\delta $, the inequality transforms to:
This indicates that this attack is only possible when
$\alpha +{\beta}_{1}<1$. Since
$\alpha ,{\beta}_{1}$ are chosen to be positive numbers in our scheme, this attack will fail. This demonstrates that our scheme defeats the attack proposed by Mefenza and Vergnaud [
19], and the value
$\varphi \left(N\right)$ cannot be computed by any curious cloud.
The public modulus is given as $L={p}^{\prime}N$, where both ${p}^{\prime}$ and $N$ are kept secret by the user ${U}_{2}$. Thus, for two consecutive instances, the adversary will have ${L}_{1}={p}_{1}^{\prime}N$ and ${L}_{2}={p}_{2}^{\prime}N$, and with high probability $\mathrm{gcd}({L}_{1},{L}_{2})=N$. Thus, to avoid such a scenario, ${U}_{2}$ can fix the public modulus as $L={p}^{\prime}N$ for some fixed large prime ${p}^{\prime}$.
Note 3. The computation of $R={2}^{t}$ must be performed by the user ${U}_{2}$ [20]. There exist various methods to efficiently compute $R$. For example, the binary representation of ${2}^{t}$ is ${(100\cdots 000)}_{2}$ of bitlength $t+1$. Therefore, the value $R$ (and subsequently $D$) can be readily delegated to the cloud $C$ in its binary form. Cloud $C$ can execute the delegated task in a parallel environment using Algorithm 2. However, the computation of $D$ might raise concerns for a resourceconstrained device like ${U}_{2}$, as $D=dR\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}\varphi \left(N\right)$ necessitates modular operations. To alleviate the computation burden on ${U}_{2}$, $t$ can be chosen as an integer with a smaller bitsize (e.g., a 20bit integer). Furthermore, the value $R$ is computed only once for multiple delegations. It is permissible to select $t$ as a random 20bit integer for each delegation, although this may impact the algorithm’s efficiency.
3.3. Verification Analysis of Algorithm 6
In our scheme, user
${U}_{2}$ receives
${F}_{1}$ and
${R}_{1}$ from the cloud and verifies their correctness using the equation:
since
${U}_{2}$ already received
$F$ from
${U}_{1}$. While
Section 3.2.1 ensures this equation validates accurate results, we now explore its robustness against a malicious cloud attempting to bypass verification.
We consider a scenario where the cloud sends forged results
$\overline{{F}_{1}}$ and
$\overline{{R}_{1}}$, which still satisfy the verification equation:
This implies
for some integer
$m$. However, due to the modular operation with modulus
$N$, the verification still yields the correct result
$F\phantom{\rule{4.44443pt}{0ex}}\left(\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}N\right)$:
This demonstrates the inherent robustness of our verification scheme, even against manipulation attempts. The resemblance of our verification scheme to RSA signature authentication further strengthens its security foundation.
4. Performance Analysis
In this section, we detail the experimental application of our proposed algorithm. Our algorithm is coded in Python (version 3.9.12) within the Jupyter Notebook environment, utilizing the NumPy package for computational tasks. The computational operations on the users’ side ${U}_{1}$ and ${U}_{2}$ are executed on a system equipped with an Intel(R) Core(TM) i73770 processor running at 3.40 GHz with 8 GB RAM. On the cloud side, we leverage a GPU server labeled Tesla V100PCIE, equipped with NVIDIASMI and CUDA version $11.5$, 32 GB RAM.
For clarity and research focus, communication time between the cloud server and the local device is excluded from the results. Two reasons justify this:
Computational Dominance: Computational tasks significantly outweigh communication in terms of time expenditure.
Prediction Challenges: Accurately predicting communication time is difficult due to experimental setup limitations and research objectives.
We conduct experiments by executing the scheme across various moduli, ranging from 1024 to 4096 bits, with the base as the “plaintext” and exponent (e) set to $\mathrm{65,537}$ (a commonly used public key for RSA). To ensure more accurate computational time measurements, we carried out 20 trials for modulus size with specific bit size and subsequently computed their average.
Note 4. As the Hu et al. scheme is proven insecure and impossible to follow, we have not shown the comparison analysis with Hu et al.’s scheme. Additionally, Hu et al.’s protocol assumed the cloud server to be honestbutcurious and hence avoided the verification step. We have assumed the cloud to be untrustworthy and proposed a new verification scheme. Therefore, we have skipped the comparison of performance with Hu et al.s protocol. Instead, we provide evidence that our outsourcing scheme is more efficient in executing RSA communication in comparison to local execution.
Following Algorithm 6, we begin our experimental setup from the enduser
${U}_{2}$.
${U}_{2}$ generates the key pairs, i.e., private key (
$d,N,\varphi \left(N\right)$) and public key (
$e,L$). The experimental setup considers four different bit sizes (1024, 2048, 3072, and 4096 b) for the modulus size. We list out the computation times for the
Key Generation (
Table 1).
Using the public key (
$e,L$), user
${U}_{1}$ encrypts the plaintext
$T$ to
$F={T}^{e}\phantom{\rule{3.33333pt}{0ex}}\mathrm{mod}\phantom{\rule{0.277778em}{0ex}}L$. For experimental purposes,
$T$ is always taken as a 1000bit number (randomly generated) for all different modulus sizes. The computation times for user
${U}_{1}$ are listed below
Table 2.
Upon receipt of the transmitted ciphertext $F$, user ${U}_{2}$ chooses to securely delegate the decryption of $F$ to an untrustworthy cloud. We document the computational time for ${U}_{2}$ in the phases of Secure Outsourcing, Verification, and Decryption. Additionally, we record the computation time for ${U}_{2}$ for the same input when the decryption of ciphertext $F$ is conducted locally. Time units are measured in seconds.
As shown in
Table 3, our secure outsourcing scheme demonstrates efficient performance, accelerating the decryption process as the modulus size increases compared to local execution. For instance,
${U}_{2}$ requires only
$0.005318$ s to securely outsource the decryption task for a 3072bit modulus, whereas executing the decryption task itself takes
$0.548388$ s. This observation serves as evidence bolstering the efficiency of our algorithm. The acceleration in processing speed is evident from the “Speed Up” column in
Table 3, demonstrating the performance enhancement achieved through our algorithm.
In local execution, the decryption process occurs entirely within ${U}_{2}$’s system, without relying on the outsourcing services. This eliminates the need for ${U}_{2}$ to engage in cloudbased encryption, verification, and decryption steps. Instead, ${U}_{2}$ solely utilizes its computational resources to retrieve the message originally sent by ${U}_{1}$.
Figure 1 illustrates the graphical comparison between the ‘Total Time’ required for outsourcing and the time needed for decryption when executed ‘locally’. The data utilized for this comparison are sourced from
Table 3 (columns ‘Total Time’ and ‘Locally Executed’) and visualized in
Figure 1.
5. Conclusions and Future Scope
The RSA cryptosystem is a widely recognized and extensively employed cryptographic algorithm for secure data transmission. We conducted a comprehensive investigation of Hu et al.’s outsourcing algorithm for modular exponentiation and its usage in a message communication application using the RSA algorithm. Our analysis demonstrated the inadequacy and insecurity of Hu et al.’s algorithm. Moreover, we proposed a new modified algorithm for outsourcing RSA computations and provided a detailed security analysis of it. Additionally, we have also included the verification step that was missing in Hu et al.’s algorithm as we chose an untrustworthy malicious cloud.
While our work focused on secure message transmission through an insecure channel, future studies could explore reallife scenarios where encrypted messages are transmitted through noisy channels. Such channels introduce the risk of errors during transmission, necessitating additional measures like bit error correction. This area presents promising avenues for further research to ensure robust communication even in challenging environments.