EJERS, European Journal of Engineering Research and Science
Vol. 5, No. 4, April 2020
Study A Public Key in RSA Algorithm
Taleb A. S. Obaid
consumption much computational resources, Meneses et al.
Abstract—To transmit sensitive information over the unsafe [1].
communication network like the internet network, the security As it's known the cryptography is the procedure too is
is precarious tasks to protect this information. Always, we have used to protected important data through transfers it over a
much doubt that there are more chances to uncover the
normal network channel, which is not necessary to stay
information that is being sent through network terminals or
the internet by professional/amateur parasitical persons. To secure, and the other side receives the message as it that.
protect our information, we may need a secure way to Nowadays, the subject of data confidence becomes a very
safeguard our transferred information. So, crucial feature of information computing discipline. Easy
encryption/decryption, stenographic and vital cryptography admission of the Internet today and all the data all over the
may be adapted to care for the required important world led to the importance of the topic of security data.
information. In system cryptography, the information
transferred between both sides sender/receiver in the network
Although, this will be created new dangers for those users
must be scrambled using the encryption algorithm. The second who want to remain their data safer. As we expected,
side (receiver) should be outlook the original data using the hackers and penetrates are using a diversity of techniques to
decryption algorithms. Some encryption techniques applied the penetrate and break out into an information transferred
only one key in the cooperation of encryption and decryption channel and steal information or alteration of the original
algorithms. When the similar key used in both proceeds is data of any organization [2]-[5].
called symmetric algorithm. Other techniques may use two
At present, cryptography algorithms afford a high level of
different keys in encryption/decryption in transferring
information which is known as the asymmetric key. In general, confidentiality by covering private data of any individuals or
the algorithms that implicated asymmetric keys are much more groups. Cryptography is implemented to provide access to
secure than others using one key. RSA algorithm used data in a constrained way, data reliability, and validation. At
asymmetric keys; one of them for encryption the message, and present, many of the research's effort is going on to find out
is known as a public key and another used to decrypt the the new cryptographic algorithms more efficient based on
encrypted message and is called a private key. The main
security and complexity [2].
disadvantage of the RSA algorithm is that extra time is taken
to perform the encryption process. In this study, the MATLAB Generated a one secrete-key (private) of the cryptography
library functions are implemented to achieve the work. The algorithm uses for both approaches i.e., is known as an
software helps us to hold very big prime numbers to generate asymmetric key. This technique proved that has lesser
the required keys which enhanced the security of transmitted computational efforts but unfortunately has many drawbacks
information and we expected to be difficult for a hacker to like discovering and infer the key, the obligation of a shared
interfere with the private information. The algorithms are
secret key, validation [3],[4].
implemented successfully on different sizes of messages files.
Asymmetric cryptography algorithm, use a public-key to
Index Terms—Cryptography, Ciphertext, Data Security, achieve an encryption pattern and then, used a private key to
RSA Algorithm, Key Generation. decrypt the cipher information. However, asymmetric
cryptography implements two different mathematically
approaches, like a public key and the other a private key.
I. INTRODUCTION Dissimilar symmetric algorithms applied only one key to
Several researchers emphasize cryptography techniques both the encryption/ decryption approach performance, [6],
to transferred vital information through unsecured channels. [7]. Moreover, the public key is speared openly and can be
They have confirmed that the greatest technique to get used to encrypt data by anyone. On the other hand, the
secrecy and reliability of data. However, the data transferred private key is kept secret and implemented by the recipe
through network channels facing real challenges by different side to decrypt the received encrypted data.
sides that interest to uncover the secret information. Rivest, Shamir, and Adleman (RSA), in (1977) were the
Developing of information technologies is raising the level first described the algorithm that implemented public key,
of threats and vulnerabilities of the forward the data in [2]. The RSA technique is succeeded to solve the
unsecured canals. To encounter the problem, the asymmetric cryptography problems. RSA algorithm applied
cryptography researchers have stressed their talents in different keys as public/private keys but are related to a
discovers an unconventional alternative to improve large scale of applications. As a result, reliable secured
transmitted information protection by ensuring information results and better security transfer data were big prime
accessibility. At present dissimilar algorithms have been integer numbers chosen for both the public / private keys
stimulated to provide much more security. Of course, such [6], [7]. RSA applied extensively for encryption/decryption
sophisticated algorithms generate a more expensive and problems leading a protected transmission of the data. RSA
comes to be more enhanced protection when the value of the
key is big enough and it becomes much more difficult to
Published on April 2, 2020. figure out its common factors of the key number. An
T. A. S. Obaid is with University of Basrah, Iraq.
DOI: http://dx.doi.org/10.24018/ejers.2020.5.4.1843 395
EJERS, European Journal of Engineering Research and Science
Vol. 5, No. 4, April 2020
asymmetric key means that it works on two different keys as
a public key and a private key. The public key shoul be
known by everyone but the private key is not and kept
privately to receiver only. The objective of RSA founded on
the fact that it is hard to factorize a key because a large
prime integer is chosen. Usually, the public key generated
by two prime numbers.
II. SYMMETRIC VS. ASYMMETRIC CRYPTOGRAPHY
Cryptographic techniques had been used since ancient
times before inventing computers system, and the
techniques have evolved since those times.
Cryptography algorithms are regularly separated into two Fig. 2. Two keys in cryptography
categories and identified as symmetric/asymmetric
cryptography. The essential difference between these two
III. RSA ALGORITHM [11] - [16]
categories of encryption/decryption depends on the fact that
symmetric cryptography uses a single key that needs to be To implement the RSA technique smoothly, we need to
common among the second side who need to receive the trail the following three steps:
message that sent by the first side. While asymmetrical A. Key generation
cryptographs contain a public key to encrypt data only. The
RSA algorithm involves generating two different
private/public keys are unlike, but they are related.
However, the public key is offered to everybody who keys, like a public key beside a private key. As a
familiar, the public key should be distributed for
desires to use this method and send the messages, but in
anyone who is intending to implement this technique
other hands, the private key is set hidden at a secured place,
to encrypt a piece of transmitted information. The
One of drawback is asymmetric encryption takes much more
messages are encrypted via public key but it may be
time than symmetric encryption [7]-[9].
decrypted by one who had a privet key in a sensible
Of course, both types of cryptographic have benefits and
amount of time so that it is mean, the private key
drawbacks relative to one another. Symmetric encryption
should be delivered by receipt side. The keys of the
algorithms are much quicker, require less computational
RSA algorithm are Select two big prime integer
power, and simpler, but their main weakness is that a key
numbers N and M. Since we intend to satisfy
may be discovered by hackers. Because in the symmetric
safekeeping the message, the integer’s N and M
technique is only one key is applied to both encryption and
should be chosen as big prime integers.
decryption of data, so, this key must keep safe. though this
key handover to a trusted person who needs it to access the Compute a number n = N*M. where n is computed as
data, so, the key does not open up for the public to keep it the modulo for both the public and private keys.
secured, [10],[11]. The Euler's function phi() should be computed as, phi
On the other hand, asymmetric encryption resolves the (n) = (N − 1)*(M − 1), where phi function is the
problem of key spreading for using public keys for integer number.
encryption technique and private keys for decryption. The Let generated as the following: [17], [18]:
compromise, however, is that asymmetric encryption an integer e in the range 1 ≤ e ≤ phi(n) and the GCD
technique is very slow by comparison to symmetric (e, phi (n)) = 1, so that e and phi(n) are coprime.
technique and require much more computation power as a B. Encryption key
result of their massively longer key lengths.
Select the index integer e so that e is greater than 1 and
less than phi (n), and the greatest common divisor GCD (e,
phi (n)) = 1. The integer, e, and phi(n) are should be a co-
prime. The e is unconstrained as the public key exponent.
C. Decryption Key
Let d is a decryption key and is computed d as:
d = e−1 mod (phi (n));
where d is computed as the multiplicative inverse of e
(modulo phi (n)). To be more clarified d solved as:
d*e ≡ 1 (mod phi (n)).
The public key involves the modulo of n and the index e.
Fig. 1. One key in cryptography While the private key involves of the modulus n and the
private key d, which must be kept the secret, at the same
time the N, M, and phi (n) must also be kept the secret to
prevent the interveners applied these parameters to calculate
d, [19]-[22].
DOI: http://dx.doi.org/10.24018/ejers.2020.5.4.1843 396
EJERS, European Journal of Engineering Research and Science
Vol. 5, No. 4, April 2020
IV. A WORKED EXAMPLE more security is based on the difficulty of the factorization
In the following, we offer an applied example of RSA of the large prime integers chosen to generate the key. To
encryption/decryption. The parameters used here are small prevent an intruder discovery of the ciphertext we should
to clarify the procedure. select a big prime number in the RSA algorithm. The
Enter the prime integer for N = 59 encrypted plaintext by the RSA algorithm is often used in
Enter the prime integer for M = 41 mixture with other encryption schemes to safely transfer the
Compute n = N*M = 59 *41=2419. data. To make RSA more efficient things more efficient, a
Compute the function plaintext will generally be encrypted first with a symmetric
phi ((N-1)* (M-1)) algorithm, and once again use the RSA algorithm to encrypt
= ((59-1) * (41-1) the ciphertext using the asymmetric key. A final use of the
= 2320. symmetric key in the decryption of the ciphertext and
recover the original plaintext.
Compute the public key for exponent e such that 1 < e <
phi(n) and so that greatest common divisor
GCD (e, phi(n)) = 1; REFERENCES
e = 1381. [1] Meneses F., Fuertes W., José Sancho, Salvador S., Flores D., Aules
H., Castro F. Torres J., Miranda A., Nuela D., (2016), “RSA
Compute the private key d as Encryption Algorithm Optimization to Improve Performance and
d*e ≡ 1 (mod phi(n)) ; Security Level of Network Messages”, IJCSNS International Journal
d * 1381= 1 (mod 2320) of Computer Science and Network Security, VOL.16 No.8.
[2] Jamgekar R. S., Joshi G.S., (2013), “File Encryption and Decryption
d=1181. Using Secure RSA,” International Journal of Emerging Science and
To prove that a public and private keys whether to satisfy Engineering (IJESE), ISSN: 2319–6378, Volume-1, Issue-4,
the above relation: [3] Obaid T. A. S. Khami M. Shehab L. G. (2017), “Hiding Secured key
in digital media”, Int. Jo. Eng. Res. App., ISSN: 2248-9622, Vol. 7,
e*d mod (phi()) = Issue 9, pp.58-63, www.ijera.com
(1381 * 1181) mod 2320 [4] Nisha S., and Farik M., (2017), " RSA Public Key Cryptography
= 1630961 mod 2320 Algorithm – A Review", International Journal of Scientific &
Technology Research Volume 6, Issue 07, ISSN 2277-8616.
=1 [5] Khyoon, A. I. (2005) “Modification on the Algorithm of RSA
So, Cryptography System,” Al-Fatih Journal, ISSN: 87521996, Volume:
Puplish the public key is (1381, 2419) 1 Issue: 24 Pages: 80-89.
[6] Al-Lehiebe A., (2015), " Ciphered Text Hiding in an Image using
Puplish the private key is (1181, 2419) RSA algorithm", J. Of College of Education for Women vol. 26 (3).
[7] Cid C., (2019), " Cryptanalysis of RSA: A Survey", SANS
We are ready to send the public key to the second side Institute.Bonde S. Y.; Bhadade U.S., (2017) International Conference
(receipts) to write a required text message and encrypted it on Computing, Communication, Control and Automation
(ICCUBEA)”, DOI: 10.1109/ICCUBEA .8463720, Publisher: IEEE.
using a public key, i.e., converted to ciphertext and the [8] Patel S. R., Shah K., Patel G. R., (2013), “Study on Improvements in
second side sends the cipher message to the first side RSA Algorithm,” IJEDR, ISSN: 2321-9939.
(sender) to decrypt the received a cipher message using a [9] Milanov E., (2009), “The RSA Algorithm” https://sites.math.
washington. edu/~morrow/336_09/ papers/Yevgeny.pdf.
private message. [10] Kumar Y., Munjal R., Sharma H, (2011), “Comparison of Symmetric
and Asymmetric Cryptography with Existing Vulnerabilities and
e.g., Let us applied a numerical example: Countermeasures,” Int. J. Comp. Sci. and Management Studies, Vol.
11, Issue 03, ISSN: 2231-5268, www.ijcsms.com.
suppose the second side enter the following message: [11] Choudhary V., Praveen N. “Enhanced Rsa Cryptosystem Based On
"Computer Science" Three Prime Numbers,” Int. J. Innov. Sc., Eng. & Tech., Vol. 1, Issue
The ASCII equivalent of the message is: 10, 2014. www.ijiset.com.
[12] Intila C. Gerardo B. Medina R., (2019) “A study of public key ‘e’ in
67 111 109 112 117 116 101 114 32 83 99 RSA algorithm,” The International Conference on Information
105 101 110 99 101 Technology and Digital Applications, IOP Conf. Series: Materials
Science and Engineering 482 012016, IOP Publishing,
DOI:10.1088/1757-899X/482/1/012016.
The encrypted message is
[13] Kumar M. (2018), “Advanced RSA Cryptographic Algorithm for
1955 937 1643 2236 235 2240 Improving Data Security” https://www.researchgate.
750 173 91 83 1633 400 net/publication/324812723, DOI: 10.1007/978-981-10-8536-9_2.
750 1821 1633 750 [14] Thaku P., Rana A., (2016), "A Symmetrical Key Cryptography
Analysis using Blowfish Algorithm", International Journal of
The decrypted cipher message in ASCII is Engineering Research & Technology (IJERT), ISSN: 2278-0181, Vol.
67 111 109 112 117 116 5 Issue 07.
101 114 32 83 99 105 [15] Choudhary V. and. Praveen N., (2014), "Enhanced RSA
Cryptosystem Based On Three Prime Numbers", IJISET -
101 110 99 101 International Journal of Innovative Science, Engineering &
The decrypted message is: Computer Science Technology, Vol. 1 Issue 10, www.ijiset.com.
[16] Abdeldaym R. S., Abd Elkader H. M., Hussein R., (2019), " Modified
RSA Algorithm Using Two Public Key and Chinese Remainder
Theorem", I.J. of Electronics and Information Engineering, Vol.10,
V. CONCLUSION No.1, PP.51-64, (DOI: 10.6636/IJEIE.201903 10(1).06) 51.
[17] Ch. J. L. Padmaja Ch. J. L., Bhagavan V. S., and Srinivas B., (2016),
The most widely-uses asymmetric key is the RSA " RSA Encryption Using Three Mersenne Primes", Int. J. Chem. Sci.:
algorithm. RSA algorithm is effectively proved to be 14(4), 2273-2278, ISSN 0972-768X, www.sad gurupublications.com.
resisted the spam attempts to penetrate the data had been [18] Nisha S., and Farik M., (2017), " RSA Public Key Cryptography
Algorithm – A Review", International Journal of Scientific &
sent through the network and tampering these data. The Technology Research Volume 6, Issue 07, ISSN 2277-8616.
DOI: http://dx.doi.org/10.24018/ejers.2020.5.4.1843 397
EJERS, European Journal of Engineering Research and Science
Vol. 5, No. 4, April 2020
[19] Meneses F., Fuertes W, José S., Santiago Salvador, Daniela Flores, Name: Dr. Taleb A. S. Obaid.
(2016), " RSA Encryption Algorithm Optimization to Improve Date of Birth: 1-7-1952.
Performance and Security Level of Network Messages", IJCSNS Marital status: Married.
International Journal of Computer Science and Network Security, Profession: Professor Dr.
VOL.16 No.8, 55. e-mail: [email protected],
[20] Thangav M., Varalakshmi P., Murral M., Nithya K., (2015), " An [email protected]
Enhanced and Secured RSA Key Generation Scheme (ESRKGS)", Department of Computer Information Systems,
Journal of Information Security and Applications, Volume 20, Pages College of Information Technology, University of
3-10. Basra, Basra, IRAQ.
[21] Intila C., Gerardo B., Medina R., (2019), " A study of public key ‘e’ Ph. D. "A Computer Simulation of the Flow of
in RSA algorithm", The International Conference on Information Newtonian Liquids", Department of Computer Science, University College
Technology and Digital Applications, IOP Conf. Series: Materials of Wales, Swansea, U.K., 1984.
Science and Engineering 482. 012016, IOP Publishing, M. Sc. "Numerical analysis and programming", Department of Computer
DOI:10.1088/1757-899X/482/1/012016. Science and Math, University of Dundee, U.K., 1980.
[22] Uthman S., (2017), " An Improved RSA based on Double Even B.Sc. in Mathematics, University of Basra, Iraq, 1975.
Magic Square of order 32 ", Kirkuk University Journal /Scientific
Studies (KUJSS), Volume 12, Issue 4, ISSN 1992 – 0849.
DOI: http://dx.doi.org/10.24018/ejers.2020.5.4.1843 398