0% found this document useful (0 votes)
4 views

RSA-and-ElGamal-Algorithm

This paper proposes a key generation algorithm that combines RSA and ElGamal algorithms to enhance security while reducing computation time. The new algorithm utilizes 256-bit prime numbers, making it faster than the traditional RSA which requires larger primes. The analysis indicates that the combined approach offers improved security and efficiency in public key cryptography.

Uploaded by

Phan Thắm
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

RSA-and-ElGamal-Algorithm

This paper proposes a key generation algorithm that combines RSA and ElGamal algorithms to enhance security while reducing computation time. The new algorithm utilizes 256-bit prime numbers, making it faster than the traditional RSA which requires larger primes. The analysis indicates that the combined approach offers improved security and efficiency in public key cryptography.

Uploaded by

Phan Thắm
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

2016 8th International Conference on Information Technology and Electrical Engineering (ICITEE), Yogyakarta, Indonesia

Key Generation Algorithm Design Combination of


RSA and ElGamal Algorithm
Ni Made Satvika Iswari
Faculty of Engineering and Informatics
Universitas Multimedia Nusantara
Tangerang, Indonesia
[email protected]

Abstract—RSA is an algorithm for public-key cryptography Speed is the main disadvantage of public-key cryptography,
and is considered as one of the great advances in the field of public because there is always a tradeoff between efficiency and
key cryptography. RSA security lies in the difficulty of factoring security[3]. Inventors of RSA suggest the prime number used to
large number into prime factors. The inventor of RSA Algorithm generate the keys have more than 100-digit length, but this may
suggests prime number that is used to generate the keys have more cause long computation time. But if we use small digit length for
than 100 digits’ length for security reasons. Elgamal algorithm the key size, this will lead to many security holes.
also is one of public key cryptography algorithm. The security of
this algorithm lies in the difficulty of calculating discrete An implementation and analysis of ElGamal and RSA
logarithm. In this paper, the author proposes key generation algorithm has been done in [6]. Based on that implementation
algorithm that is considered safe from the combination of the RSA and analysis, ElGamal algorithm is more secure as compared to
and Elgamal algorithm. Based on the experiment that has been RSA algorithm because it generates more complex cipher text
done, the computing time required for the proposed algorithm is and it was also slow because when we encrypt and decrypt it, it
relatively short, compared to the original RSA algorithm. generates more than one public keys.
Keywords—RSA; ElGamal; public key cryptography; In this paper, the author propose a key generation algorithm
combination; algorithm design made from combination of RSA and Elgamal Algorithm. This
algorithm uses 256 bit prime numbers, in order to make
computing time for encryption and decryption processes faster
I. INTRODUCTION than using 1024 bit of prime numbers on the original RSA
algorithm. Although the prime numbers that are used is in small
RSA is a popular algorithm in public key cryptography. It bit, but safety factors remain to be addressed by using a
was created by three researchers at the MIT (Massachusetts combination of RSA and Elgamal algorithm.
Institute of Technology) in 1976, namely Ron Rivest, Adi
Shamir, and Leonard Adleman. RSA algorithm security lies in
the difficulty of factoring large numbers into prime factors[1].
Factoring is done to obtain the private key. II. RSA ALGORITHM
RSA is a popular algorithm in public key crypthography.
While efficient algorithm for factoring large numbers into
This algorithm was created by three researchers from MIT
prime factors is undiscovered, RSA Algorithm security is still
(Massachusetts Institute of Technology) in 1976, namely: Ron
ensured. Inventors of this algorithm suggest the prime number
(R)ivest, Adi (S)Hamir, and Leonard (A)dleman. Its security lies
used to generate the keys have more than 100-digit length. Thus,
in the difficulty of factoring large numbers into prime factors[1].
the multiplication result of that prime value is larger than 200-
digit length. According to Rivest and friends, attempt to find a The following are properties used in RSA Algorithm:
factor of 200-digit number takes computing time for 4 billion
years[1]. Prime numbers which has more than 100 digits, that 1. ‫ ݌‬and ‫ݍ‬, prime number (private)
are considered safe for the RSA algorithm, will certainly take a 2. ‫ ݎ‬ൌ ‫݌‬Ǥ ‫ݍ‬ (public)
longer computing time when compared to using prime numbers
that have relatively fewer digits. 3. ߶ሺ‫ݎ‬ሻ ൌ ሺ‫ ݌‬െ ͳሻሺ‫ ݍ‬െ ͳሻ (private)
Elgamal Algorithm is also one of public key cryptography 4. ܲ‫( ܭ‬encryption key) (public)
algorithm. This algorithm was originally used for digital 5. ܵ‫( ܭ‬decryption key) (private)
signatures, but later was modified to be used for encryption and
decryption. The security of this algorithm lies in the difficulty of 6. ܺ (plaintext) (private)
calculating the discrete logarithm. Discrete logarithm problem 7. ܻ(ciphertext) (public)
is, if ’ is a prime number and ‰and › is any integer, then find š
such that[2]:
݃ ௫ ൌ ‫ݕ‬ሺ݉‫݌݀݋‬ሻ

978-1-5090-4139-8/16/$31.00 ©2016 IEEE


2016 8th International Conference on Information Technology and Electrical Engineering (ICITEE), Yogyakarta, Indonesia

A. Key Pair Generation standard for signatures. On behalf of this software and its
The following are procedures to generate pair of key for problems with ElGamal discovered in late 2003[5].
encryption: The following are properties used in ElGamal Algorithm:
1. Choose two random prime number, ‫ ݌‬and ‫ݍ‬. 1. Prime number, ‫݌‬ (public)
2. Calculate ‫ ݎ‬ൌ ‫݌‬Ǥ ‫ݍ‬. It should be ‫ݍ ് ݌‬, because if ‫ ݌‬ൌ 2. Random number, ݃ǡ ሺ݃ ൏ ‫݌‬ሻ (public)
‫ݍ‬, then ‫ ݎ‬ൌ ‫݌‬ଶ , and ‫ ݌‬can be obtained from the square
root of ‫ݎ‬. 3. Random number, ‫ݔ‬ǡ ሺ‫ ݔ‬൏ ‫݌‬ሻ (private)
3. Calculate ߶ሺ‫ݎ‬ሻ ൌ ሺ‫ ݌‬െ ͳሻሺ‫ ݍ‬െ ͳሻ 4. Plaintext, ‫ܯ‬ (private)
4. Choose public key, ܲ‫ܭ‬, which is relatively prime with 5. Ciphertext, ܽ and ܾ (public)
߶ሺ‫ݎ‬ሻ.
5. Generate private key with this equation ܵ‫ܭ‬Ǥ ܲ‫ ܭ‬ൌ A. Key Pair Generation
ͳሺ݉‫߶݀݋‬ሺ‫ݎ‬ሻሻ. Note that this equation is equivalent
with ܵ‫ܭ‬Ǥ ܲ‫ ܭ‬ൌ ͳ ൅ ݉߶ሺ‫ݎ‬ሻ, so ܵ‫ ܭ‬can be obtained The following are procedures to generate pair of key for
with: encryption:

ͳ ൅ ݉߶ሺ‫ݎ‬ሻ 1. Choose a random prime number, ‫݌‬


ܵ‫ ܭ‬ൌ  2. Choose two random number, ݃ and ‫ݔ‬, where ሺ݃ ൏ ‫݌‬ሻ
ܲ‫ܭ‬
and (‫ ݔ‬൏ ‫݌‬ሻ
There will be an integer ݉, so an integer ܵ‫ ܭ‬can be
obtained. Note that ܵ‫ ܭ‬and ܲ‫ ܭ‬generation order are 3. Calculate ‫ ݕ‬ൌ  ݃ ௫ ݉‫݌݀݋‬
interchangeable.
4. ‫ ݕ‬is the public key and ‫ ݔ‬is the private key. The value of
݃ and ‫ ݌‬is public.
B. Encryption
The following are the encryption procedures: B. Encryption
1. Plaintext is structured into block ‫ݔ‬ଵ ǡ ‫ݔ‬ଶ ǡ ǥ such that The following are the encryption procedures:
each block represents a value in the range from 0 to 1. Plaintext is structured into block ݉ଵ ǡ ݉ଶ ǡ ǥ such
‫ ݎ‬െ ͳ. that each block represents a value in the range from
2. Each block ‫ݔ‬௜ is encrypted to block ‫ݕ‬௜ with this 0 to ‫ ݌‬െ ͳ
equation: 2. Choose a random number, ݇, where Ͳ ൑ ݇ ൑ ‫ ݌‬െ
ͳ, such that ݇ is relatively prime with ‫ ݌‬െ ͳ
‫ݕ‬௜ ൌ  ‫ݔ‬௜௉௄ ݉‫ݎ݀݋‬ 3. Each block of plaintext ݉ is encrypted with the
C. Decryption following equation:
The following are the decryption procedures: ܽ ൌ  ݃௞ ݉‫݌݀݋‬
ܾ ൌ  ‫ ݕ‬௞ ݉݉‫݌݀݋‬
1. Each cipher text block ‫ݕ‬௜ is decrypted into block ‫ݔ‬௜ Pair of ܽ and ܾ is cipher text for message block ݉,
with the following equation: so the size of cipher text is twice the size of its
‫ݔ‬௜ ൌ  ‫ݕ‬௜ௌ௄ ݉‫ݎ݀݋‬ plaintext.

C. Decryption
III. ELGAMAL ALGORITHM Decryption of ܽ and ܾ is done by using secret key,
Same with RSA Algorithm, ElGamal is also a public key ‫ݔ‬, and plaintext ݉ is recovered by this equation:
cryptography algorithm. This algorithm was originally used for
݉ ൌ ܾȀܽ ௫ ݉݉‫݌݀݋‬
digital signature, but was later modified so it also can be used
for encryption and decryption. The strength of this algorithm lies Note that:
in the difficulty of calculating discrete logarithm[2]. To encrypt
and decrypt a message, a discrete power is executed. This ܽ ௫ ‫݃  ؠ‬௞௫ ሺ݉‫݌݀݋‬ሻ
operation is efficient to compute. An attacker that seeks to then:
decrypt an intercepted message may try to recover the private
key. To this end, a logarithm needs to be computed. No actual ܾ ‫ ݕ‬௞ ݉ ݃ ௫௞ ݉
‫ؠ‬ ‫ ؠ‬௫௞ ‫݉ ؠ‬ሺ݉‫݌݀݋‬ሻ
method exists for this. Under these circumstances, the ܽ௫ ܽ௫ ݃
encryption is secure[4].
So that, plaintext can be recovered from pair of ciphertext ܽ
Today, ElGamal algorithm is used in many cryptographic and ܾ.
products. The open-source software GnuPG uses ElGamal as
2016 8th International Conference on Information Technology and Electrical Engineering (ICITEE), Yogyakarta, Indonesia

IV. KEY GENERATION ALGORITHM DESGIN 2. Random number, ݃ǡ ሺ݃ ൏ ‫݈ܧ݌‬ሻ (public)


Based on the analysis that has been done above, the author 3. Random number, ‫ݔ‬ǡ ሺ‫ ݔ‬൏ ‫݈ܧ݌‬ሻ (private)
obtains some conclusion about both algorithms’, RSA and
ElGamal as follows: 4. ‫ ݕ‬ൌ ݃ ௫ ݉‫݈ܧ݌݀݋‬ (public)
1. The security of RSA Algorithm lies in the difficulty The prime number, ‫݈ܧ݌‬, is randomly generated larger than
in factoring non-prime numbers into its prime random number ݃ and ‫ݔ‬. Random number, ݃, which is not
factors, which in this case: ‫ ݎ‬ൌ ‫ݍݔ݌‬. secret, is the encryption key, ܲ‫ܭ‬, obtained from the key
generation for RSA Algorithm. While the random number, ‫ݔ‬,
2. Once ‫ ݎ‬successfully factored into ‫ ݌‬and ‫ݍ‬, then which is secret, is the decryption key, ܵ‫ܭ‬, obtained from the key
߶ሺ‫ݎ‬ሻ ൌ ሺ‫ ݌‬െ ͳሻሺ‫ ݍ‬െ ͳሻ can be calculated. generation for RSA Algorithm.
Furthermore, because the encryption key, ܲ‫ܭ‬, is
published (not secret), then the decryption key, ܵ‫ܭ‬, The following are the steps to perform key generation:
can be calculated from this equation ܲ‫ܭ‬Ǥ ܵ‫ؠ ܭ‬
ͳ൫݉‫߶݀݋‬ሺ‫ݎ‬ሻ൯.
3. The inventors of RSA Algorithm suggests the value
of ‫ ݌‬and ‫ ݍ‬are longer than 100 digits. Thus the result
of ‫ ݎ‬ൌ ‫ ݍݔ݌‬will be more than 200 digits.
According to Rivest and friends, efforts to seek
prime factor of 200-digit number takes computing
time for 4 billion years (assuming that factoring
algorithm used is currently the fastest algorithm
and by using computer that has a speed of 1
millisecond)
4. Fortunately, the most efficient algorithm for
factoring large numbers have not been found. This
is what makes RSA Algorithm still used today.
While efficient algorithm for factoring integers into
prime factors not yet found, RSA Algorithm is still
recommended encrypt messages.
5. The security of ElGamal Algorithm lies in the
difficulty of calculating the discrete logarithm.
6. The discrete logarithm in question is, if ‫ ݌‬is prime
number, and ݃ and ‫ ݕ‬is random integer, then find ‫ݔ‬
such that: ݃ ௫ ‫ݕ ؠ‬ሺ݉‫݌݀݋‬ሻ

Based on the conclusion above, in this section, the author


proposes an algorithm design for RSA key generation using a
combination of RSA and ElGamal key generation algorithm.
The following are properties used in original RSA Algorithm
design:
1. ‫ ݌‬and ‫ݍ‬, prime number (private)
2. ‫ ݎ‬ൌ ‫݌‬Ǥ ‫ݍ‬ (public)
3. ߶ሺ‫ݎ‬ሻ ൌ ሺ‫ ݌‬െ ͳሻሺ‫ ݍ‬െ ͳሻ (private)
4. ܲ‫( ܭ‬encryption key) (public)
5. ܵ‫( ܭ‬decryption key) (private)
6. ܺ (plaintext) (private) Figure 1 Key Generation Steps for The Proposed Algorithm

7. ܻ(ciphertext) (public) Processes that was done in the early steps is the same as the
The proposed algorithm design use additional properties key generation process by using RSA Algorithm. First, generate
obtained from ElGamal Algorithm, which is as follows: prime numbers ‫ ݌‬and ‫ݍ‬. After that, calculate ‫ ݎ‬ൌ ‫݌‬Ǥ ‫ ݍ‬. Then
calculate ߶ሺ‫ݎ‬ሻ ൌ ሺ‫ ݌‬െ ͳሻሺ‫ ݍ‬െ ͳሻ. Once the generation is done,
1. Prime number, ‫݈ܧ݌‬ (public) generates random number, ܲ‫ܭ‬, the encryption key, where the
2016 8th International Conference on Information Technology and Electrical Engineering (ICITEE), Yogyakarta, Indonesia

Greatest Common Divisor, ‫ܦܥܩ‬ሺܲ‫ܭ‬ǡ ߶ሺ‫ݎ‬ሻ) = 1. Having


obtained the encryption key, then we can compute the
decryption key with this formula : ܵ‫ ܭ‬ൌ ܲ‫ି ܭ‬ଵ ݉‫݀݋‬൫߶ሺ‫ݎ‬ሻ൯.
After the stage of key generation using RSA Algorithm is
done, process followed by key generation using ElGamal
Algorithm. First, public key, ܲ‫ܭ‬, will be a random number, ݃,
for ElGamal Algorithm which is not secret. Then, private key,
ܵ‫ܭ‬, will be a random number, ‫ݔ‬, for ElGamal Algorithm which
is secret. After that, a prime number, ‫݈ܧ݌‬, is generated which is
greater than ܵ‫ ܭ‬and ܲ‫ܭ‬. After that, we can calculate ElGamal
public key algorithm using this formula:
‫ ݕ‬ൌ ܲ‫ ܭ‬ௌ௄ ݉‫݈ܧ݌݀݋‬
The public key, ‫ݕ‬, which had been obtained is used to
recalculate the private key for RSA Algorithm using this
formula:
ܵ‫ ܭ‬ൌ ‫ି ݕ‬ଵ ݉‫݀݋‬ሺ߶ሺ‫ݎ‬ሻሻ
Figure 3 Decryption Program using Proposed Algorithm for Key
However, for the calculation of this private key, the public Generation
key, ‫ݕ‬, must be based on the requirement to have
‫ܦܥܩ‬൫‫ݕ‬ǡ ߶ሺ‫ݎ‬ሻ൯ ൌ ͳ. Therefore, if the public key, ‫ݕ‬, is not
qualified, then prime number, ‫݈ܧ݌‬, is re-generate and the public
key is re-calculated. V. EXPERIMENT AND ANALYSIS
In this section, the author tries to compare the key generation
Figure 2 and Figure 3 is a screenshot of encryption and process time between the original RSA Algorithm using 1024-
decryption program using the proposed algorithm for key bit prime number and the proposed algorithm using 256-bit
generation process. prime number. For this experiment, the author made a key
generator prototype program as shown in Figure 4 for the
original RSA, and Figure 5 for the proposed algorithm.

Figure 2 Encryption Program Using Proposed Algorithm for Key


Generation

Figure 4 Key Generation Process using Original RSA Algorithm


(1024-bit prime number)
2016 8th International Conference on Information Technology and Electrical Engineering (ICITEE), Yogyakarta, Indonesia

3. ElGamal Algorithm is a public key algorithm that was


originally used for digital signatures
4. Security of ElGamal Algorithm lies in the difficulty of
calculating the discrete logarithm
5. The proposed algorithm, which is a combination of
RSA and ElGamal Algorithm have double security,
which is the difficulty of factoring large numbers into
prime factors and also the difficulty of calculating the
discrete logarithm

Figure 5 Key Generation Process using a Combination of RSA and


ElGamal Algorithm (256- bit prime number)

RSA Algorithm is only secure if r, i.e. multiplication


between 2 prime numbers is quite long. If the length of ‫ ݎ‬is only
256-bit or less, ‫ ݎ‬can be factored in just a few hours with a single Figure 6 Process Time Comparison Between The Original RSA and
PC. If the length of ‫ ݎ‬is 512-bit or less, ݊ can be factored by Proposed Algorithm
using several hundred of computer. At this experiment, the
author tries to use RSA key generation algorithm with 1024-bit VII. FUTURE WORKS
prime numbers which assumed to be safe according to the RSA‘s Based on the work that has been done, combination of RSA
inventor suggestion.
and ElGamal for key generation algorithm has decreased
In this experiment, the key generation process is executed 10 computing time required. But, security factor is not quitely
times for both algorithms’. The results from this experiment proven. It can be proved by doing some piercing test, to factor
were quite significant. The average computing time for the key ‫ ݎ‬and calculate discrete logarithm.
generation using original RSA Algorithm with 1024-bit prime
number is 4206 milliseconds. While for the proposed algorithm, REFERENCES
the average computing time is 116 milliseconds. This
comparison process time is shown in Figure 6. [1] R. Rivest, A. Shamir, and L. Adleman, “A method for obtaining digital
signatures and public key cryptosystems,” Commum. ACM, vol. 21, no.
Although only using 256-bit prime number, doesn’t mean 2, pp. 120-126, Feb. 1978.
the proposed algorithm loses its security. Even if ‫ ݎ‬can be [2] T. Elgamal, “A public key cryptosystem and a signature scheme based on
factored in just a few hours, but public and private key are not discrete logarithms,” IEEE Transactions on Information Theory, vol. 31,
directly known because the discrete logarithm must be no. 4, pp. 469-472, Jul 1985
calculated, which is the power of ElGamal Algorithm. [3] S. Mahajan and M. Singh, “Analysis of RSA Algorithm using GPU
Programming,” International Journal of Network Security & Its
VI. CONCLUSION Applications (IJNSA), vol. 6, no. 4, Jul 2014
[4] A. V. Meier, “The ElGamal Cryptosystem”, June 2005
From this research and experiment, here are the conclusions:
[5] P. Q. Nguyen, “Can We Trust Cryptographic Software? Cryptographic
1. RSA is a famous public key algorithm and used by Flaws in GNU Privacy Guard v1.2.3,” Advances in Cryptology-
many applications EUROCRYPT 2004, vol 3027 of the series Lecture Notes in Computer
Science, pp. 555-570, May 2004.
2. Security of RSA lies in the difficulty of factoring large [6] A. Sharma, J. Attri, A. Devi, and P. Sharma, “Implementation & Analysis
numbers into prime factors. of RSA and ElGamal Algorithm,” Asian Journal of Advanced Basic
Sciences, vol 2, no. 3, pp. 125-129

You might also like