Professional Documents
Culture Documents
Cipher Text
Figure 1: AES encryption algorithm 3. 128 bit key: 1234567891234567 (16 positions)
INPUT MESSAGE: 9876543219876543 (16 positions)
Encrypted message:
Decrypted message:
Encrypted message:
Decrypted message: Same as input message
5. 128 bit key: abcdefghijk (11 positions)
INPUT MESSAGE: pqrstuvwxyz (11 positions)
Encrypted message:
Figure 2: AES decryption algorithm Decrypted message: Same as input message
6. 128 bit key: ABCDEFGHIJK (11 positions) Observation 9 if we write key in the form of numbers
and input message in the form of letters it provides at that
INPUT MESSAGE: pqrstuvwxyz (11 positions)
time decrypted message contains original message along
with input message.
Encrypted message:
Decrypted message: Same as input message 7. Image Encryption
7.1 Need of Image Encryption
Many digital services like multimedia systems, medical
7. 128 bit key: ABCDEFGHIJK (11 positions) and military imaging systems, internet communication
INPUT MESSAGE: PQRSTUVWXYZ (11 positions) require reliable security in storage and transmission of
digital images. Due to growth of internet, cell phones,
Encrypted message: multimedia technology in our society digital image
Decrypted message: Same as input message security is the most critical problem. In these technology
digital images plays more significant role than the
traditional texts. It demands serious protection of users'
8. 128 bit key: zyxwvutsrqp{?”% (15 positions) privacy for all applications. Therefore image encryption
INPUT MESSAGE: 678912345054321(15 positions) techniques are usually used to avoid intrusion attack [7].
Correlation among pixels and high redundancy, these
Encrypted message: characteristics are varies according to type of multimedia
data. Therefore generally same technique cannot be used
Decrypted message: Same as input message
to protect all types of multimedia data.
We may not use the traditional encryption algorithms to
encrypt images directly because two reasons.
9. 128 bit key: 7891223737445576 (16 postions)
1) The size of image is often larger than text. Hence
INPUT MESSAGE: Iugehawrmuetbyjl (16 postions) traditional encryption algorithms take larger time to
encrypt and decrypt images compared to text.
Encrypted message: 2) In text encryption both decrypted and original text
Decrypted message: must be equal. This condition is never true for images.
Because due to human perception; decrypted image with
small distortion is usually acceptable (Chang et al, 2001),
(Jiri Jan, 2005), (David Salomon, 2005). We can reduce
6. Observations this perceivable information by decreasing the correlation
Observation 1 concludes that any normal text along with among image elements using certain transformation
symbol in both key as well as input can be easily techniques (Mitra et al, 2006).
encrypted and decrypted. Considering the above points, this research of image
Observation 2 concludes that any same number sequence encryption is divided into two parts. 1) First encryption
written in key as well as input produces the decrypted and decryption of image data is perform by Code Block
message which contains encrypted message also. Chaining method with PKC 5 padding of Advanced
Observation 3 concludes that any number different types Encryption standard. 2) After this we will perform
of number sequence written as a key and input produce password based encryption and decryption of image with
decrypted output along with encrypted message. It means the help of using MD5 and DES algorithm together.
that if we write numbers in key and input message at that
time decrypted message contains original message along 7.2 Digital Image Formats
with input message. There are many types of digital image formats like .bmp,
Observation 4 concludes that if we write same text .gif, .jpg, .pict, .eps and .png. This project can use any
message in input as well as key it will perform normal kind of format. The results obtain in this paper are mainly
encryption and decryption. using .gif format only. Therefore the detail explanation
Observation 5, 6 and 7 concludes that AES is case regarding .gif file format is given below.
sensitive algorithm if case of input message only or key a. GIF Files
only or both input message and key are change then it The Graphics Interchange Format (GIF) was originally
will produces a different encrypted message and invented by CompuServe in 1987. It is mainly used file
expected decrypted message. formats for web graphics and exchanging graphics files
Observation 8 if we write letters along with symbols in between computers. GIF format supports 8 bits of color
place of key and if input provided is in number form it information. This information is limited to 8 bits palette
will perform normal encryption and decryption and and 256 colors. Therefore 256 different colors are
provide input message as a decrypted message. available in this format to represent the picture. GIF also
support transparency, interlacing and animation. detected with a separate message authentication code such
(Gardner and Betcher, 2006), (Robert Fry, 2006). as CBC-MAC, or a digital signature.
When we use LZW (Lempel-Ziv-Welch) method to save
8.1 Initialization Vector (IV)
GIF images, GIF images are automatically compressed.
Initialization vector (IV) or starting variable (SV) [19] is
LZW method also does degrade any image quality.
a block of bits. Several modes use it to randomize the
Features of GIF format: transparency, interlacing, file
encryption. By this randomization it produces distinct
compression, and primitive animation.
ciphertexts even if the same plaintext is encrypted
The interlacing feature browser can display portions of
multiple times, without the need for a slower re-keying
the image as it updates. Because of updating of
interlacing part the original poor image becomes more process [20].
and better.
Security requirements of an initialization vector are
different than a key, so the IV usually does not need to be
8. AES Block Cipher Mode of Operation secret. Therefore in most cases, it is important that an
ECB, CBC, OFB, CFB, CTR, and XTS are the different initialization vector is never reused under the same key.
modes of operation of AES. Here we use CBC mode with But for CBC and CFB mode, due to reusing an IV leaks
PKCS5 padding. Following section briefly introduces some information about the first block of plaintext, and
cryptographic modes and padding techniques. about any common prefix shared by the two messages.
A. What is Mode of Operation? For OFB and CTR both modes effectively create a bit
In cryptography some algorithm uses a block cipher to stream that is XORed with the plaintext, and this bit
provide an information service such as confidentiality or stream is dependent on the password and IV only. Due to
authenticity, these algorithm are called as mode of that in these modes, reusing an IV completely destroys
operation of cryptography.[15] The secure cryptographic security [20]. This can be seen because both modes
transformation (encryption or decryption) of one fixed- effectively create a bit stream that is XORed with the
length group of bits called a block is the only function plaintext, and this bit stream is dependent on the
performs by block cipher.[16] To securely transform password and IV only [22]. In CBC mode use of the IV is
amounts of data larger than a block it is needed to must; in addition, it should be unpredictable at encryption
repeatedly apply cipher’s single-block operation. The time. Therefore it can be conclude that, the (previously)
procedure of applying this operation is described by mode common practice of re-using the last cipher text block of
of operation algorithm.[17][18][19]. a message as the IV for the next message is insecure.
For each encryption operation most of the modes require In TLS CBC IV attack, if an attacker knows the IV or he
a unique binary sequence which is called initialization knows the previous block of cipher text before he specifies
vector (IV). The IV is always needed to be non-repeating next plaintext. In such scenario an attacker can guess
and for some modes random as well. Even when the same about the plaintext of some block that was encrypted with
plaintext is encrypted multiple times independently with the same key before [23].
the same key, distinct ciphertexts must be produced each
time. To ensure that use of initialization vector is 8.2 Padding
important.[20] Size of blocks within a block cipher mode A block cipher works on fixed block size units, but length
may be variable but during transformation the block size of coming messages are variable. So some modes like
is always fixed. Operation by block cipher is performed ECB and CBC require that the final block be padded
onto the complete block. During this operation it is before encryption. In padding method extra bits are
require that, the last part of the data must be padded to a padded (i.e. added) in text message to make require size
full block if it is smaller than the current block size.[16] of block for encryption. Several padding schemes exist. In
In some modes block cipher is effectively used as a stream simplest padding scheme we add null bytes to the
cipher. In such modes padding does not require. plaintext to bring its length up to a multiple of the block
size. In this scheme care must be taken that the original
Traditionally, main use of encryption modes is to provide length of the plaintext can be recovered. For example, if
error propagation property under various scenarios of data the plaintext is a java style string which contains no null
modification. Recently integrity protection is an entirely bytes except at the end. Another more complex example
separate cryptographic goal. In efficient way combination is the original DES method. In this method to fill out the
of confidentiality and authenticity is provided by some block a single bit is added, followed by enough zero bits.
modern modes of operation. These modes are known as A whole padding block will be added whenever this
authenticated encryption modes.[17] message ends on a block boundary. Schneier and
Ferguson suggest two simple methods of padding which
In AES algorithm confidentiality is provided by block are as follows: (a) Pad the last block with n bytes all with
cipher modes such as ECB, CBC, OFB, CFB, CTR, and value n. (b) Append a byte with value 128 (hex 80),
XTS, but they do not protect against accidental followed by as many zero bytes as needed to fill the last
modification or malicious tampering. These accidents are block.
8.3 Operation of Image Encryption and Decryption 8.4 What is PKCS5 padding?
Execute the Encrypt code This scheme is use to pad clear text to be multiples of 8-
byte blocks.
Read the input image from the specified location DES algorithm requires that the input data to be 8-byte
blocks. Suppose any text message is not the multiples of
Apply AES –CBC–PKCS5 padding algorithm to this image 8-byte blocks. Then the encryption of such text messages
is performing by padding method. In this we pad
additional bytes to text message to make text messages to
Get a password from the user
be multiple of 8-byte blocks.
PKCS5Padding scheme is described in: RSA
Laboratories, "PKCS #5: Password-Based Encryption
Append salt bytes to the password before it is used to Standard," version 1.5, November 1993.
calculate the key
It follows the following rules:
1) The number of bytes to be padded = 8 – (number Of
Make password based encryption with MD5 and DES Bytes (clearText) mod 8).
algorithm
2) Depending on the length of the clear text data 1 to 8
bytes will be padded to the clear text data.
Make a PBE Cipher object and initialize it to encrypt using 3) All padded bytes have the same value - the number of
the given password bytes padded.
PKCS5Padding scheme can also be explained with the
diagram below.
Save the new encrypted image to the specified location
Where, M= original clear text and PM = padded clear
text:
If number Of Bytes (clearText) mod 8 == 7, PM = M +
Encrypted Image
0x01 (6)
If number Of Bytes (clearText) mod 8 == 6, PM = M +
Figure 3: Flowchart of Encryption Process 0x0202 (7)
The detail process of image encryption and decryption is If number Of Bytes (clearText) mod 8 == 5, PM = M +
shown in the block diagrams given in figure 3 and figure 0x030303 (8)
4 below. If number Of Bytes (clearText) mod 8 == 0, PM = M +
0x0808080808080808 (9)
8.5 What Is The Use Of Hash Function?
Execute the Decrypt code It is a cryptographic function. It is mainly an algorithm
that takes an arbitrary block of data and returns a fixed-
Get another same password from the user size bit string. Any change in data will change the hash
value. The data to be encoded is called the “message,”
and the hash value is simply called digest or called the
No message digest.
Is this expected
password?
8.6 Why Salt is needed to add?
If any password is hashed, any identical password will
Yes have the same hash. Only storing the password’s hash
Detect and remove the appended salt bytes from the creates two drawbacks as given: (1) Attacker can find a
password
password very quickly by using birthday paradox method
(given at http://en.wikipedia.org/wiki/Birthday_paradox).
It will become much easier if large numbers of passwords
Now read the encrypted image from the specified location
are store in database. (2) An attacker can break the
password in seconds by using the list of pre computed
Make a PBE Cipher object using MD5 and DES algorithm hashes (given at
and initialize it to decrypt using the given password. http://en.wikipedia.org/wiki/Rainbow_table).
To remove these drawbacks a salt can be concatenated to
the password before performing the hash operation.
Decrypt the image and save it to specified location
Salt: It is fixed length random number. It must be
different for each stored entry. It is stored after hashed
password in the form of clear text.
Decrypted Image
In this configuration, on each individual password an
attacker must handle a brute force attack. Birthday
Figure 4: Flowchart of Decryption Process attack/rainbow crack resistant is the database in this case.
10. Conclusion
This paper shows successful implementation of text and
image encryption as well as decryption. Due to
combination of C code, Code Composer Studio and DSP
processor a unique solution for text encryption is provided
Figure 5: Input original image before encryption
here. This text encryption uses 128 bit size of key as well
as plaintext. Each word or space is converted into 8 bit
The cipher text image is blank image .GIF file of size 216
sequence. Therefore maximum total 16 positions are
kb as shown below: recognized by this code. Letters, spaces, numbers or
symbols can be written to these 16 positions. Results
showed here uses different numbers, symbols and letters
for text encryption. All the observations clearly conclude
the behaviour of text encryption code.
AES encryption algorithm in CFB mode is used here for
image encryption. PKCS5Padding method is used here.
Figure 6: Encrypted image The comparative performance benefit of code is clearly
shown here. It can clearly conclude from the table 5, 6
This image is output of encryption and input to and 7 that AES is fastest algorithm among all others.
decryption. The decrypted output image looks like Java Application Platform SDK is open source software
original image. It is also .GIF file of size 216 kb as below: therefore image encryption can be provided without
investing any cost.
The proposed methodology is applied for ensuring the
personal privacy in the context of surveillance video-
camera systems. Only authorized users that possess the key
key can decrypt the entire encrypted image sequence. The
proposed method has the advantage of being suitable for
mobile devices, which currently use the JPEG image
compression algorithm, due to its lower computational
Figure 7: Decrypted image after decryption requirements. The experiments have shown that we can
achieve the desired level of encryption in selected areas of [8] AES page available via
the image, while maintaining the full JPEG image http://www.nist.gov/CryptoToolkit.
compression compliance, under a minimal set of [9] Computer Security Objects Register (CSOR):
computational requirements. http://csrc.nist.gov/csor/.
[10] J. Daemen and V. Rijmen, “AES Proposal: Rijndael,
11. Future Scope AES Algorithm Submission”, September 3, 1999.
The proposed system can be extended to standard video [11] J Daemen and V. Rijmen, “Ihe block cipher Rijndael
coding systems such as those using MPEG and other video Smart Card research and Applications”, LNCS 1820,
formats. All the existing costly encryption products will Springer-Verlag, pp. 288-296.
have no use in future if the video encryption also invented [12] B. Gladman’s AES related home page
with royalty free open source software. Therefore it will be http://fp.gladman.plus.com/cryptography_technology
the most flexible and cheaper solution. /.
[13] A. Menezes, P. van Oorschot, and S. Vanstone,
In this world of internet encryption of every multimedia Handbook of Applied Cryptography, CRC Press, New
data is the basic need of all communication systems. York, 1997, p. 81-83.
Tremendous change in technology will appear if this [14] A. Lee, NIST Special Publication 800-21, Guideline
solution is free of cost. for Implementing Cryptography in the Federal
Today mobile phones are most important and habitual Government, National Institute of Standards and
thing for each human being. In the same way this Technology, November 1999.
encryption technology will become the basic need of [15] NIST Computer Security Division's (CSD) Security
everyone. Technology Group (STG) (2013). "Block cipher
modes". Cryptographic Toolkit. NIST. Retrieved
References April 12, 2013.
[1] Manoj. B, Manjula N Harihar, “Image Encryption [16] Ferguson, N.,Schneier, B. and Kohno, T.
and Decryption using AES” International Journal of Indianapolis “Cryptography Engineering: Design
Engineering and Advanced Technology (IJEAT) Principles and Practical Applications.” Wiley
ISSN: 2249 – 8958, Volume-1, Issue-5, Publishing, Inc. 2010. pp. 63, 64. ISBN 978-0-470-
June 2012 47424-2.
[2] Swati Paliwal and Ravindra Gupta, “A Review of [17] NIST Computer Security Division's (CSD) Security
Some Popular Encryption Techniques”, International Technology Group (STG) (2013). "Proposed modes".
Journal of Advanced Research in Computer Science Cryptographic Toolkit. NIST. Retrieved April 14,
and Software Engineering Research Paper, Volume 2013.
3, Issue 2, February 2013, ISSN: 2277 128X [18] Alfred J. Menezes, Paul C. van Oorschot and Scott
Available online at: www.ijarcsse.com A. Vanstone (1996). Handbook of Applied
[3] William Roche, “The Advanced Encryption Cryptography. CRC Press. pp. 228–233. ISBN 0-
Standard, The Process, Its Strengths and 8493-8523-7.
Weaknesses”, University of Colorado, Denver, [19] ISO, JTC 1/SC 27 (2006). "ISO/IEC 10116:2006 -
Spring 2006 Computer Security Class, CSC 7002, Information technology --Security techniques --
Final Paper May 6, 2006. Modes of operation for an n-bit block cipher". ISO
[4] Simar Preet Singh, and Raman Maini “Comparison Standards catalogue.
of Data Encryption Algorithms” International [20] Kuo-Tsang Huang, Jung-Hui Chiu, and Sung-Shiou
Journal of Computer Science and Communication Shen (2013). “A Novel Structure with Dynamic
Vol.2, No. 1, January-June 2011, pp. 125-127 Operation Mode for Symmetric-Key Block Ciphers”
[5] Prasithsangaree.P and Krishnamurthy.P(2003), International Journal of Network Security & Its
“Analysis of Energy Consumption of RC4 and AES Applications (IJNSA) 5 (1): 19.
Algorithms in Wireless LANs,” in the Proceedings of [21] NIST Computer Security Division's (CSD) Security
the IEEE GLOBECOM 2003, pp. 1445-1449. Technology Group (STG) (2013). "Current modes".
[6] Dr. S.A.M Rizvi1, Dr. Syed Zeeshan Hussain2 and Cryptographic Toolkit. NIST. Retrieved April 12,
Neeta Wadhwa “A Comparative Study of Two 2013.
Symmetric Encryption Algorithms Across Different [22] "Stream Cipher Reuse: A Graphic Example".
Platforms” Cryptosmith LLC. Retrieved 27 March 2013.
[7] Mohammad Ali Moh'd Bani Younes, “An Approach [23] B. Moeller (May 20, 2004), Security of CBC
To Enhance Image Encryption Using Block-Based Ciphersuites in SSL/TLS: Problems and
Transformation Algorithm”, Thesis submitted in Countermeasures
fulfillment of the requirements for the degree of [24] William F. Ehrsam, Carl H. W. Meyer, John L.
Doctor of Philosophy University of Sains Malaysia, Smith, Walter L. Tuchman, "Message verification
2009. and transmission error detection by block chaining",
US Patent 4074066, 1976
Volume 3, Issue 3 May – June 2014 Page 125
International Journal of Emerging Trends & Technology in Computer Science (IJETTCS)
Web Site: www.ijettcs.org Email: editor@ijettcs.org
Volume 3, Issue 3, May – June 2014 ISSN 2278-6856