Introduction to Modern Cryptography
Total Page:16
File Type:pdf, Size:1020Kb
Introduction to Modern Cryptography Mihir Bellare1 Phillip Rogaway2 2005 1 Department of Computer Science and Engineering, University of California at San Diego, La Jolla, CA 92093, USA. [email protected], http://www-cse.ucsd.edu/users/mihir 2 Department of Computer Science, Kemper Hall of Engineering, University of California at Davis, Davis, CA 95616, USA; and Department of Computer Science, Faculty of Science, Chiang Mai University, Chiang Mai, 50200 Thailand. [email protected], http://www.cs.ucdavis.edu/ rogaway ∼ 2 Preface This is a set of class notes that we have been developing jointly for some years. We use them for cryptography courses that we teach at our respective institutions. Each time one of us teaches the class, he takes the token and updates the notes a bit. The process has resulted in an evolving document that has lots of gaps, as well as plenty of “unharmonized” parts. One day it will, with luck, be complete and cogent. The viewpoint taken throughout these notes is to emphasize the theory of cryptography as it can be applied to practice. This is an approach that the two of us have pursued in our research, and it seems to be a pedagogically desirable approach as well. We would like to thank the following students of past versions of our courses who have pointed out errors and made suggestions for changes: Andre Barroso, Keith Bell, Kostas Bimpikis, Alexan- dra Boldyreva, Dustin Boswell, Brian Buesker, Michael Burton, Chris Calabro, Sashka Davis, Alex Gantman, Bradley Huffaker, Hyun Min Kang, Vivek Manpuria, Chanathip Namprempre, Adriana Palacio, Wenjing Rao, Fritz Schneider, Juliana Wong. We welcome further corrections, comments and suggestions. Mihir Bellare San Diego, California USA Phillip Rogaway Davis, California USA ©Mihir Bellare and Phillip Rogaway, 1997–2005. Contents 1 Introduction 7 1.1 Goalsandsettings ................................ ..... 7 1.2 Othergoals ...................................... 13 1.3 Whatcryptographyisabout. ....... 15 1.4 Approaches to the study of cryptography . .......... 18 1.5 WhatbackgrounddoIneed? . ..... 24 1.6 Problems ........................................ 25 2 Classical Encryption 29 2.1 Substitutionciphers ............................. ....... 29 2.2 One-time-pad encryption and perfect security . .............. 33 2.3 Problems ........................................ 36 3 Blockciphers 37 3.1 Whatisablockcipher?............................. ...... 37 3.2 DataEncryptionStandard(DES). ........ 38 3.3 Key recovery attacks on blockciphers . ........... 42 3.4 Iterated-DESandDESX. .. .. .. .. .. .. .. .. ..... 45 3.5 AdvancedEncryptionStandard(AES) . ......... 48 3.6 Limitations of key-recovery based security . .............. 52 3.7 Problems ........................................ 53 4 Pseudorandom Functions 57 4.1 Functionfamilies ................................ ...... 57 4.2 Games........................................... 58 4.3 Randomfunctionsandpermutations . ......... 58 4.4 Pseudorandomfunctions. ....... 61 4.5 Pseudorandompermutations . ....... 63 4.6 Modelingblockciphers . ....... 66 4.7 Exampleattacks .................................. 67 4.8 Security against key recovery . ......... 69 4.9 Thebirthdayattack ............................... ..... 73 4.10 ThePRP/PRFswitchinglemma . ...... 74 4.11 Historicalnotes ................................ ....... 77 4.12Problems ....................................... 77 4 CONTENTS 5 Symmetric Encryption 83 5.1 Symmetricencryptionschemes . ........ 83 5.2 Somesymmetricencryptionschemes . ......... 85 5.3 Issuesinprivacy ................................. ..... 88 5.4 Indistinguishability under chosen-plaintext attack . ................... 90 5.5 Example chosen-plaintext attacks . ........... 94 5.6 Semanticsecurity................................ ...... 97 5.7 SecurityofCTRmodes .............................. 99 5.8 SecurityofCBCwitharandomIV . 103 5.9 Indistinguishability under chosen-ciphertext attack ...................106 5.10 Example chosen-ciphertext attacks . ............108 5.11 Historicalnotes ................................ .......112 5.12Problems ....................................... 112 6 Hash Functions 117 6.1 ThehashfunctionSHA1............................. 117 6.2 Collision-resistant hash functions . .............119 6.3 Collision-findingattacks . .........122 6.4 One-wayness of collision-resistant hash functions . .................124 6.5 TheMDtransform .................................. 127 7 Message Authentication 133 7.1 Thesetting ...................................... 133 7.2 Privacy does not imply authenticity . ..........136 7.3 Syntax for message authentication . ..........137 7.4 Definitionsofsecurity . .. .. .. .. .. .. .. .......138 7.5 Examples ........................................ 142 7.6 ThePRF-as-a-MACparadigm . 144 7.7 TheCBCMAC....................................... 146 7.8 Theuniversal-hashingapproach . ..........149 7.9 Problems ........................................ 149 8 Authenticated Encryption 153 9 Computational Number Theory 155 9.1 Thebasicgroups .................................. 155 9.2 Algorithms ...................................... 157 9.3 Cyclicgroupsandgenerators . ........162 9.4 Squaresandnon-squares. .......166 9.5 Groupsofprimeorder .............................. 170 9.6 HistoricalNotes................................. 172 9.7 ExercisesandProblems . .. .. .. .. .. .. .. .. 172 10 Number-Theoretic Primitives 173 10.1 Discrete logarithm related problems . ............173 10.2 Thechoiceofgroup ............................... 177 10.3TheRSAsystem ................................... 180 CONTENTS 5 10.4 Historicalnotes ................................ .......184 10.5 ExercisesandProblems . .......184 11 Digital signatures 187 11.1 Digitalsignatureschemes . .........187 11.2 Anotionofsecurity .............................. 188 11.3 RSAbasedsignatures . .. .. .. .. .. .. .. .. 190 12 Authenticated Key Exchange 207 13 The Asymptotic Approach 209 14 Interactive Proofs and Zero Knowledge 211 14.1Introduction................................... 211 14.2 Interactive functions and the accepting probability . ..................215 14.3 Proofsoflanguage-membership . ..........216 14.4 NP proof-systems .....................................221 14.5 ExercisesandProblems . .......222 A The Birthday Problem 223 B Information-Theoretic Security 225 6 CONTENTS Chapter 1 Introduction Historically, cryptography arose as a means to enable parties to maintain privacy of the information they send to each other, even in the presence of an adversary with access to the communication channel. While providing privacy remains a central goal, the field has expandeded to encompass many others, including not just other goals of communication security, such as guaranteeing in- tegrity and authenticity of communications, but many more sophisticated and fascinating goals. Once largely the domain of the military, cryptography is now in widespread use, and you are likely to have used it even if you don’t know it. When you shop on the Internet, for example to buy a book at www.amazon.com, cryptography is used to ensure privacy of your credit card number as it travels from you to the shop’s server. Or, in electronic banking, cryptography is used to ensure that your checks cannot be forged. Cryptography has been used almost since writing was invented. For the larger part of its history, cryptography remained an art, a game of ad hoc designs and attacks. Although the field retains some of this flavor, the last twenty-five years have brought in something new. The art of cryptography has now been supplemented with a legitimate science. In this course we shall focus on that science, which is modern cryptography. Modern cryptography is a remarkable discipline. It is a cornerstone of computer and communi- cations security, with end products that are imminently practical. Yet its study touches on branches of mathematics that may have been considered esoteric, and it brings together fields like number theory, computational-complexity theory, and probabiltity theory. This course is your invitation to this fascinating field. 1.1 Goals and settings Modern cryptography addresses a wide range of problems. But the most basic problem remains the classical one of ensuring security of communication across an insecure medium. To describe it, let’s introduce the first two members of our cast of characters: our sender, S, and our receiver, R. (Sometimes people call these characters Alice, A, and Bob, B. Alice and Bob figure in many works on cryptography. But we’re going to want the letter A for someone else, anyway.) The sender and receiver want to communicate with each other. The ideal channel. Imagine our two parties are provided with a dedicated, untappable, im- penetrable pipe or tube into which the sender can whisper a message and the receiver will hear 8 INTRODUCTION x x x x x x S R A Figure 1.1: Several cryptographic goals aim to imitate some aspect of an ideal channel connecting a sender S to a receiver R. it. Nobody else can look inside the pipe or change what’s there. This pipe provides the perfect medium, available only to the sender and receiver, as though they were alone in the world. It is an “ideal” communication channel from the security point of view. See Fig. 1.1. Unfortunately, in real life, there are no ideal channels connecting the pairs of parties that might like to communicate with each other. Usually such parties are communicating over some public network like the Internet. The most basic goal of cryptography