Sie sind auf Seite 1von 9

Majlesi Journal of Multimedia Processing

Vol. 1, No. 1, March 2012

Designing and Simulating a Video Encryption Algorithm


Mohammad Reza Razmi1, MohsenAshoriyan2
1- Electrical Engineering Department, Islamic Azad University, Najaf Abad, Esfahan, Iran.
Email: mohamadreza_razmi1@yahoo.com

2- Electrical Engineering Department, Islamic Azad University, Majlesi, Esfahan, Iran.


Email: mohsena@yahoo.com

ABSTRACT: We present a Video Encryption Algorithm. The system is a selective encryption algorithm and it encrypts some effective coefficients of video frames in the discrete cosine transform domain. We use some permutations in the most important DCT coefficients for encrypting data of all blocks of frame. Also we use binary keys to do XOR with DC coefficient in each frame. The algorithm is used for all frames of several video sequences. Simulation results show that it has a high security level and a good resistance against various attacks. KEYWORDS: Security Video Information, Encryption Video Algorithm, Scramble Data;. INTRODUCTION Nowadays with the rapid development of various multimedia technologies, more and more multimedia data are generated and communicated [1]. But often this point insured that the digital information only are read by someone valid to read these information. So we need to protect them against hackers attacks when we will be saving and transmitting .Therefore protecting security of multimedia information is important. Many encryption algorithm have been proposed recently and everyone exhibit a solution for protecting video and image digital information but many of them is designed base on how much their data is important so in that case their algorithm would have suitable security level to protect data for example in many commercial application like pay-per-view video, pay TV and video demand (VOD), some encryption method are following some feature of image called perceptual encryption. They need to degrade quality of aural/visual data. Perceptibility of multimedia data makes a potential for users to product the video before buying them [2]. While some videos are used in military and security services, they must to use some encryption algorithms that having complex methods and high security level because they must not allow invalid users for accessing aural/visual data. In this article we will explore many video encryption algorithms with different security level and usage .Then we will propose our algorithm. Finally we 1. will present our simulating results of encrypting video by this algorithm. RELATED WORK AND EXITING PROBLEMS When we transfer video and image data on communication channels, we need an encryption algorithm to resist against hackers attacks and dont allow hackers access multimedia data. On the other hand image and especially video have very high bulk so some video and image compression standards like MPEG [3], JPEG and H.264 [4] are used for compressing video data [1]. It causes many video encryption algorithms act in video compression domain while some algorithms encrypt data in during or after compression standards [5]. In this section we will explore many video encryption algorithms and exit their advantages and problems. 2.1. Nave Encryption Algorithm Nave algorithm encrypts video like textual data and it dont use special structure for encrypting video [6-9]. This algorithm uses standard encryption algorithm such as DES or AES to encrypt video but it spend very long time to encrypt massive video data, so it has low speed and it isnt suitable for real time applications [1,9]. 2.

45

Majlesi Journal of Multimedia Processing 2.2. Qiao-Nahrstedt Qiao-Nahrstedt in [10] proposed one encryption algorithm standards for reducing ratio of data was encrypted. Actually this algorithm separates and they used symmetric key algorithm input video bit stream (a1, a2, a3 a2n) in two even index (a2, a4a2n) and odd index (a1, a3a2n-1) groups. Next it uses one key encryption for encrypting even index group E (a2, a4a2n) where E indicates one encryption function then output of the function XOR with odd index group. In this condition the algorithm has high complex level and it uses for encrypting key frames of MPEG video standards. The complexity of this algorithm is acceptable and almost it doesnt have extra computation [11]. 2.3. Shi,Wang,Bhargava Encrption Algorithms Shi, Wang, Bhargava have four video encryption algorithms and they designed Algorithm I, Algorithm II(VEA), Algorithm III(MVEA), Algorithm IV(RVEA) for encrypting MPEG video standard [11,13]. In the next step, we will explore many of them. 2.3.1. Algorithm I Algorithm I use for encrypting JPEG images, MJPEG video and I frame of MPEG video [11]. In fact this algorithm encrypt video and images by permuting Huffman code words in key frames of video. The algorithm encrypts in during of video compression process. An important section of this algorithm is permutations using for Huffman code words [1]. This algorithm is very vulnerable to known cipher text attacks [14,15] 2.3.2. Algorithm II(VEA) We know blocks of key frames of MPEG video include the most important data so this algorithm XOR the sign bits of DC coefficients with binary keys in the frame. Security of the algorithm depend the length of binary key although having very long key is impossible. On the other hand the algorithm is easily broken with short binary keys [11-12,15] 2.3.3. Algorithm III(MVEA) The third algorithm (MVEA) s improved the second algorithm (VEA). In this algorithm instead of encrypting just sing bits of DC coefficients in I blocks, sing bits of motion vectors in frame P and B XOR secret key. The algorithm makes an incomprehensible frame. Eventually security of MVEA algorithm same VEA algorithm depends the length of key as well as effective of encrypting motion vectors is obvious when the video frame is more locomotive. In other words the distortion is produced by VEA and MVEA algorithm in same motionless video is more similar together [11,1516].

Vol. 1, No. 1, March 2012

2.4. Tang Encryption Algorithm Tangs scrambling method is based on embedding the encryption process in the MPEG compression process by moving DCT coefficients in each block [17]. This change causes an increase about 25% to 60% in to the video size, which is not favorable. Zeng and Lie extended Tang permutation range from block to segment. Each segment consisting of several macro blocks. Within each segment, DCT coefficients of the same frequency band are randomly shuffled within the same band [18]. Chen further modified this idea by extending the permutation range from a segment to a frame [19]. DESIGNING ENCRYPTION ALGORITHM We consider that we know how compress video data so we will be going to design one selective video encryption algorithm. Being more specific it operates after DCT coefficients quantization and before entropy coding. The algorithm has two sections: 4. Permuting DCT coefficients 5. XOR some effective DCT coefficients The algorithm is a selective encryption algorithm, using XOR to the affective DCT coefficients, There were studies about effectiveness of DCT coefficients in image. The results showed that encrypting the DC coefficient and first three AC coefficients to nine AC coefficients are more effective and they are suitable to hide video block details [9,20,21] our algorithm constructed in two section, XOR and permute DCT coefficients but about permutation coefficients we know low frequency AC coefficients have lower energy than DC coefficient in one block [9,12,22] so we will just permute randomly AC coefficients in each block. In that case if number of permuted AC coefficient increase, the algorithm will spend long time for encrypting also it will have high security level in hiding detail of frame and vice versa. If number of permuted AC coefficients in zig-zag order is lower, the algorithm will be fast and spend short time for encrypting but it will have low security level. Now we want to increase capability of encrypting algorithm in high security applications such as military application so we need to protect data of frame therefore number of AC coefficients must be more. In that case proposed algorithm will be more complex and have more secret keys but in some application we need to encrypt data in short time and low security level such as paid TV broadcasting, so number of AC coefficient must be lower. In that case we can set number of AC coefficients based on acceptable encryption complexity. Number of AC coefficient have ability to randomly permute in our algorithm are first 1 to 9 AC coefficients in zig-zag order while if n=1 we wont 3.

46

Majlesi Journal of Multimedia Processing have any permutation and when n=9, first nine AC coefficients in zig-zag order will permute. These permutations will use in all blocks of a key frame in a video. The next step of designing algorithm we will use XOR in DCT coefficients but we should prevent to reduce speed of algorithm and dont have extra operations and we know DCT coefficients have different energy level so it causes every DCT coefficients has different affection in detail of frame [9,11]. At the other hand we know the DC coefficient is main value of a block [9,12] and it has more energy than AC coefficients [9,23], so we do XOR on just DC coefficients. Fig. 1 shows how our proposed algorithm works. The steps of our proposed algorithm for encrypting all key frames are as follow: 1. Each quantized key frames divide to 88 blocks 2. Product randomly permutation as many as number of block and commensurate value of n when n=1,2,3,..,9 3. Use randomly permutation on first n AC coefficients of all blocks of frames 4. If m=0, so dont XOR DC coefficients and go step 5. If m=1, so for each blocks products 8 bits binary key 6. For each blocks of frame do XOR between DC coefficients and binary key 7. Rearrange 88 encrypted blocks 8. Rearrange encrypted frame by blocks 3.1. Computing Algorithm keys In this condition we will compute all number of algorithm keys in one frame: Number of keys for XOR with DC coefficients in a 8b m frame= 2 (1) When b equals number of blocks of a frame and if m equals 0, we dont XOR with DC coefficients and if

Vol. 1, No. 1, March 2012 m equals 1, we do XOR dc coefficients with binary keys. Number of randomly permutations of first C in a frame = (2 (2) ) (3 ) (3)

(n! )

Total key number of the algorithm in a key frame=

(2

8 m

n!

3.2. The required Length For Algorithm Keys We need a byte stream able to express all situations of algorithm keys. If n equals 1< n 9, so we need 3 bits and if n equals 9 (n=9), we need 4 bits also we need 8 bits to express randomly binary keys used in XOR with DC coefficients. In these conditions:

(8m + 3n) b L= (8m + 36) b

m = 0,1 and 1 n < 9 m = 0,1 and n = 9

(4)

Where, L is length of byes for all keys. b is number of block of frame. It should be mentioned that the algorithm is initialized at first and the key is constant for all frames. SIMULATING ENCRYPTION ALGORITHM We simulate this algorithm with MATLAB software. In this section we use two video files in QCIF format for simulation. Each video has 176144 pixels. We have three matrixes for each key frame which are Y, U, and V matrixes. Now, we have 396 blocks in Y (2 matrix and 198 blocks in U and V matrixes. Overall, )blocks for each key frame. When we we will have 594 use JPEG standard to compressing all key frames, in fact we will make M-JPEG video [22]. 4.

Fig. 1. Block diagram of the algorithm

47

Majlesi Journal of Multimedia Processing

Vol. 1, No. 1, March 2012


Table 1. Algorithm time table

4.1. Computing number of keys and length of bytes stream in simulating conditions In simulating conditions we have 594 blocks so b equals 594. At other hand we know DC coefficients play important role in hiding images and key frames so if we want to have high security level algorithm, we should XOR DC coefficients with binary keys. In that case m will equal one. About using randomly permutations, we consider n equals 5. It means 5 first AC coefficients in zig-zag order will have randomly permutations. Now we input above values in 3, 4 equations, in that case total of algorithm keys in a key frames equal 3.3757102665 and we will need 13662 bits to express all keys in bits stream. 4.2. Calculating Time Needed Breaking Encryption Algorithm Table 1 provides an estimate of the time needed to break the algorithm by testing all the keys. We simulated the proposed encryption algorithm. The processing time for one frame encryption is around 2.5 milliseconds. We use a computer with the following features: CPU=Intel dual core 2.5 GHz and Cache= 2M, RAM=2 GB (DDR2) Table (1) shows the time for breaking the encryption algorithm. This time is long for breaking encryption algorithm, so the algorithm is very safe and it has a high security level. Time need for testing all key (s) 8.4392102662

Time for encrypting one frame with one key (ms) 2.5 Encryption Type of algorithm

4.3. Security of DC Coefficients The DC coefficients play an important role in images and key frames [23], so having higher security level in algorithm will need more keys and uses more complex methods to encrypt DC coefficients. In that case a hacker has to spend much more time on decrypting the encryption system. We have already computed the number of keys to . So, a encrypt DC coefficients which equals hacker needs to spend 7.8070101427seconds on breaking our DC encryption system. This is a very long time, and it shows the high security of the designed algorithm through DC coefficients in frames. 4.4. Some Encrypted Frame Samples by the Algorithm In this section we can check some video encrypted by our new algorithm. We will input two video data in encryption system. They are Akiyo and Foreman videos. We show the first frame of these videos. We will be encrypting video data in different conditions of algorithm.

2-a)

2-b)

48

Majlesi Journal of Multimedia Processing

Vol. 1, No. 1, March 2012

2-c) 2-d) Fig.2-a. The first frame of Foreman video without encryption Fig.2-b. The first frame of Foreman video after encryption when m=1, b=594, n=5 Fig.2-c. The first frame of Foreman video after encryption when m=1, b=594, n=3 Fig.2-d. The first frame of Foreman video after encryption when m=0, b=594, n=3

3-a)

3-b)

Fig.3-a.The original first frame of Akiyo video sequence Fig.3-b. The first frame of Akiyo video after encryption when m=1, b=594, n=5 4.5. Video Recovery with Partial Key Information In this section we peruse the situation of encrypted frame by the algorithm when the hacker finds some of our keys. Our goal here will be to find out the behavior of encryption system in this case. Figure.8 shows encrypted first frame of Foreman video when m=1, b=594,n=5 but hacker has decrypted all AC1, AC3 and AC5 keys which equal 40 of all keys and he has earned a very unclear image.
Fig .8. The fist frame of Foreman video with all AC1, AC3 and AC5 decrypted in all blocks

4.6. Exploring What Happened If Hacker Has Main File and the Encrypted File In cryptography we consider the hacker knows how our algorithm works, but the algorithm keys play a very important role in providing data security.

49

Majlesi Journal of Multimedia Processing 2012 We use random and independent keys in each step of our algorithm. Also, these keys product independently and randomly and we use these for encrypting all key frames of video but when we will encrypt another video, these keys will product again and will be change. So, if a hacker earns main video file and encrypted video file, he can extract only the keys which are used to encrypt that video and are not necessarily used to encrypt other videos. In fact, it would be impossible to hack into encryption system through having comparison among the original video and the encrypted one in real time.

Vol. 1, No. 1, March

4.7. Statistical Attack Analysis This attack is lunched by using the predictable relationship original data of block and encrypted data of same block [24]. In fact histogram curve of image and key frame reflect distortion pixel in RGB level which this analysis is used for proving any relationship between original unencrypted data and encrypted data of key frame or image [25]. There is significantly different between distortion of pixel in RGB levels of original and encrypted frame. It indicates that there isnt any relationship between original and encrypted image.

Fig.9. Histogram curve of Foreman original frame

Fig.10. Histogram curve of Foreman encrypted frame

Fig.11. Histogram curve of Akiyo original frame 50

Majlesi Journal of Multimedia Processing 2012

Vol. 1, No. 1, March

Fig.12. Histogram curve of Akiyo encrypted frame

51

Majlesi Journal of Multimedia Processing 2012 ALGORITHM SIMULATING THE RESULTS In this article we designed a video encryption algorithm. It is a kind of selective encryption algorithm and it is simulated by MATLAB soft ware. In this section we review results of simulation. 5.1. Security Analysis of Encrypting Algorithms Table 2 shows the summary of algorithm features and simulation results when m=1, b=594, n=9. The number of encryption keys in our designed algorithm is considerably high. Considering the time needed to encrypt a frame by a key from Table (2), it takes long time to decrypt each only one frame. 5.2. Analysis of Encryption Algorithm Speed Referring to the parameter Time required to execute a key in each frame from table (2), we can see that the algorithm spends a suitable time to encrypt a frame and also it is suitable for real time applications. Table 2. Summary of the Designed Encryption Algorithm Designed Algorithm Properties Algorithm Number of frames in a 1.9104738 frame Number of DC coefficient 3.1228101430 keys in each frame Time required to execute 2.5ms a key in each frame Required time to test all 4.75104735 s the keys in a frame to hack into Length of byte stream 3.3KB delivering encryption keys High Algorithm speed High Algorithm security 5.3. Conclusion Since the algorithm presented in this article performs encryption process during compressing the main frame of the video, it can be used to encrypt the key frame in MPEG, MPEG4, H.26x, and M-JPEG. It is easily possible to have a tradeoff between complexity and security of algorithm. REFERENCES
[1] Abomhara, M., Zakaria, O., Othman, O., Khalifa, : An Overview of Video Encryption Techniques. International Journal of Computer Theory and Engineering,Vol. 2, No. 1 February,(2010) Shujun, L., Chen, G., Cheung, A., Bhargava, B., Tung, L. : On the Design of Perceptual MPEGVideo Encryption Algorithms, IEEE Transactions [16]

Vol. 1, No. 1, March


on Circuits and System for ideo Technology, Vol.17 ,No.2 Pages 214-223,February (2007) MPEG Technology Group: http://www.chiariglione.org/mpeg/, (Accessed on March 2, 2009). Ostermann, J. , Bormans, J., List, P., Marpe, D., Narroschke, M., Pereira, F., Stockhammer, T., Wedi, T.: Video coding with H.264/AVC: tools, performance, and complexity. IEEE circuits and system magazine , Vol 4,issue 1 , pp. 7-28, 2004. Socek1, D., Kalva1, H., Spyros, S., Magliveras, O., Marques1, D., Culibrk: New Approaches to Encryption and Steganography for Digital Videos, Department of Computer Science and Engineering, 2 Department of Mathematical Sciences Florida Atlantic University, Boca Raton FL 33431, USA Salah, A. : A Light-Weight Encrypting For Real TimeVideoTransmission.http://www.cdm.depaul.ed u/research/Documents/TechnicalReports/2004/TR04002.pdf. Accessed on March 2, (2009). Lian, S. : Multimedia Content Encryption: Techniques and Applications. CRC, (2008). Wu, C.P., Kuo, C.C. J.: Design of integrated multimedia compression and encryption systems. IEEE Trans. Multimedia, vol. 7, no. 5, pp. 828-839, (2005). Raju, C.N., Srinathan, K., and Jawahar, C. V. : A Real-Time Video Encryption Exploiting the Distribution of the DCT coefficients . International Institute of Information Technology ,Hyderabad, India Qiao, L., and Nahrstedt, K.: A new algorithm for MPEG video encryption. The First International Conference on Imaging Science, Systems, and Technology (CISST'97), (Las Vegas, Nevada), pp. 21{29, July} (1997). D., Socek : Permutation Based Transformation For Digital Multimedia Encryption and Steganography By Florida Atlantic University. Boca Raton, Florida August (2006) Shi, C., and Bhargava, B. : A Fast MPEG Video Encryption Algorithm. Proceedings of the 6th International Multimedia Conference, Bristol, UK, September 12-16, (1998). Shi, C., Wang, S.Y. and Bhargava, B. : MPEG Video Encryption in Real-Time Using Secret key Cryptography. International Conference on Parallel and Distributed Processing Techniques and Applications (PDPTA'99), Las Vegas, NV, June 28 July 1, (1999). Seidel, T., Socek, D., and Sramka, M. : Cryptanalysis of Video Encryption Algorithms . to appear in Proceedings of The 3rd Central European Conference on Cryptology Tatracrypt, Bratislava, Slovak Republic, (2003). B., Furht. D., Socek : A Survey of Multimedia Security . Department of Computer Science and Engineering ,Florida Atlantic University, August 21, (2003) Bhargava, B., and Shi, C. : An Efficient MPEG Video Encryption Algorithm. IEEE Proceedings of the 17th Symposium on Reliable Distributed Systems, , Pages 381 386, (1998) L., Tang : Methods for Encrypting and Decrypting MPEG Video Data ,Efficiently. In Proc. of ACM Multimedia, pp 219-229, (1994).

5.

[3] [4]

[5]

[6]

[7] [8]

[9]

[10]

[11]

[12]

[13]

[14]

[15]

[2]

[17]

52

Majlesi Journal of Multimedia Processing 2012


[18] W., Zeng and S., Lei : Efficient Frequency Domain Selective Scrambling of Digital Video. In Proc. of the IEEE Transactions on Multimedia, pp 118-129, (2002). Chen, Z., Xiong, Z., and Tang, L. : A Novel Scrambling Scheme for Digital Video Encryption. In Proc. of Pacific-rim Symposium on Image and Video Technology (PSIVT), pp 997-1006, (2006). Meyer, J., and Gadegast, F. : Security Mechanisms for Multimedia Data with the Example MPEG-1 Video. In Web, (1995). Liu, Z., Li, X., and Dong, Z. : Enhancing Security of Frequency Domain Video Encryption, In Proc. of ACM Multimedia, pp 304 307, (2004). Uehara, T. and Naini, R.S. : Recovering DC coefficients in block-based DCT. In Proc. of IEEE Transactions on Image Processing, volume II, pages 35923596, (2006). kailasanathan, C., Aini,R.S. : Compression performance of JPEG encryption scheme. Departeman of computer science , University of wollonogog,(2002) Marion, A. : An introduction to image processing. London: Chapman and Hall;(1991). Tanejaa, N., Ramanb, B., Guptaa, I. : Selective image encryption in fractional wavelet .domain a Department of Electrical Engineering, Indian Institute of Technology, Roorkee, India , Department of Mathematics, Indian Institute of Technology, Roorkee, India,(2002)

Vol. 1, No. 1, March

[19]

[20] [21] [22]

[23]

[24] [25]

53

Das könnte Ihnen auch gefallen