in Embedded Systems CRYPTOGRAPHY IN EMBEDDED SYSTEMS

1INDERJIT SINGH, 2KHUSHBOO JHINGRAN, 3JEENAL SHAH

Department of Electronics Engineering , Fr. Conceicao Rodrigues College of Engineering , Mumbai University Fr. Agnel Ashram, Bandstand, Bandra (W), Mumbai

Abstract— It is widely recognized that data security will play a central role in the design of future IT systems. Many of those IT applications will be realized as embedded systems, which rely heavily on security mechanisms. Examples include security for wireless phones, wireless computing, pay-TV, and copy protection schemes for audio/video consumer products and digital cinemas. Note that a large share of those embedded applications will be wireless, which makes the communication channel especially vulnerable. All modern security protocols use symmetric-key and public key algorithms. This contribution surveys several important cryptographic concepts and their relevance to embedded system applications. The security requirements, such as authentication, confidentiality and integrity, always make computationally intensive processes and can easily become the bottleneck of the related applications. This paper presents implementation of KKJEIN algorithm on the ATMEL Microprocessor AT89C51. It shows how cryptography can be implemented for data transfer between two microprocessors using serial ports.

Keywords— Cryptography, symmetric key cryptography, public key cryptography.

The important criterion to check on a symmetric I. INRODUCTION encryption algorithm was the efficiency of the cipher

Now a days embedded systems are increasingly in different platforms, including microcontrollers. used in many distributive applications due to which Since 2001, various implementations have the need for them to communicate among themselves consequently been proposed, exploring the different and other peripherals has risen in the same possible design tradeoffs ranging from the highest magnitude. This communication essentially happens throughput (the speed of the algorithm) to the in an open media, where the data becomes vulnerable smallest area. Each of those implementations usually and hence, any private information communicated focuses on a particular understanding of "efficiency". between any two may be known to others. The necessity to provide digital data security in open II. CRYPTOGRAPHY OVERVIEW access channel invites the science of secret writing called cryptography. In simple words, any procedure Cryptography is where security engineering meets that performs some mathematical operations between mathematics [1]. It provides us with the tools that the data to be communicated (plain text) and a underlie most modern security protocols. It is character string of length K-bits (key) to produce the probably the key enabling technology for protecting result (cipher text) may be called as encryption and distributed systems, yet it is surprisingly hard to do the reverse operation that brings back the plain text is right. Figure 1, shows the block diagram of called decryption in the world of cryptography. cryptography. A new blend of hardware and software is currently being used for encryption in order to combine the best features of both. This provides a considerable speed advantage and security. Additionally, it provides for ease of programming. The need for secure data not only applies to wired and wireless communications, but also is important in applications where access control, data integrity, confidentiality, and authentication are required. For this reason, cryptography will find its way into a host of common devices, including banks, ATMs, kiosks, information Figure 1. Block diagram of cryptography portals, video surveillance equipment, building access

controls, etc. The input to an encryption process is commonly This paper describes a hardware system using called the plaintext, and the output the cipher text. AT89C51 to implement KKJEIN algorithm which is There are a number of cryptographic primitives-basic a combination of ceaser cipher and XOR cipher. Even building blocks, such as block ciphers, stream though nowadays this method is not considered as ciphers, and hash functions. Block ciphers may either secure, it helps us to understand various other have one key for both encryption and decryption, in symmetric key cryptography algorithms. which case they’re called shared key (also secret key

Proceedings of SARC-IRAJ International Conference, 22nd June 2013, New Delhi, India, ISBN: 978-81-927147-6-9

24 Cryptography in Embedded Systems or symmetric), or have separate keys for encryption Generic PKC employs two keys that are and decryption, in which case they’re called public mathematically related although knowledge of one key or asymmetric. A digital signature scheme is a key does not allow someone to easily determine the special type of asymmetric crypto primitive. other key. One key is used to encrypt the plaintext and the other key is used to decrypt the cipher text. III. TYPES OF CRPTOGRAPHY The important point here is that it does not matter ALGORITHMS which key is applied first, but that both keys are required for the process to work (Figure 3). Because a There are several ways of classifying pair of keys is required, this approach is also called cryptographic algorithms [2]. For purposes of this asymmetric cryptography. paper, they will be categorized based on the number In PKC, one of the keys is designated the public of keys that are employed for encryption and key and may be advertised as widely as the owner decryption, and further defined by their application wants. The other key is designated the private key and use. The three types of algorithms that will be and is never revealed to another party. discussed are: A. Secret Key Cryptography (SKC) C. Hash Function

Figure 4. Hash function

Figure 2. Secret key cryptography Hash functions, also called message digests and With secret key cryptography, a single key is used one-way encryption, are algorithms that, in some for both encryption and decryption. As shown in sense, use no key (Figure 4). Instead, a fixed-length Figure 2, the sender uses the key (or some set of hash value is computed based upon the plaintext that rules) to encrypt the plaintext and sends the cipher makes it impossible for either the contents or length text to the receiver. The receiver applies the same key of the plaintext to be recovered. Hash algorithms are (or rule set) to decrypt the message and recover the typically used to provide a digital fingerprint of a plaintext. Because a single key is used for both file's contents often used to ensure that the file has functions, secret key cryptography is also called not been altered by an intruder or virus. Hash symmetric encryption. functions are also commonly employed by many With this form of cryptography, it is obvious that operating systems to encrypt passwords. Hash the key must be known to both the sender and the functions, then, provide a measure of the integrity of receiver. The biggest difficulty with this approach, of a file. course, is the distribution of the key. Secret key cryptography schemes are generally IV. KKJEIN ALGORITHM categorized as being either stream ciphers or block ciphers. Stream ciphers operate on a single bit (byte KKJEIN algorithm combines ceaser cipher and or computer word) at a time and implement some XOR cipher. When used individually these ciphers form of feedback mechanism so that the key is are very easy to hack but when used together they constantly changing. A block cipher is so-called give better results. This paper will further discuss because the scheme encrypts one block of data at a both the methods. time using the same key on each block. In general, D. Ceaser Cipher the same plaintext block will always encrypt to the same cipher text when using the same key in a block cipher whereas the same plaintext will encrypt to different cipher text in a .

B. Public Key Cryptography (PKC)

Figure 5. Ceaser cipher

In cryptography, a Caesar cipher, the shift cipher, is one of the simplest and most widely known encryption techniques. It is a type of substitution

Figure 3. Public key cryptography cipher in which each letter in the plaintext is replaced

Proceedings of SARC-IRAJ International Conference, 22nd June 2013, New Delhi, India, ISBN: 978-81-927147-6-9

25 Cryptography in Embedded Systems by a letter some fixed number of positions down the V. SIMULATION AND RESULTS alphabet. For example (Figure 5), with a shift of 3, A would be replaced by D, B would become E, and so F. Simulation and Testing on. The method is named after Julius Caesar, who used it in his private correspondence. The encryption The purpose of the simulation at this stage was to step performed by a Caesar cipher is often verify the functionality of the design [3]. When the incorporated as part of more complex schemes. As results of the simulation confirmed the correctness of with all single alphabet substitution ciphers, the the functionality of the design, the whole design Caesar cipher is easily broken and in modern practice functionality was verified. We use multi-software for offers essentially no communication security. testing and simulation i.e. PROTEUS. E. Xor Cipher PROTEUS software is used for testing the incoming and out-coming data. It is also testing on the communication link between the used modules. Simulation for the encryption and Decryption algorithms is achieved using the circuit simulation in PROTEUS. PROTEUS is a complete electronics design system, which lets you simulate entire microprocessor designs running actual processor machine code in real-time.

Figure 6. XOR cipher G. Communication Establishment

In cryptography, the simple XOR cipher is a type This paper presents a simulation of KKJEIN of additive cipher, an encryption algorithm that algorithm on AT89C51 using serial communication. operates according to the principles: Some important points need to be considered while A 0 = A, simulating any circuit in PROTEUS. Firstly we need A A = 0, to set the baud rates of all the selected devices. (A B) C = A (B C), Secondly we need to give proper power supply to all (B A) A = B 0 = B, devices and connect pull up registers wherever where denotes the exclusive disjunction operation. required. To start with the simulation we need to first This operation is sometimes called modulus 2 initialise all our devices which includes defining the addition (Figure 6). With this logic, a string of text keys, initializing the LCD, etc. Next, the UART has can be encrypted by applying the bitwise XOR to be programmed for serial communication. Here, operator to every character using a given key. To the UART is used in mode1 having a baud rate of decrypt the output, merely reapplying the XOR 9600 and auto-reload mode. function with the key will remove the cipher. The XOR operator is extremely common as a component in more complex ciphers. By itself, using Start a constant repeating key, a simple XOR cipher can trivially be broken using . If the Initialize all Devices content of any message can be guessed or otherwise and Ports known then the key can be revealed. Its primary merit is that it is simple to implement, and that the XOR operation is computationally inexpensive. A simple Program the UART repeating XOR cipher is therefore sometimes used for hiding information in cases where no particular security is required. Define Encryption If the key is random and is at least as long as the function message, the XOR cipher is much more secure than when there is key repetition within a message . When Scan the key pressed the keystream is generated by a pseudo-random number generator, the result is a stream cipher. With Encrypt the key pressed a key that is truly random, the result is a one-time pad, which is unbreakable even in theory. In any of these ciphers, the XOR operator is vulnerable to a Transmit the Encrypted known-plaintext attack, since plaintext cipher text message = key. KKJEIN algorithm uses the merits of both ceaser and XOR ciphers. It gives very random values which Stop are difficult to decrypt by the intruder. Figure 7. Transmitter components and flowchart

Proceedings of SARC-IRAJ International Conference, 22nd June 2013, New Delhi, India, ISBN: 978-81-927147-6-9

26 Cryptography in Embedded Systems On the transmitter side (Figure 7), define the From the simulation results, it was observed that encryption function. When the key is pressed, scan this algorithm gives very random key which is not and display the key pressed on the LCD. Then very easy to hack. Also we can further improve the encrypt the key pressed and transmit it to the receiver. complexity of the algorithm by repeatedly using On the receiver end (Figure 8), define the ceaser cipher and XOR cipher or by combining other decryption function. As soon as the cipher text is techniques with these two techniques. received, decrypt it and display it on the hyper terminal. A second hyper terminal is used to display CONCLUSION the received cipher text so as to check the functionality of the algorithm. This paper shows how using simple techniques of ceaser cipher and XOR cipher, a complex algorithm Start can be developed which will be difficult to crack. To further increase the complexity of the algorithm we can combine this technique with other algorithms. Initialize all Devices This algorithm can also be improved to decrease the and Ports number of instructions which will decrease its execution time. Program the UART REFERENCES

Define Decryption [1] G. Julius Ceaser and John F. kennedy, Security function engineering: A Guide to Building Dependable Distributed Systems.

Display the received [2] Shiva Janakiraman, Rengarajan Amirtharanjan, K. encrypted text Thenmozhi and John Bosco Balaguru Rayyapan, “Firmware for Data Security: a Review”, Research Journal of Information Technology 4(3):61-72, 2010.

Decrypt the received Text [3] Hussam M.Elbehiery and Ghada Abdelmouez M., “Implementation of New Symmetric Ciphering on ATmega 32”, in 978-1-61284-185-4/111©2011 IEEE. Display the Decrypted message

Stop

Figure 8.Receiver components and flowchart

Proceedings of SARC-IRAJ International Conference, 22nd June 2013, New Delhi, India, ISBN: 978-81-927147-6-9

27