Implementation of Public-Key Cryptosystems on Android Mobiles
Total Page:16
File Type:pdf, Size:1020Kb
PEOPLE’S DEMOCRATIC REPUBLIC OF ALGERIA MINISTRY OF HIGHER EDUCATION AND SCIENTIFIC RESEARCH : …………… Order N° UNIVERSITY of M’SILA FACULTY OF MATHEMATICS AND COMPUTER SCIENCE Department of Computer Science Dissertation Submitted in fulfilment of the requirements for the degree of academic master in computing Domain: Mathematics and computer science Field: Computer science Option: Networks and distributed systems By: Tayoub Walid TOPIC Implementation of Public-Key Cryptosystems on Android Mobiles Defended publicly on: …./06/2013 by the jury consisted of: Mr. University of M'sila President. Mr. Noureddine Chikouche University of M'sila Supervisor. Dr. Linda Belabdelouahab Fernini University of M'sila Supervisor. Mr. University of M'sila Examiner. Academic year: 2012/2013 Acknowledgement To the great parents before being great professors whatever i say, i won't be able to express my deep thanks to the teaching staff in my faculty specially my supervisors Mr.Noureddine Chikouche and Dr. Linda Belabdelouahab Fernini who accepted to be my supervisors and helped and supported me with the necessary information in my dissertation. It is impossible for me to list their efforts in preparing me to be a great student in research. In addition, I would like to extend my gratitude to my colleague Lakehali Somia who helped me and showed me clearly her feeling of responsibility toward me. Really, I appreciate this. dedication Thanks to ALLAH in the first and last place. Greeting to the glorious souls of our immortal martyrs who sacrificed them selves to make our country best Our fathers and mothers are among Allah’s greatest gifts to us, let’s honor them with respect, love and appreciation and let us not forget them in our prayers. To my great mother “DJAMILA” and To my great father MOHAMED who has helped, supported, encouraged, advised and sacrificed a lot for us to be a good men, thank you about every thing. To my dear’s brothers Fatima, Hadjira, Abdelrazzak, Mustapha, Amel,Abderrahim, Yacine, who have assisted and shared me the good and the bad times in my life and aided me to pass the critical times. To the closest people L s, who shared with me this critical period of my life To my Education Friends b.Ahmed, B.Zaki, and special dedicate to my best friend Sami IBRAHIM who shared me best times in my life. Thanks to all of our families and our friends who have helped and supported us from near or far across our life... Thanks to you all SUMMARY Elements Page General introduction…………………………………………………………………………..…...1 First chapter 1. Introduction..................................................................................................................................3 2. Common goals in cryptography ..................................................................................................4 3. Definition of cryptography ..........................................................................................................4 4. Functionality of work cryptography ............................................................................................4 5. Encryption and decryption ... .......................................................................................................5 6. Conventional cryptography..........................................................................................................5 6.1 Caesar’s Cipher...............................................................................................................6 7. Key management and conventional encryption...................................................... .....................7 8. Public key cryptography......................................................................................... .....................7 9. Keys.............................................................................................................................................8 10. Digital signatures.............................................................................................;..........................9 11. Conclusion ...............................................................................................................................10 Second chapter 1. Introduction ……………………………………………….......................................................11 2. Integer factorization………………………………………........................................................11 2.1 Prime decomposition ……………………………......................................................12 2.2 Current state of the art ……………………………....................................................12 3. Algorithms of integer factorization ……………………….......................................................13 3.1 Algorithm: Trial Division ……………………………................................................13 3.2 Pseudo-code: Trial Division ……………………………............................................13 3.2.1 Algorithm: Fermat Factorization ………………..........................................13 4. Discrete logarithm problem …………………………………...................................................14 4.1 Example …………………………………………………...........................................14 4.2 Definition ……………………………………………….............................................15 4.3 Algorithms ………………………………………………...........................................16 4.4 Comparison with integer factorization …………………………………...…………16 4.5 Cryptography ………………………………………………………….….................16 5. Discrete logarithm records ………………………………………………………...…………..17 6. Elliptic Curves discrete logarithm problem ………………………………...….….…………..17 6.1 Problem definition ………………………………………………………...………...17 7. Conclusion ………………………………………………………………………….................19 Third chapter 1. Introduction………………………………………………………………...………………….20 2. The mathematics of the RSA public-key cryptosystems………………………...…………….21 2.1 Prime Generation and Integer Factorization…………………………….…................21 2.2 Modular Exponentiation and Roots……………………………………...…………...22 3. The RSA Cryptosystem…………………………………………………………....…………..23 3.1 RSA encryption…………………………………………………………....…………23 3.2 RSA decryption……………………………………………………...…….…………24 3.3 RSA signature………………………………………………………………………...24 3.4 RSA signature verifying………………………………………………....…………...24 4. The Rabin cryptosystem …………………………………………….…………............……...25 4.1 The Rabin key generation………………………………………….........……………26 4.2 The Rabin encryption………………………………………………..........………….26 4.3 The Rabin decryption……………………………………………………...…………26 5. The El Gamal Cryptosystem………………… ………………………………...……………...28 5.1 The Discrete Logarithm………………………………………...…………………….28 5.2 El Gamal Encryption……………………………………………………...………….29 5.3 El Gamal Decryption……………………………………………………..…..............29 5.4 El Gamal signature …………………………………………………………..............29 5.5 El Gamal signature verification ………………………………………….…..............30 6. Elliptic Curve Cryptosystem (ECC) …………….…………………………………….………30 6.1 Elliptic Curve Cryptography…………………………………………….…………...30 6.1.1 EC on Prime field Fp…………………………………………..……...........31 6.1.2 EC on Binary field F2m …………………………………………..………..31 6.1.3 ECC encryption/ decryption …………………………….……..…..………32 6.1.4 ECC signature…………………………………………………..…..............32 6.1.4.1 Signing …………………………………………..……...……..32 6.1.4.2 Verifying…………………………………………..……….……..33 7. The NTRU cryptosystem…………………………………………………..….….……………33 7.2 Mathematical concepts …………………………………………..…….….…………33 7.3 NTRU key pair generation………………………………………..………..………...34 7.4 NTRU Encryption…………………………………………………..…….…………..34 7.5 NTRU Decryption……………………………………………………..…..…………34 7.6 NTRU Signature……………………………………………………………...............35 8. Conclusion………………………………………………………………………………..........37 Fourth chapter 1. Introduction ……………………………………………………………………….…………..38 2. The developpement environnement …………………………………………….…..................38 2.1 Key Terms ………………………………………………………….……...………...38 2.2 Eclipse ……………………………………………………………….………………38 2.3 Android……………………………………………………………..……...…………39 2.4 Installation and Configuration ……………………………………..………………...40 2.4.1 Download Android SDK …………………………………...………...........40 2.4.2 Install ADT plugin for eclipse ………………………………..……............41 2.4.3 Configure the ADT plugin ……………………………......……….……….41 2.4.4 Adding SDK Components …………………………………….…………...41 2.4.5 Create an AVD ……………………………………………….…...……….42 2.4.6 Create a new Android Application …………………………..…….............42 2.5 The cryptographic library in JAVA ……..…………………………...……………....43 2.5.1 Introduction …………………………………….…………..……………...43 2.5.2 2 FlexiProvider …………………………………….…...…..……………...43 3. The application characteristics ……………………………………………...……...................44 3.1 The architecture of the application ………………………………....….…………….44 3.2 The specifications of the application………………………………..………………..45 3.3 Some application screenshots……………………………..………………………….45 4. Implementation and experimental results ……………………………………………………..47 4.1 The selected android mobiles………………………………………………………...48 4.2 Choice of parameters……………………………………………………….………...48 4.3 Calculation of execution time and memory occupation ………………...…………...49 4.4 Experimental results………………………………………………………..………...50 4.4.1 The time of execution………………………………………………………51 4.5 Comparisons and performance tests……………………………………..…………...53 4.5.1 Mobile GT-I9100…………………………………….…………..…………53 4.5.1.1 NTRU vs ECC ……………………………………………..…….53 4.5.1.2 RSA vs ECC ……………………………………………………..53 4.5.1.3 NTRU vs RSA ……………………………….………….……….53 4.5.2 Mobile GT-S6102 ………………………………………………………….54 4.5.2.1 NTRU vs ECC …………………………………………….……..54 4.5.2.2 RSA vs ECC ……………………………………………………..54 4.5.2.3