Data Encryption and Decryption Using RSA
Data Encryption and Decryption Using RSA
Data Encryption and Decryption Using RSA
7, July 2013 9
( − 1) an integer?
private key pair, the following steps can be used: prime?
( p − 1)(q − 1)
i. Choose two prime numbers, p and q. From Is ed
modulus, n = pq
these numbers you can calculate the
( p − 1)(q − 1)
equation: C = M Mod n
key, creates the cipher-text, C, using the
e
Print ‘cipherText’, ‘n’,
vi. The receiver then decrypts the cipher-text ‘e’ and ‘d’.
M = C d Mod n
with the private key using the equation:
STOP
2.1 How to Use the Keys for Encryption This is actually the smallest possible value for the
modulus n for which the RSA algorithm works. Figure
Assuming a sender “A” that wants to send a message 2.0 illustrates the decryption procedures.
to a receiver “B”, the sender will take the following
steps:- 2.3 The Design of the Unified Modeling Language
= M e Mod n .
integer M . programming steps called Unified Modeling Language
iii. Computes the cipher-text C (UML). It is a standard notation that originated in the
iv. Send the cipher-text C to B. mid-1990s from the work of James Rumbaugh, Ivar
The flow chart of the encryption algorithm is as given in Jacobson and Grady Boch. UML is a graphical way of
Figure 1.0. representing and designing an object oriented language
for proper description of each step involved and the flow
layout of the program itself.
START This work chooses to use UML because it has the
advantage of clearly showing the relationship that exists
between the classes that form this work. There are three
packages that exist in this work, they are:
i. The applicationGUI Package
Read ‘cipherText’, ii. The dbinterface Package
‘n’ and ‘d’. iii. The encodinganddecoding package.
M = C d Mod n
The encodinganddecoding package contains the
EncodingAndDecoding.java class. All these packages are
embedded in the project named
DataEncryptionAndDecryption.
In this paper the Top-down approach is used for the
Decode M = plainText design of the program therefore all the small objects are
put together to form the main object. The individual
classes of these smaller objects are specified with names
Print ‘plainText’. and are then linked together to form the major object.
The class names for the individual objects are;
i. TableDisplay.java
ii. SendMessage.java
STOP iii. RetrieveMessage.java
iv. EncodingAndDecoding
Figure 2.0: A Flow Chart to Illustrate the Decryption Algorithm The necessary java packages were imported while the
database was created in mySQL with three fields namely:
2.2 How to Use the Keys for Decryption “Cipher ID”, “Cipher Text” and “n” with security
administered on it. Frames were created with menus and
For the recipient “B” to receive the message sent by the call the ActionListener, SendMessage Interface is created
sender “A”, the recipient will take the following steps:- with labels, Buttons and TextAreas. This is followed by
compute M = C e Mod n .
i. Uses the private key (n, d) to creation of another RetrieveMessage interface with Label,
Buttons and TextAreas. And in addition, the Encoding and
Decoding class (which is a public class that encodes,
ii. Extracts the plaintext from the integer decodes, encrypt and decrypt by making use of the
representative M . BigInteger) were also created.
12 IJCSNS International Journal of Computer Science and Network Security, VOL.13 No.7, July 2013
JFrame ActionListener The Encrypt Button is clicked, a Dialog box appear asking
for the value of “q”, which must be a prime number and
another dialog box prompting for the value of “p” which
must also be prime number (the product of “q” and “p”
- JLabel must not have more than 4 digits; which is the specified
block-size for this program).
- JTextARea To send the Cipher text to the database, the “Send Button”
- JButton (-) implies private. is clicked and the dialog box returns the value of n, e and
(+) implies public. d as 9557, 17 and 7973 respectively.
+ Init components
+ ActionPerformed
+ BigInteger
Figure 3.0: A UML to Illustrate the Program Design for the Private and
Public Keys
Figure 6.0: A Correct Entry of the Cipher ID with the Requested Value
of “d”.
For a correct Cipher ID, the dialog box will return the
correct Cipher text as shown in Figure 6.0. Correct entry
Figure 4.0: The GUI of the Plain Text, Encoded Text and Cipher Text of the value of “d” at the Receiver Interface will return the
Result.
Correct Retrieved “Plain Text” Message as shown in
Figure 7.0.
IJCSNS International Journal of Computer Science and Network Security, VOL.13 No.7, July 2013 13
References
[1] Afolabi, A.O and E.R. Adagunodo, 2012. Implementation
of an Improved data encryption algorithm in a web based
learning system. International Journal of research and
reviews in Computer Science. Vol. 3, No. 1.
[2] Bhoopendra, S.R., Prashanna, G. and S. Yadav, 2010. An
Integrated encryption scheme used in Bluetooth
communication mechanism. International Journal of
Computer Tech. and Electronics Engineering (IJCTEE), vol.
1, issue 2.
[3] DI management (2005) “RSA algorithm”, available at:
http://www.di-mgt.com.au/rsa_alg.html.
[4] Gaurav, S., 2012. Secure file transmission scheme based
On hybrid encryption technique. International Journal of
management, IT and Engineering. Vol. 2, issue 1.
[5] Hellman, M. and J. Diffie, 1976. New Directions in
Cryptography. IEEE transactions on Information theory,
vol. IT-22, pp:644-654.
[6] Shinde, G.N. and H.S. Fade War, 2008. Faster RSA
Figure 7.0: Receiver Interface with the Correct Retrieved “Plain Text” algorithm for decryption using Chinese remainder theorem.
Message.
ICCES, Vol. 5, No. 4, pp. 255-261.
[7] Yang L. and S.H. Yang. 2007. A frame work of security
To ensure that the data is secured, for any entry of wrong and safety checking for internet-based control systems.
value of “d”, the Receiver Interface will return a International Journal of Information and Computer security.
meaningless “Plain Text” Message as shown in Figure 8.0. Vol.1, No. 2.
This ensures the data is secured against hackers within the [8] Washington, L.C. 2006. Introduction to Cryptography: with
network environment. coding theory by Wade Trappe. Upper Saddle River, New
Jersey, Pearson Prentice Hall.
[9] Wuling Ren College of Computer and Information
Engineering Zhejiang Gongshang University. 2010. A
hybrid encryption algorithm based on DES and RSA in
Bluetooth communication. Second International Conference
on Modeling, Simulation and Visualization methods.
4. Conclusion
The paper has presented data encryption and decryption in
a network environment that was successfully implemented.
With this software, data can be transferred from one
computer terminal to another via an unsecured network
environment. An eavesdropper that breaks into the
message will return a meaningless message. Obviously
encryption and decryption is one of the best ways of
hiding the meanings of a message from intruders in a
network environment.