Click here to load reader
Mar 30, 2019
International Journal of Network Security & Its Applications (IJNSA), Vol.6, No.4, July 2014
DOI : 10.5121/ijnsa.2014.6402 13
ANALYSIS OF RSA ALGORITHM USING GPU
PROGRAMMING
Sonam Mahajan1 and Maninder Singh
2
1Department of Computer Science Engineering, Thapar University, Patiala, India
2 Department of Computer Science Engineering, Thapar University, Patiala, India
ABSTRACT Modern-day computer security relies heavily on cryptography as a means to protect the data that we have
become increasingly reliant on. The main research in computer security domain is how to enhance the
speed of RSA algorithm. The computing capability of Graphic Processing Unit as a co-processor of the
CPU can leverage massive-parallelism. This paper presents a novel algorithm for calculating modulo
value that can process large power of numbers which otherwise are not supported by built-in data types.
First the traditional algorithm is studied. Secondly, the parallelized RSA algorithm is designed using
CUDA framework. Thirdly, the designed algorithm is realized for small prime numbers and large prime
number . As a result the main fundamental problem of RSA algorithm such as speed and use of poor or
small prime numbers that has led to significant security holes, despite the RSA algorithm's mathematical soundness can be alleviated by this algorithm.
KEYWORDS CPU, GPU, CUDA, RSA, Cryptographic Algorithm.
1. INTRODUCTION
RSA (named for its inventors, Ron Rivest, Adi Shamir, and Leonard Adleman [1] ) is a public
key encryption scheme. This algorithm relies on the difficulty of factoring large numbers which
has seriously affected its performance and so restricts its use in wider applications. Therefore, the
rapid realization and parallelism of RSA encryption algorithm has been a prevalent research
focus. With the advent of CUDA technology, it is now possible to perform general-purpose
computation on GPU [2]. The primary goal of our work is to speed up the most computationally
intensive part of their process by implementing the GCD comparisons of RSA keys using
NVIDIA's CUDA platform.
The reminder of this paper is organized as follows. In section 2,3,4, we study the traditional RSA
algorithm. In section 5, we explained our system hardware. In section 6,7,8, 9 we explained the
design and implementation of parallelized algorithm. Section 10 gives the result of our
parallelized algorithm and section 12 concludes the paper.
2. TRADITIONAL RSA ALGORITHM[1]
RSA is an algorithm for public-key cryptography [1] and is considered as one of the great
advances in the field of public key cryptography. It is suitable for both signing and encryption.
Electronic commerce protocols mostly rely on RSA for security. Sufficiently long keys and up-to-
date implementation of RSA is considered more secure to use.
International Journal of Network Security & Its Applications (IJNSA), Vol.6, No.4, July 2014
14
RSA is an asymmetric key encryption scheme which makes use of two different keys for
encryption and decryption. The public key that is known to everyone is used for encryption. The
messages encrypted using the public key can only be decrypted by using private key. The key
generation process of RSA algorithm is as follows:
The public key is comprised of a modulus n of specified length (the product of primes p and q),
and an exponent e. The length of n is given in terms of bits, thus the term 8-bit RSA key" refers
to the number of bits which make up this value. The associated private key uses the same n, and
another value d such that d*e = 1 mod (n) where (n) = (p - 1)*(q - 1) [3]. For a plaintext M
and cipher text C, the encryption and decryption is done as follows:
C = Me mod n, M = Cd mod n.
For example, the public key (e, n) is (131,17947), the private key (d, n) is (137,17947), and let
suppose the plaintext M to be sent is: parallel encryption.
Firstly, the sender will partition the plaintext into packets as: pa ra ll el en cr yp ti on. We
suppose a is 00, b is 01, c is 02, ..... z is 25.
Then further digitalize the plaintext packets as: 1500 1700 1111 0411 0413 0217 2415
1908 1413.
After that using the encryption and decryption transformation given above calculate the
cipher text and the plaintext in digitalized form.
Convert the plaintext into alphabets, which is the original: parallel encryption.
3. OPERATION [1]
The three steps of RSA algorithm Key Generation, Encryption and Decryption are explained as
follows:
3.1 Key generation
As explained above RSA is an asymmetric key encryption scheme. It makes use of two different
keys for encryption and decryption. The public key that is known to everyone is used for
encryption. The messages encrypted using the public key can only be decrypted by using private
key. The keys for RSA algorithm are generated as follows:
Figure 1. RSA Key Generation
International Journal of Network Security & Its Applications (IJNSA), Vol.6, No.4, July 2014
15
3.2 Encryption process
Alice transmits its public key (n,e) to the Bob and keeps the private key secret. Suppose Bob
wishes to send message M to Alice. He first convert the message M to an integer m , such that
m is between 0 and n using padding scheme [1][3]. Finally cipher text c is calculated as: C = me
mod n. This cipher text is then transmitted to Alice.
3.3 Decryption process
Alice can decode the cipher text using her private key component d as follows:
m = Cd mod n
Given m, original message M can be recovered.
3.4 Example
Figure 2. RSA Example
3.6 Modular exponential
3.6.1 Modular arithmetic
Public key cryptography is computationally expensive as it mostly includes raising a large power
to a base and then reducing the result using modulo function. This process is known as modular
exponential. In practical, RSA algorithm should be fast , i.e., modular exponential function should
be fast and along with it should be efficient. The simple modular operations are given in the
Figure 3.
Figure 3. Modular Arithmetic
3.6.2 Naive modular exponentiation
In this method modular multiplications are applied repeatedly. For example: with g=4, e=13 and
m= 497, the naive modular exponential will solve ge mod m as shown in figure and gives the
result as 445. This method is not efficient as it performs e-1 modular multiplications. In
cryptography the security depends on the larger value of e and efficiency depends how efficiently
these modular multiplications and modular exponential functions are solved. The plaintext ,
International Journal of Network Security & Its Applications (IJNSA), Vol.6, No.4, July 2014
16
cipher-text or even partial cipher text is supposed to be of large in value and it will require a large
amount of modular multiplications if we rely on this naive algorithm.
Figure 4. Naive Modular Exponentiation Example
3.6.3 Repeated square-and-multiply methods
It makes use of the fact that if the e value is even, then the modular exponential is calculated as
ge mod m =( ge/2 * ge/2) mod m ,hence by reducing the amount of modular multiplications to 2z
where z is the number of bits when converting e to binary form. The algorithm comes with two
forms as shown below.
Right-to-left binary modular exponential
Left-to-right binary modular exponential
This algorithm works efficiently for large value of e.
International Journal of Network Security & Its Applications (IJNSA), Vol.6, No.4, July 2014
17
Figure 5. Repeated Square-and-Multiply Methods
3.6.4 Left-to-right k-ary exponentiation
This algorithm is the generalization of the previous left-to-right binary modular exponentiation
described previously. In this algorithm each iteration processes more than one bit of the exponent
and works efficiently when pre-computations are done in advance and is used again and again.
Figure 6. Left-To-Right K-ary Modular Exponentiation
3.6.5 Sliding window exponential
The main idea behind this algorithm is the reduction of pre-computations as compared to the
above discussed algorithm and hence ultimately reduction in the average number of
multiplications done.
International Journal of Network Security & Its Applications (IJNSA), Vol.6, No.4, July 2014
18
Figure 7. Sliding Window Exponential
3.7 ADVANTAGES AND DISADVANTAGES OF RSA ALGORITHM
The RSA algorithm is known for its increased security and convenience. In RSA algorithm
private keys are neither transmitted or nor revealed to anyone. By contrast in secret-key system
keys are exchanged either manually or with the help of communication channel. This is because
in secret-key system same key is used for encryption and decryption and there exist a chance that
an enemy can retrieve this secret ke