# rsa and idea security algorithms

Post on 11-Apr-2015

3.367 views

Embed Size (px)

DESCRIPTION

study and implementation of the RSA and IDEA encryption algorithms,a graduation Project submitted to the Computer Science department in birzeit university in partial fulfillment of the Requirements for the degree of B.Sc. in computer ScienceTRANSCRIPT

Faculty Of Information Technology Computer Science Department

A study and implementation of the RSA and IDEA Encryption AlgorithmsPrepared By: Zahra Shuaibi 1040589 Supervised By: Miss. Muna Al-Khayyat Directed By: Mr. Nael Qaraeen Lina Mustafa 1040766

BIRZEIT June 2008

Table of ContentsItemList of Figures List of tables Dedications Abstract page 4 5 6 7 8

1. Chapter 1 2. Chapter 22.1 Brief History

Introduction Information Security and Cryptography

9 10 10 10

2.2 Information Security and Cryptography Definitions 2.3 Cryptography Types 2.3.1 Symmetric (Secret key) 2.3.1.1 Block ciphers 2.3.1.2 Stream ciphers 2.3.2 Asymmetric ( Public- key )

11 11 12 13 13

2.4 Key Management 2.4.1 2.4.2 2.4.3 Introduction Numbers generation Key generation and storage 2.4.3.1 Password-based encryption (PBE) 2.5 Cryptographic goals and benefits 2.6 Attacks and security 2.7 Mathematics 17 18 19 14 14 14 15 16

3. Chapter 33.1 RSA

RSA and IDEA algorithms

21 21

3.1.1 Introduction

21

2

3.1.2 RSA Algorithm 3.1.3 RSA Mathematics 3.1.4 RSA Usage 3.1.5 RSA Security

21 22 23 24 24

3.1.6 RSA Possible Attacks 3.2 IDEA 3.2.1 Introduction 3.2.2 IDEA Algorithm 3.2.2.1 IDEA Key Schedule 3.2.2.2 IDEA encryption / Decryption 3.2.3 IDEA Security 3.2.4 IDEA Possible Attack 27 27 27 27 30 32 33 35 35 36 38 41

4. Chapter 4

Code Implementation and Attacks

4.1 RSA Algorithm Implementation 4.2 RSA Attacks: 4.3 IDEA Algorithm Implementation: 4.4 IDEA Attacks: 5.Chapter 55.1 RSA vs. IDEA 5.2. Analytical Analysis

Comparative Analysis

49 49 49 55 55 55 56 56 58 3

6.Chapter 66.1 Conclusions 6.2 Future Work Appendices A. Bibliography B. Code

Conclusions

List of FiguresFigure Figure 2.1 Figure 3.1 Figure 3.2 Figure 4.1 Figure 4.2 Figure 4.3 Figure 5.1 Figure 5.2 Figure 5.3 Figure 5.4 Figure 5.5 Figure 5.6 Figure 5.7 Symmetric cryptography IDEA cipher encryption/decryption process. The MA structure in IDEA design Differential Analysis Rounds 0.5R-attack on 2.5 rounds of IDEA using chain (1) 1R-attack on 2.5 rounds of IDEA using chain (2) RSA key generation time 128 file size vs. time for encryption/decryption file size change before and after encryption IDEA file size vs. time encryption for encryption/decryption IDEA Encryption Time vs. File Size IDEA Encrypted Files Size RSA128, RSA512 and IDEA file size before and after encryption Name Page11 31 32 42 46 47 51 51 51 52 53 54 54

4

List of TablesTable Table 3.1 Table 3.2 Table 3.3 Table 3.4 Table 4.1 Table 4.2 Table 5.1 Table 5.2 Table 5.3 Table 5.4 Name The IDEA encryption sub-keys. The key schedule algorithm of IDEA The IDEA decryption sub-keys. Selected known attacks on IDEA . RSA cracking history Input and output word status across IDEA operators. RSA speeds for different modulus lengths RSA 16bit run output Character size before and after encryption for RSA128 bit IDEA sample run Page28 29 29 33 37 44 49 50 52 53

5

DedicationsWe dedicate this project: To the teacher of teachers, to our prophet Mohammad peace be upon him To our families for always being there for us. To our teachers who helped, encouraged, endured and advised us all along the way. To our instructor Miss. Muna AlKhayyat for her continuous support and fruitful advice. To all our dearest friends. To all people whom we love.

6

, . , . .

7

ABSTRACTThe aim of our project is to study and implement two security algorithms Rivest-ShamirAdleman (RSA) and the International Data Encryption Algorithm (IDEA) to make a comparative analysis between them with some possible attacks. The idea behind those two algorithms is to transmit data in a non clear text format ( encrypted one ) to ensure security transmission , at the same time, they ensure a full understand of the message by the receiver (interested party) who can decrypt the message using secret special key along with a specific understand it. Finally, a new implementation that combines between the two algorithms could be presented according to the analysis that has been done on those two algorithms. algorithm to return it back to its original form and

8

Chapter 11.1Overview As the internet users are growing rapidly meanwhile the world is directed toward the electronic data communication to facilitate their life. However, hackers find their chance to defect data. Fortunately, cryptography appears as a key technology to handle these problems in electronic security systems. This seminar manly presents two security algorithms Rivest-Shamir-Adleman (RSA) and the International Data Encryption Algorithm (IDEA), their objective is to transmit data in a non clear text format ( encrypted one ) to ensure security transmission ( keep the data security ), in the same time they ensure a full understand of the message by the receiver who can decrypt the message using secret special key along with some algorithm. In chapter two, introduces the basic concepts for cryptography types, goals, security and attacks, with few details to provide background knowledge to understand the general concepts and mathematics that is used in our project. In chapter three, will describe the two algorithms: RSA and IDEA briefly; their structure, keys, security and possible attacks. The fourth chapter contains the description of the implementation of both algorithms, and a chosen attacks done on them. The comparative analysis of the two algorithms comes in the fifth chapter, along with the analytical results for each one of them. Finally, in chapter six a conclusion of our work result is mentioned, and what future work might be done.

9

Chapter 2Information Security and CryptographyCryptography is the science of keeping secrets secret1, in another words Cryptography is the" science of information and communication security" 2

2.1 Brief History Cryptography was initially used in limited way by the Egyptians before about 4000 years (by written messages with hieroglyph), and it continues to the twentieth century where it plays a crucial role in the world wars where army headquarters had to communicate through hostile environments so writing in a secret way was an essential need and it affects the wars outcome."Then Cryptography was used as a tool to protect national secrets and strategies." . (A.Menezes, et al. , 1997). Modern cryptography history began with electrical communication technology to which the previous model was clearly not well suited, after the spread of personal computers and the communication systems in the 1960s, the need for means to protect information in digital form and to provide security become desired on the private level. (A.Menezes, et al. , 1997).

2.2 Information Security and Cryptography Definitions: Information refers to any understood quantity, and Information Security tries to keep your information secret to all parties except the authorized ones, that what we will try to achieve using cryptography. Cryptography originally was defined as the science of secret codes (where the code is a set of defined symbols enable the party's to understand the messages being transmitted).Modern Cryptography has a wider sense, being defined as the science of information protection against unauthorized parties by preventing unauthorized alteration of use. Cryptographic algorithms are the mathematical algorithms which enforce protection and cryptography becomes more than encryption. (Vaudenay Serge, 2006).

Delfs Hans, Knebl Helmut, "Introduction to Cryptography Principles and Applications", Springer, (2007), Second edition, ISBN-13 978-3-540-49243-6 , page 1

1

2

Vaudenay Serge, "A CLASSICAL INTRODUCTION TO CRYPTOGRAPHY Applications for Communications Security", Springer, (2006), Page: preamble

10

2.3 Cryptography Types Modern cryptography can be divided into two main classes: Symmetric, Asymmetric.

2.3.1 Symmetric (Secret key) The symmetric (secret key) is the more traditional way of cryptography; it uses the same key for both encryption and decryption, as shown in figure 2.1.

Figure 2.1: symmetric cryptography That is, for obtaining a cipher text c from a message m, there should be a key k and some encryption algorithm E. c = E (k, m) And for decrypting the message to its original form, a decryption algorithm D is used along with the same key used in encryption, that is: m = D (k, c) Thus, the encrypted plaintext m can be uniquely recovered from the ciphertext c. This means that for a fixed key k, the encryption map must be bijective (one-to_one and onto function in the same time). Definition: A symmetric-key encryption scheme consists of a map E: K M C Such that for each k K, the map: Ek : M C, m E(k,m) is invertible. Where the elements: m M are the plaintexts, C is the set of ciphertexts,11

Ek is the encryption function with respect to the key k. The inverse function Dk: = Ek-1 is the decryption function. It is assumed that efficient algorithms to compute Ek and Dk exist. (Delfs, et. al., 2007) Symmetric-key encryption scheme main issue is that it requires a method by which the two parties can communicate safely through the courier (the phone system, or some other transmission medium) to prevent anyone to overhear the key in transit and later modify and forge all the messages encrypted by that key, that what is called key distribution problem. The most common techniques in secret-key cryptography are: block cipher and stream cipher 2.3.1.1 Block ciphers The Block ciphers operates on a blocks of data that have a fixed length of bits per block, it takes the plain text and cuts it into blocks, then apply the encryption/decryption on