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

Image Encryption and Decryption in Public Key Cryptography based on MR

The document discusses a new image encryption algorithm based on Magic Rectangle (MR) within the framework of public key cryptography, specifically using RSA and ElGamal methods. It highlights the unique challenges of image encryption compared to text due to images' high data redundancy and bulk capacity, and proposes a method that maintains the original image size while ensuring secure transmission. Experimental results indicate that the proposed algorithm effectively encrypts and decrypts images with good security and efficiency.

Uploaded by

pnareturns007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Image Encryption and Decryption in Public Key Cryptography based on MR

The document discusses a new image encryption algorithm based on Magic Rectangle (MR) within the framework of public key cryptography, specifically using RSA and ElGamal methods. It highlights the unique challenges of image encryption compared to text due to images' high data redundancy and bulk capacity, and proposes a method that maintains the original image size while ensuring secure transmission. Experimental results indicate that the proposed algorithm effectively encrypts and decrypts images with good security and efficiency.

Uploaded by

pnareturns007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Image Encryption and Decryption in Public Key

Cryptography based on MR
D.I.George Amalarethinam J.Sai Geetha
Associate Professor & Director- MCA, Assistant Professor, Dept of Computer Science
Jamal Mohamed College Nehru Memorial College, Puthanampatti
Trichy, India Trichy, India
[email protected] [email protected]

Abstract— In the past decade, image encryption is given much processes. As a result, the safety of image data from
attention in research of information security and a lot of image unauthorized access is crucial at the hands of user. Image
encryption algorithms have been introduced. Due to some intrinsic encryption plays a significant role in the field of information
features of images like bulk data capacity and high data redundancy, hiding. Image hiding or encryption methods and algorithms
the encryption of image is different from that of text; therefore it is
ranges from simple spatial domain methods to more
difficult to handle them by traditional encryption methods. In the
complicated and reliable frequency domain.
proposed work, a new image encryption algorithm based on Magic
Rectangle (MR) is being applied. To begin with, the plain-image is The parameters used in encryption and decryption process of
converted into blocks of single bytes and then the block is replaced as the algorithm plays a vital role for security such as key
the value of MR. Further, the control parameters of Magic Rectangle streams in one time pad, the secret key in Data Encryption
(MR) are selected randomly by the user. Subsequently the image is Standard algorithm, the prime p and q in RSA etc. Of all the
being encrypted with public key cryptography algorithms such as encryption algorithms available, RSA(Rivest, Shamir,
RSA, ElGamal etc. The experimental result shows that the proposed Adlemen) accounts for highly reliable one. In RSA, the secret
algorithm can successfully encrypt/decrypt the images with separate key is derived from the public key and choosing p and q with
secret keys, and the algorithm has good encryption effect. Cipher text very large size. Even though the above parameters are
developed by this method will be entirely different when compared to considered, it is not fully secured. The conventional method of
the original image file and will be suitable for the secured
image encryption is done through any one of the technique
transmission over the internet. Thus, this model provides an additional
such as RGB color shuffling, bits manipulation, chaotic
level of security to public key algorithm and efficient utilization of
memory. mapping method etc. Of all the methods stated above, the
Keywords— Communication Security, Image Encryption and result of encryption is in the form of cipher image. It takes
Decryption, Public Key Cryptography, Public key, Secret key, Magic more time for encryption and decryption process and the
Rectangle. inefficient use of memory in this kind of cryptosystem results
in reduction of transmission speed. To overcome this problem,
I. INTRODUCTION this paper tries to develop a entirely different method by
introducing a special singly even magic rectangle [2] of the
Computer has become an essential device now a days. The order 32 x 48. Thus preferably different numerals representing
main use of computer is to store data and send it from one the bytes of image values are taken from magic rectangle
location to other. The information that is shared must be instead of taking patterns or bits for encryption. The encryption
transferred in a secured manner. To ensure secured process is being performed using RSA cryptosystem.
transmission of information, data is encrypted to unreadable
formats by an unauthorized person. Cryptography is the science II. RELATED WORK
of information security which has become a very critical aspect Quist-Aphetsi Kester[3], proposed the work sets out to
of modern computing systems towards secured data contribute to the general body of knowledge in the area of
transmission and storage. The exchange of digital data in cryptography application and by developing a cipher algorithm
cryptography results in different algorithms that can be for image encryption of m*n size by shuffling the RGB pixel
classified into two cryptographic mechanisms: symmetric key values. Finally, the algorithm made it possible for encryption
in which same key is used for encryption and decryption and and decryption of the images based on the RGB pixel.
asymmetric key in which different keys are used for encryption Musheer Ahmad and M. Shamsher Alam [4] proposed a new
and decryption [1]. Asymmetric key algorithms are more image encryption algorithm based on three different chaotic
secured when compared with symmetric key algorithms. maps. In this work, the plain-image is first decomposed into
Nowadays, information security is primarily based on data 8x8 size blocks and then the block based shuffling of image is
storage and transmission. Images are broadly used in numerous

978-1-4799-7623-2/15/$31.00 2015
c IEEE 133
carried out through 2D Cat map. In addition, the control the encryption process. The processing model of image
parameters meant for shuffling are randomly generated by encryption and decryption process is represented in fig.1.
employing 2D coupled Logistic map. Subsequently the
shuffled image is encrypted through chaotic sequence Encryption Minstart,Maxstart, Decryption
generated by one dimensional Logistic map.
Original image Column sum
Varsha Bhatt and Gajendra Singh Chandel[5] proposed a new Cipher Text
algorithm that deals with the representative image encryption
techniques, position permutation, naive, substitution
Generating singly
transposition and value transformation. Selective techniques even Magic
Transformation Decryption
will be described, assessed and matched up with respect to process (bytes) Rectangle of order
32 x 48. process
security level and encryption speed.
Hiral Rathod, Mahendra Singh Sisodia et.al[6], introduced a
new permutation technique based on the combination of image
permutation and developed an encryption algorithm called Determining the
Determining the
“Hyper Image Encryption Algorithm (HIEA)”. The selected numeral value from
Magic position of the
the magic rectangle
image will be converted into binary value blocks, which will that corresponds to Rectangle numeral value in the
be rearrange into a permuted image using a permutation magic rectangle
the bytes of image
process, and then the generated image will be encrypted using
the HIEA algorithm.
Manoj. B, Manjula et.al[7] , proposed a method in which the
image data is an input to AES Encryption to obtain the Encryption Transformation
encrypted image. The encrypted image is used as input to AES process process(bytes)
Decryption to get the original image. In this paper, 128 bit
AES is used for image encryption and decryption which is
synthesized and simulated on FPGA family of Spartan-6
(XC6SLX25) using Xilinx ISE 12.4 tool in Very high speed Cipher Text Original Image
integrated circuit Hardware Description Language (VHDL).
Mohammad Ali Bani Younes and Aman Jantan[8] introduced Fig.1. Model for Image Encryption and Decryption process
a block-based transformation algorithm using the combination
of image transformation and a well known encryption and 3.1.Construction of Magic Rectangle
decryption algorithm namely Blowfish. The initial image was
separated into blocks. The divided blocks were rearranged into 3.1.1. Magic Square
a transformed image using a transformation algorithm. Then
the transformed image was encrypted by applying the Blowfish The magic rectangle is similar to magic square. A magic
algorithm. The results concluded that the correlation between square is defined as an arrangement of integers of order nxn
image elements was significantly decreased. matrix. The important feature of a magic square is that the
A.Naresh Reddy, Rakesh Nayak and S. Baboo [9] presented sums of all the elements in every column, row and along the
the comparative study of RSA and NTRU (“non trivial ring two main diagonals are equal. The magic constant of a magic
units“ or “nth degree truncated polynomial ring units” or square depends only on n and has the value
“Number Theory Research Units”) algorithms for images as M (n) =n (n2+1) / 2
input and the results were assessed and compared so as to Magic square can be classified into three types: odd, doubly
identify the appropriate method for the business needs. even (n divisible by four), singly even (n is even and not
divisible by four). [2][10].
III. PROPOSED METHODOLOGY
3.1.2. Magic Rectangle
The images used will have their bytes extracted; the bytes
values are transposed as MR values and further encrypted to
A magic rectangle of order mxn is an arrangement of integers
obtain cipher text. The ciphering of the images for this work
such that the sums of all the elements in every row are equal
will be done only by using the byte values of the images. In
and also the sums of all the elements in every column are
this method, the RGB values of the image are not changed.
equal. The magic rectangle is in the category of singly even.ie,
Also there is no need to RGB expansion at the end of the
the order of the matrix is even but not divisible by the numeral
encryption and decryption process. The numerical values of the
04 such as 4x6, 8x12, 16x24, 32x48 and so on. Any order with
MR are displaced from their respective positions and encrypted
even number can be used in this work. It can be followed only
in order to obtain the cipher text. Therefore there is no change
the order 4x6, 8x12, 16x24, 32x48 etc. The size of the
in the total size of the image during encryption and decryption
rectangle is purely based on the rules of perfect rectangle or
process. The characteristic of image remains unchanged during

134 2015 International Conference on Computing and Communications Technologies (ICCCT’15)


golden rectangle and also the singly even magic rectangle. It modified to retain the original sign based on the bytes
follows the methodology of divide and conquer strategy [11]. generated at the initial stage. The entire process can be
In magic rectangle, column sum is fixed as 32x48. The existing reversed in the decryption process as illustrated in fig.2.
column sum is divided by two and then apply in 16x24. //Encryption //Decryption
Further the column sum is divided by two and apply in 8x12 Input:Image file (gif/bmp/jpg) Input:Cipher Text (Numeric Value)
matrix etc.This approach is adopted from divide and conquer Output:Cipher text(Numeric Value) Output: Image file (gif/bmp/jpg )
Method:
strategy. Method:
Step1: Read Image File
The column sum is taken as even value then it matches exactly Step2:Covert Image file into Step1: Read Cipher text
in magic rectangle. In case if the column sum is taken as odd Sequence of bytes Array Step2: For i= 0 to Cipher.length
Step3: For i= 0 to Barray.length //cipher array
value, then the column sum is reduced by one because of
//Bytearray Begin
fractional value. This paper focuses only a singly even magic Begin Flag=0;
rectangle implementation and their usefulness for public key Flag=0; If Cipher[i] <0 then
cryptosystem for image encryption and decryption process i.e. If Barray[i] <0 then
Begin
the order of magic rectangle must be even. Begin
pos=-Barray[i]; Cipher[i]=-Cipher[i];
Flag=1; Flag=1;
3.2.Creation of singly even magic rectangle end End
else Step 3: Decrypt using Algorithm
In this work, the singly even magic rectangle is generated by pos=Barray[i]; Pos =Marray[i];
Rarray[i]=MRarray[pos];
using any seed number, starting number and magic sum. The /*MagicRectagle array and Result
//MagicRectaglearray
numbers are generated in consecutive order [12]. If Flag=1 then
array*/
The proposed work uses the notations as listed below: Step 4: Encrypt using Algorithm Barray[i]=-Pos
Step 4: Convert Byte Array into
• MR :Magic Rectangle If Flag=1 then
Cipher[i]=-Cipher[i]; Image
• nxm :Order of MR //Cipher array Step 5: Produce original Image
where n=4a and m=6a End
where a=1, 2, 4, 8 etc Step 5: Produce Cipher Text
Fig.2. Pseudo code for Image Encryption and Decryption process
• MRnxm :MR of order nxm
• MRB4x6 :Base MR of order 4x6 3.4 Characteristics of an Image Cryptosystem
• MRnxmrsum :Row sum of MR of order nxm
• MRnxmcsum :Column sum of MR of order nxm For studying characteristics of image encryption, the first step
is to analyze the implementation differences between image
The values in the MRB4x6 are filled as shown in Table 1. and text data.
The function is called MR4x6 fill order (Minstart, Maxstart).
1. During the encryption process of text data, the decrypted
Table 1. Magic Rectangle Filling Order text must be equal to the original text in a full lossless
manner. However, this requirement is not necessary for
Maxstart *(+2) *(+4) -6 -16 *(+16)
image encryption; the cipher image can be decrypted to an
*(+8) -10 -12 *(+14) *(+24) -24 original image in some lossy manner.
-14 *(+12) *(+10) -8 -30 *(+30) 2. Text data is a sequence of words which can be encrypted
*(+6) -4 -2 *Minstart *(+22) -22 directly by using block or stream ciphers. However, digital
image data are represented as 2D array.
3. Since the storage space of a picture is very large, the
In Table.1, ‘*’ represents the places in magic rectangle to be process of encryption / decryption of the picture is very
filled having its starting point from Minstart and incremented difficult. One of the best method is image compression
by 2 each time to get the next number. The places without ‘*’ which reduces both its storage space and transmission time.
in magic rectangle to be filled having its starting point from In general, there are three basic characteristics in the
Maxstart and decremented by 2 to get the next number. information field: privacy, integrity and availability. For
privacy, an unauthorized user cannot disclose a message. For
3.3. Image Encryption and Decryption Algorithm integrity, an unauthorized user cannot modify or damage a
message. As far as availability is concerned, message is made
In image encryption process, the given image is converted into
available only to the authorized users. An image cryptosystem
the sequence of bytes. When the bytes are converted to the
cannot be called as a perfect cryptosystem even if it has a
numeric integer value, it may contain positive or negative
highly security mechanism, but it must also have elaborate
value as stored in Byte array (Barray). Before encryption, the
overall performance. The image security requires following
value in Byte array has been converted as positive values.
characteristics:
These values forms the position of MR. Finally, the encryption
1. The encryption system should be computationally secured.
process is being performed using any algorithm available in the
It requires an extremely long time to attack and any
public key cryptography. Then the resulting cipher text is

2015 International Conference on Computing and Communications Technologies (ICCCT’15) 135


unauthorized user should not be able to read privileged Encryption and decryption time of four test images are
image. measured before compression using RSA with Magic rectangle
2. The security mechanism must be as widespread as possible. and listed in Table 4.
3. The security mechanism should be flexible.
Table 4. Encryption and Decryption of image file before compression
4. There should not be a large expansion of encrypted image
data.
Image size(KB) Encryption Decryption Total
time(ms) time(ms) Time(ms)
IV.EXPERIMENTS AND RESULTS
hill.jpg(68.9) 172 234 406
The proposed methodology is implemented in Java. The time
Rose.jpg(125) 453 547 1000
taken for encryption and decryption of various size of image
files are measured. For instance, the given image rose.jpg is Plant.jpg(231) 640 750 1390
converted into numerical value by using magic rectangle. To
describe it in a detailed manner, the image file is changed into god.jpg(309) 797 1141 1938
byte array. The byte array consists of negative values before
replaced by the value of Magic Rectangle. Those negative The graphical representation of the above data is illustrated in
values are replaced as positive values and an identification tag fig.4. It is observed that the decryption time is always greater
has been provided to it. The converted values indicate the than the encryption time. The file size is directly proportionate
position of MR. The encryption process carried out with MR to the total time for encryption and decryption. Whenever the
and again original image is reconstructed by the decryption file size increases, so does the processing time.
process. This concept is illustrated in the fig.3.

4.1 Experimental results of RSA algorithm using Magic


Rectangle.

For the present experiment, the configuration of the system


used is Pentium Core I3 CPU -3217U @2.80Ghz and 32-bit
Operating System. The algorithm was applied on a Joint
picture Expert Group (JPEG) image that has various size of
pixels with 256 colors. Table. 2 represents the cipher text
generated by RSA without using MR as shown below.

Table 2. Encryption and Decryption of Image file without using MR value


Encryption Decryption Fig.4. Encryption and Decryption of image file before compression
ImageFile Cipher Cipher Image
(bytes) Text Text File(bytes) Encryption and decryption time of the selected four images are
40 388 388 40
measured after compression using RSA with Magic rectangle
12 476 476 12
32 119 119 32
and tabulated in Table 5. It is observed that using the
40 388 388 40 compression technique, the file size is reduced as
16 248 248 16 approximately half of the original size. It helps to reduce the
processing time.
Whenever the byte values of image are repeated, the value of Table 5. Encryption and Decryption of image file after compression
the cipher text remains same. Hence the intruders easily
identify the byte values of original image. It can be avoided by Image size(KB) Encryption Decryption Total
using MR as proved in Table 3. time(sec) time(sec) Time(sec)

Table 3. Encryption and Decryption of Image file Using MR Hillc.jpg(38.8) 172 234 406

Encryption Decryption Rosec.jpg(91.8) 453 547 1000


ImageFile MR Cipher Cipher MR Image
(bytes) Value Text Text Value File(bytes)
Plantc.jpg(112) 562 688 1234
40 1525 626 626 1525 40
12 6 325 325 6 12
Godc.jpg(109) 515 735 1250
32 198 111 111 198 32
40 1536 144 144 1536 40
16 1475 25 25 1475 16 Table 5 value is illustrated by means of graph as in Fig..5

136 2015 International Conference on Computing and Communications Technologies (ICCCT’15)


Fig.6 Sample output of the image encryption and decryption time before and after compression

Fig.3a Original Image Fig.3b Cipher text Fig.3c Decrypted Image

Fig.3 Encryption and Decryption process

size of the files are larger, the crypt time taken by the
uncompressed file is comparatively higher than the
compressed file.

Fig.5. Encryption and Decryption of image file after compression Fig.7. Comparison of execution time between compressed and uncompressed
files.
The sample output of encryption and decryption time of image
file using compression are presented in Fig.6. Finally the 4.2. Results and Discussion
execution time of both the compressed and uncompressed
image files are compared using the four selected images. The The proposed methodology image encryption and decryption
corresponding graph is represented in fig 7. The uncompressed using MR is implemented in Java. When the file size is
files needs more execution time than the compressed files. In increased, the encryption and decryption time will also
the first two cases of files, there is no much difference in file increases. It takes additional time to generate magic rectangle
size. The time taken for encryption and decryption towards and image compression during initial stage. The size of the file
these files is one and the same. In the rest of cases, where the is reduced by the compression technique. Hence additional

2015 International Conference on Computing and Communications Technologies (ICCCT’15) 137


time is not warranted for encryption and decryption process. [3]. Quist-Aphetsi Kester,” Image Encryption based on the RGB
The data communication security is enhanced due to the PIXEL Transposition and Shuffling”, International Journal of
Computer Network and Information Security, 2013, Vol 7,
randomness of the value of magic rectangle. The cipher text Pages:43-50.
format of the image also plays important role in improving the [4]. Musheer Ahmad, M. Shamsher Alam,” A New Algorithm of
security. The existing concept of image encryption and Encryption and Decryption of Images Using Chaotic Mapping”,
decryption used only the RGB color value and symmetric International Journal on Computer Science and Engineering,
algorithms. In the proposed Algorithm, both asymmetric Vol.2(1), 2009, 46-50.
[5]. Varsha Bhatt, Gajendra Singh Chandel,”Implementaion of new
algorithm and MR are used for image encryption. advance image Encryption Algorithm to enhance the security of
Multimedia Component” International Journal of Advanced
The proposed algorithm contains the following features. Technology & Engineering Research (IJATER), ISSN No: 2250-
1. Increases the randomness of the cipher text value. 3536 Volume 2, Issue 4, July 2012.
[6]. Hiral Rathod, Mahendra Singh Sisodia, Sanjay Kumar Sharma,”
2. Cipher text is in the form of numerical value instead of Design and Implementation of Image Encryption Algorithm by
image using Block Based Symmetric Transformation Algorithm (Hyper
image Encryption Algorithm)”, International Journal of Computer
3. No much differences in Encryption and decryption process Technology and Electronics Engineering (IJCTEE) Volume 1,
Issue 3, ISSN 2249-6343.
time.
[7]. Manoj. B, Manjula N Harihar,” Image Encryption and Decryption
using AES”, International Journal of Engineering and Advanced
4. Increases the complexity of initial activity such as image to Technology (IJEAT) ISSN: 2249 – 8958, Volume-1, Issue-5, June
number conversion using magic rectangle. 2012.
[8]. Mohammad Ali Bani Younes and Aman Jantan, “Image
5. To construct the magic rectangle from any starting value Encryption Using Block-Based Transformation Algorithm”,
and ending value IAENG International Journal of Computer Science, 35:1,
IJCS_35_1_03, 19 February 2008.
[9]. Naresh Reddy, Rakesh Nayak ,S. Baboo, “ Analysis and
6. To apply Magic rectangle concept in any type of file such
Performance Characteristics of Cryptosystem using Image Files”,
as text file, image file, audio file and video file. International Journal of Computer Applications (0975 – 8887)
Volume 51– No.22, August 2012
7. To overcome the attacks in RSA algorithm. [10]. Adam Rogers and Peter Loly ,”The inertial properties of Squares
and Cubes”, Nov-2004,pp.1-3
V. CONCLUSION [11]. Mohammad Zaidul Karim and Nargis Akter, “ Optimum Partition
Parameter of Divide-And-Conquer Algorithm for solving closest-
The proposed work introduces an additional level of security PairProblem”, International Journal of Computer Science &
using singly even magic rectangle. It enhances the randomness Information Technology (IJCSIT) Vol 3, No 5,Oct 2011.
of the calculated value in the cipher text. In the existing work, [12]. D.I.George Amalarethinam, J.Sai geetha, ,” Enhancing Security
Level for Public Key Cryptosystem Using MRGA”, World
the same cipher text value is repeated and the cipher text is in
Congress on Computing and Communication Technologies
the format of image only. In Magic rectangle, there is no (WCCCT),2014 Pages 98-102.ISBN:978-1-4799-2876-7.
repetition of values. Even though the repetition of same value [13]. B.Schenier. “Applied Cryptography”, John Wiley & Sons Inc,
takes place, it assigns different value for each occurrence. New York, Second Edition,1996.
There are several parameters used to construct the magic [14]. William Stallings, ”Cryptography and Network Security”, Prentice
Hall, Upper Saddle River, New Jersy, USA, Second Edition ,1997.
rectangle such as seed value, row sum, column sum and the [15]. Ashish Agarwala, R Saravanan,” A Public Key Cryptosystem
Minstart and Maxstart values. Hence it is difficult to identify the Based on Number Theory” 978-1-4673-0255-2, IEEE2012.
type of the original message whether text or image file, since
the cipher text is in the format of numerals instead of image. It
will be more helpful to increase the efficiency and security of
the algorithm. The future improvement needed in the proposed
work is to reduce the additional time needed for construction
of magic rectangle and compression of images.

References
[1]. A.J.Menezes ,P.C.Van Oorschot, and S.Vanstone , “Handbook of
Applied cryptography”, CRC Press, Boca Ration,Florida,
USA,1997.
[2]. Gopinath Ganapathy, and K.Mani , “ Add-On Security Model for
publickey Cryptosystem Based on Magic Square Implementation”,
ISBN 978-988-17012-6-8, Proceedings of the world congress on
Engineering and Computer Science 2009 Vol I, San Fransisco,
USA

138 2015 International Conference on Computing and Communications Technologies (ICCCT’15)

You might also like