Introduction to Information Security Lecture 4: Public Key Cryptography & Digital Signature 2009. 6. Prof. Kwangjo Kim.

Slides:



Advertisements
Similar presentations
Digital Signatures Good properties of hand-written signatures: 1. Signature is authentic. 2. Signature is unforgeable. 3. Signature is not reusable (it.
Advertisements

7. Asymmetric encryption-
Session 5 Hash functions and digital signatures. Contents Hash functions – Definition – Requirements – Construction – Security – Applications 2/44.
Lect. 11: Public Key Cryptography. 2 Contents 1.Introduction to PKC 2.Hard problems  IFP  DLP 3.Public Key Encryptions  RSA  ElGamal 4.Digital Signatures.
Public-key Cryptography Montclair State University CMPT 109 J.W. Benham Spring, 1998.
CNS2010handout 10 :: digital signatures1 computer and network security matt barrie.
The RSA Cryptosystem and Factoring Integers (II) Rong-Jaye Chen.
CMSC 414 Computer and Network Security Lecture 6 Jonathan Katz.
Cryptography1 CPSC 3730 Cryptography Chapter 9 Public Key Cryptography and RSA.
Private-Key Cryptography traditional private/secret/single key cryptography uses one key shared by both sender and receiver if this key is disclosed communications.
The School of Electrical Engineering and Computer Science (EECS) CS/ECE Network Security Dr. Attila Altay Yavuz Topic 5 Essential Public Key Crypto Methods.
Fall 2010/Lecture 311 CS 426 (Fall 2010) Public Key Encryption and Digital Signatures.
Dr.Saleem Al_Zoubi1 Cryptography and Network Security Third Edition by William Stallings Public Key Cryptography and RSA.
Public Key Algorithms 4/17/2017 M. Chatterjee.
1 CIS 5371 Cryptography 9. Data Integrity Techniques.
1 Pertemuan 08 Public Key Cryptography Matakuliah: H0242 / Keamanan Jaringan Tahun: 2006 Versi: 1.
ELECTRONIC PAYMENT SYSTEMSFALL 2001COPYRIGHT © 2001 MICHAEL I. SHAMOS Electronic Payment Systems Lecture 6 Epayment Security II.
Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 2.5 Public Key Algorithms.
Lecture 6: Public Key Cryptography
Introduction to Public Key Cryptography
Public Key Model 8. Cryptography part 2.
Public Key Encryption and the RSA Public Key Algorithm CSCI 5857: Encoding and Encryption.
1 CIS 5371 Cryptography 8. Asymmetric encryption-.
Andreas Steffen, , 4-PublicKey.pptx 1 Internet Security 1 (IntSi1) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications.
8. Data Integrity Techniques
Information Security and Management 13. Digital Signatures and Authentication Protocols Chih-Hung Wang Fall
Page 1 Secure Communication Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.
Bob can sign a message using a digital signature generation algorithm
1 Lect. 15 : Digital Signatures RSA, ElGamal, DSA, KCDSA, Schnorr.
The RSA Algorithm Rocky K. C. Chang, March
Digital Signatures Good properties of hand-written signatures: 1. Signature is authentic. 2. Signature is unforgeable. 3. Signature is not reusable (it.
Lecture 3.2: Public Key Cryptography II CS 436/636/736 Spring 2014 Nitesh Saxena.
10.1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 10 Symmetric-Key Cryptography.
1 Network Security Lecture 6 Public Key Algorithms Waleed Ejaz
Digital Signatures: Mathematics Zdeněk Říha. Data authentication Data integrity + data origin Digital signature Asymmetric cryptography public and private.
Digital Signatures A primer 1. Why public key cryptography? With secret key algorithms Number of key pairs to be generated is extremely large If there.
1 Lect. 13 : Public Key Encryption RSA ElGamal. 2 Shamir Rivest Adleman RSA Public Key Systems  RSA is the first public key cryptosystem  Proposed in.
4 th lecture.  Message to be encrypted: HELLO  Key: XMCKL H E L L O message 7 (H) 4 (E) 11 (L) 11 (L) 14 (O) message + 23 (X) 12 (M) 2 (C) 10 (K) 11.
Private-Key Cryptography  traditional private/secret/single key cryptography uses one key  shared by both sender and receiver  if this key is disclosed.
Cryptography and Network Security (CS435) Part Eight (Key Management)
CSCE 715: Network Systems Security Chin-Tser Huang University of South Carolina.
Public Key Cryptography. symmetric key crypto requires sender, receiver know shared secret key Q: how to agree on key in first place (particularly if.
1 Public-Key Cryptography and Message Authentication.
1 Number Theory and Advanced Cryptography 5. Cryptanalysis of RSA Chih-Hung Wang Sept Part I: Introduction to Number Theory Part II: Advanced Cryptography.
Cryptography and Network Security Chapter 13 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
Cryptography and Network Security Chapter 9 - Public-Key Cryptography
CS461/ECE422 Spring 2012 Nikita Borisov — UIUC1.  Text Chapters 2 and 21  Handbook of Applied Cryptography, Chapter 8 
CSCE 715: Network Systems Security Chin-Tser Huang University of South Carolina.
PUBLIC-KEY CRYPTOGRAPH IT 352 : Lecture 2- part3 Najwa AlGhamdi, MSc – 2012 /1433.
Chapter 3 (B) – Key Management; Other Public Key Cryptosystems.
Information Security CS 526
Chapter 3 – Public Key Cryptography and RSA (A). Private-Key Cryptography traditional private/secret/single-key cryptography uses one key shared by both.
Scott CH Huang COM 5336 Cryptography Lecture 6 Public Key Cryptography & RSA Scott CH Huang COM 5336 Cryptography Lecture 6.
Attacking RSA Brian Winant Reference “Twenty Years of Attacks on the RSA Cryptosystem” By Dan Boneh In Notices of the American Mathematical.
Chapter 9 Public Key Cryptography and RSA. Private-Key Cryptography traditional private/secret/single key cryptography uses one key shared by both sender.
Public Key Algorithms Lesson Introduction ●Modular arithmetic ●RSA ●Diffie-Hellman.
Computer Security Lecture 5 Ch.9 Public-Key Cryptography And RSA Prepared by Dr. Lamiaa Elshenawy.
Lecture 9 Overview. Digital Signature Properties CS 450/650 Lecture 9: Digital Signatures 2 Unforgeable: Only the signer can produce his/her signature.
COM 5336 Lecture 8 Digital Signatures
ECE454/599 Computer and Network Security Dr. Jinyuan (Stella) Sun Dept. of Electrical Engineering and Computer Science University of Tennessee Fall 2012.
CSCE 715: Network Systems Security Chin-Tser Huang University of South Carolina.
CSEN 1001 Computer and Network Security Amr El Mougy Mouaz ElAbsawi.
1 Introduction to Information Security , Spring 2016 Lecture 4: Applied cryptography: asymmetric Zvi Ostfeld Slides credit: Eran Tromer.
Key Exchange in Systems VPN usually has two phases –Handshake protocol: key exchange between parties sets symmetric keys –Traffic protocol: communication.
Lecture 5 Asymmetric Cryptography. Private-Key Cryptography Traditional private/secret/single key cryptography uses one key Shared by both sender and.
Asymmetric-Key Cryptography
Public Key Encryption and Digital Signatures
IEEE TRANSACTIONS ON INFORMATION THEORY, JULY 1985
Introduction to Cryptography
刘振 上海交通大学 计算机科学与工程系 电信群楼3-509
Presentation transcript:

Introduction to Information Security Lecture 4: Public Key Cryptography & Digital Signature Prof. Kwangjo Kim

2 Contents 1.Introduction to PKC 2.Hard problems  IFP  DLP 3.Public Key Encryptions  RSA  ElGamal 4.Digital Signatures  DSA, KCDSA  Schnorr 5.Key Exchange 6.Elliptic Curve Cryptosystems

3 1. Introduction to PKC

4 Key Distribution Problem of Symmetric Key Crypto  In symmetric key cryptosystems  Over complete graph with n nodes, n C 2 = n(n-1)/2 pairs secret keys are required.  (Example) n=100, 99 x 50 = 4,950 keys are required  Problem: Managing large number of keys and keeping them in a secure manner is difficult b a c d e Secret keys are required between (a,b), (a,c), (a,d), (a,e), (b,c), (b,d), (b,e), (c,d), (c,e), (d,e)

5 Public Key Cryptography - Concept In Encryption Anyone can lock (using the public key) Only the receiver can unlock (using the private key) In Digital Signature Only the signer can sign (using the private key) Anyone can verify (using the public key) Using a pair of keys which have special mathematical relation. Each user needs to keep securely only his private key. All public keys of users are published.

6 Symmetric key vs. Asymmetric Key Crypto SymmetricAsymmetric Key relation Enc. Key Dec. key Algorithm Example Key Distribution Number of keys E/D Speed Enc. key = Dec. key Secret Secret Public SKIPJACK AES Required (X) Many (X) Fast(O) Enc. Key  Dec. key Public, {private} Private, {public} Public RSA Not required (O) Small (O) Slow(X) O : merit X : demerit

7 Public Key Cryptography - Concept  One-way functions  Given x, easy to compute y=f(x).  Difficult to compute x=f -1 (y) for given y. x, domain parameters y = f(x) domain parameters f easy hard Ex) f(x)= 7x x x 2 +1 mod ( )

8 Public Key Cryptography - Concept  Trapdoor one-way functions  Given x, easy to compute f(x)  Given y, difficult to compute f -1 (y) in general  Easy to compute f -1 (y) for given y to only who knows certain information (which we call trapdoor information) x, domain parameters y = f(x) domain parameters f easy hard trapdoor info. private key public key But, easy if trapdoor info. is given.

9 Public Key Cryptography - Concept  Concept  invented by Diffie and Hellman in 1976, “New directions in Cryptography”, IEEE Tr. on IT.,Vol. 22, pp , Nov.,  Overcome the problem of secret key sharing in symmetric cryptosystems  Two keys used: public key & private key  Also known as two-key cryptography or asymmetric cryptography  Based on (trapdoor) one-way function x, domain parameters y = f(x) domain parameters f easy hard trapdoor info. private key public key But, easy if trapdoor info. is given.

10 Public Key Cryptography  Keys A pair of (Public Key, Private Key) for each user Public keys must be publicly & reliably available  Encryption schemes Encrypt with peer’s Public Key; Decrypt with its own Private Key RSA, ElGamal  Digital signature schemes Sign with its own Private Key; verify with peer’s Public Key RSA, DSA, KCDSA, ECDSA, EC-KCDSA …  Key exchange schemes Key transport or key agreement for secret-key crypto. RSA; DH(Diffie-Hellman), ECDH  All problems clear? New Problem : How to get the right peer’s Public Key? Public key infrastructure (PKI) required Certificate is used to authenticate public key

11 Public Key Cryptosystems  Public key cryptography is based on hard problems.  Encryption schemes  RSA: based on IFP  ElGamal: based on DLP  Signature schemes  Signature schemes with message recovery: RSA  Signature with appendix: ElGamal, DSA, KCDSA  Key exchange schemes  Key transport: a trusted entity TA generates and distributes key  Key agreement: Diffie-Hellman key agreement. Both entity take part in the key agreement process to have an agreed key

12 Public Key Encryption vs. Digital Signature E D Alice’s Public Key Plaintext M Ciphertext C Plaintext M Alice’s Private Key Alice Bob Authentic channel S V Bob’s private Key Plaintext M Message + Signature M + s Yes / No Bob’s public Key Alice Bob Authentic channel

13 Public Key Cryptosystems – History  RSA scheme (1978)  R.L.Rivest, A.Shamir, L.Adleman, “A Method for Obtaining Digital Signatures and Public Key Cryptosystems”,CACM, Vol.21, No.2, pp ,Feb,1978  McEliece scheme (1978)  Rabin scheme (1979)  Knapsack scheme (1979-): Merkle-Hellman, Chor-Rivest  ElGamal scheme (1985)  Elliptic Curve Cryptosystem (1985): Koblitz, Miller  Non-Abelian group Cryptography (2000): Braid group

14 2. Hard Problems IFP (Integer Factorization Problem) DLP (Discrete Logarithm Problem)

15 Integer Factorization Problem (IFP)  Problem: Given a composite number n, find its prime factors  Application: Used to construct RSA-type public key cryptosystems  Algorithms to solve IFP (probabilistic sub-exponential algorithms)  Quadratic sieve  General Number Field Sieve easy Primes p, q n = pq hard

16 Quadratic Sieve  Factor n (=pq) using the quadratic sieve algorithm  Basic principle: Let n be an integer and suppose there exist integers x and y with x 2 = y 2 (mod n), but x  ±y (mod n). Then gcd(x-y,n) gives a nontrivial factor of n.  Example Consider n=77 72=-5 mod 77, 45=-32 mod 77 72*45 = (-5)*(-32) mod *3 4 *5 = 2 5 *5 mod = 2 2 mod 77 gcd(9-2,77)=7, gcd(9+2,77)=11 77=11*7 Factorization

17 Quadratic Sieve  Example: factor n= (textbook p. 183) Observe = 5 5 x 19 (mod ) = 2 2 x 5 x 11 x 13 x 19 (mod ) = 3 2 x 13 3 (mod ) = 2 6 x 3 2 x 11 (mod ) Then we have (9398 x x 1964 x 17078) 2 = (2 4 x3 2 x5 3 x11x13 2 x19) = (mod ) gcd( , )= / 1093 = = 1093 x 3511  succeed !

18 Quadratic Sieve  Quadratic Sieve algorithm : find factors of integer n 1.Initialization: a sequence of quadratic residues Q(x)=(m+x) 2 -n is generated for small values of x where m=  sqrt(n) . 2.Forming the factor base: the base consists of small primes. FB={-1,2,p 1,p 2,…,p t-1 } 3.Sieving: the quadratic residues Q(x) are factored using the factor base till t full factorizations of Q(x) have been found. 4.Forming and solving the matrix: Find a linear combination of Q(x)’s which gives the quadratic congruence. The congruence gives a nontrivial factor of n with the probability ½.  Exercise 1: Find factors of n=4841 using the quadratic sieve algorithm

19 General Number Field Sieve (GNFS)  GNFS (general number field sieve) is the most efficient algorithm known for factoring integers larger than 100 digits.  Asymptotic running time: sub-exponential Complexity of algorithm If  =0, polynomial time algorithm If  >=1, exponential time algorithm If 0<  <1, sub-exponential time algorithm ln n : number of bits of n

RSA Challenge Digits Year MIPS-year Algorithm RSA-100 RSA-110 RSA-120 RSA-129 RSA-130 RSA-140 RSA-155 RSA-160 RSA-174 RSA-200 ‘91.4. ‘92.4. ‘93.6. ‘94.4.(AC94) ‘96.4.(AC96) ‘99.2 (AC99) ’99.8 ’03.1 ’03.12 ‘ ,000 ? 8,000 Q.S. NFS GNFS Lattice Sieving + HW MIPS : 1 Million Instruction Per Second for 1 yr = 3.1 x instruction expectation : 768-bit by 2010, 1024-bit by 2018

RSA Challenge Solution RSA-160 Date: Tue, 1 Apr :05: From: Jens Franke Subject: RSA-160 We have factored RSA160 by gnfs. The prime factors are: p= \ q= \ RSA-200 Date: Mon, 9 May :05: (CEST) From: Thorsten Kleinjung Subject: rsa200 We have factored RSA200 by GNFS. The factors are p= \ and q= \

22  Problem: Given g, y, and prime p, find an integer x, if any, such that y = g x mod p (x=log g y)  Application: Used to construct Diffie-Hellman & ElGamal-type public key systems: DH, DSA, KCDSA …  Algorithms to solve DLP:  Shank’s Baby Step Giant Step  Index calculus Discrete Logarithm Problem (DLP) easy y = g x mod p hard x = log g y Given g, x, p Given g, y, p

23  Problem: find an integer x, if any, such that y = g x mod p (x=log g y)  Algorithm Shank’s Baby Step, Giant Step algorithm 1. Choose an integer 2. Computes 3. Computes 4. Look for a match between the two lists. If a match is found, Then We solve the DLP. Baby Step Giant Step

24 Shank’s Baby Step, Giant Step algorithm Match found! Baby Step Giant Step

25  Problem: find an integer x, if any, such that y = g x mod p (x=log g y)  Algorithm Index Calculus 1. Choose a factor base S={p 1,p 2,…p m } which are primes less than a bound B. 2. Collect linear relations 1.Select a random integer k and compute g k mod p 2.Try to write g k as a product of primes in S 3. Find the logarithms of elements in S solving the linear relations 4. Find x For a random r, compute yg r mod p and try to write it as a product of primes in S.

26  Example: Let p=131, g=2, y=37. Find x=log 2 37 mod 131  Solution Let B=10, S={2,3,5,7} Index Calculus 2 1 = 2 mod = 5 3 mod = 5 * 7 mod = 3 2 mod = 3 * 5 2 mod = log 2 2 mod = 3*log 2 5 mod = log log 2 7 mod = 2*log 2 3 mod = log *log 2 5 mod 130 log 2 2 = 1 log 2 5 = 46 log 2 7 = 96 log 2 3 = * 2 43 = 3 * 5 * 7 mod 131 Log 2 37 = log log log 2 7 mod 130 = mod 131 = 37 Solution :  Exercise 2: Let p=809. Find log mod 809.

27  Complexity of best known algorithm for solving DLP:  Complexities of solving IFP and DLP are similar Discrete Logarithm Problem (DLP)

28 3. Public Key Encryption RSA ElGamal

29 Shamir Rivest Adleman RSA Public Key Systems  RSA is the first public key cryptosystem  Proposed in 1977 by Ron Rivest, Adi Shamir and Leonard Adleman at MIT  It is believed to be secure and still widely used

30 RSA Public Key Systems  Key generation  Choose two large (512 bits or more) primes p & q  Compute modulus n = pq, and  (n) = (p-1)(q-1)  Pick an integer e relatively prime to  (n), gcd(e,  (n))=1  Compute d such that ed = 1 mod  (n)  Public key (n, e) : publish  Private key d : keep secret (may discard p & q)  Special Property  (m e mod n) d mod n = (m d mod n) e mod n for 0 < m < n  Encryption / Decryption  E: c = m e mod n for 0 < m < n  D: m = c d mod n  Proof) C d = (M e ) d = M ed = M k  (n) +1 = M {M  (n) } k = M

31 RSA as a Trapdoor One-way Function Message m Ciphertext c c = f(m) = m e mod n m = f -1 (c) = c d mod n Public key Private key (trapdoor information) n = pq (p & q: primes) ed = 1 mod (p-1)(q-1)

32 RSA Public Key Systems  Example: Key Generation –p=3, q=11 –n = pq = 33,  (n) =(p-1)(q-1) = 2 x10 = 20 –e = 3 s.t. gcd(e,  (n) )=(3,20)=1 –Choose d s.t. ed =1 mod  (n), 3d = 1 mod 20, d=7 –Public key ={e,n}={3,33}, private key ={d}={7} Encryption –M =5 –C = M e mod n = 5 3 mod 33 =26 Decryption –M =C d mod n = 26 7 mod 33= 5

33 RSA Public Key Systems  Exercise 3: Provide an example of RSA key generation, encryption, and decryption for 1) p=17, q=23 (by hand calculation) 2) p=2357, q=2551 (using big number calculator) 3) p= , q= (using big number calculator) 1. Key generation 2. Encryption 3. Decryption

34 Selecting Primes p and q for RSA  How to select primes p and q ? 1.|p|  |q| to avoid ECM (Elliptic Curve Method for factoring) 2.p-q must be large to avoid trial division 3.p and q are strong prime  p-1 has large prime factor r (pollard’s p-1)  p+1 has large prime factor (William’s p+1)  r-1 has large prime factor (cyclic attack)

35 Security of RSA  Common Modulus attack:  If multiple entities share the same modulus n=pq with different pairs of (e i, d i ), it is not secure. Do not share the same modulus!  Cryptanalysis: If the same message M was encrypted to different users User u 1 : C 1 = M e 1 mod n User u 2 : C 2 = M e 2 mod n If gcd(e 1,e 2 )=1, there are a and b s.t. ae 1 + be 2 = 1 mod n Then, (C 1 ) a (C 2 ) b mod n = (M e 1 ) a (M e 2 ) b mod n = M ae 1 +be 2 mod n = M mod n

36 Security of RSA  Cycling attack If f(f( …f(M)))=f(M) where f(M) = M e mod n ? If a given ciphertext appears after some iterations, we can recover the plaintext at collusion point. Let C=M e mod n If (((C e ) e )…) e mod n = C e^k mod n = C, then C e^(k-1) mod n = M  Multiplicative attack (homomorphic property of RSA) (M 1 e ) (M 2 e ) mod n = (M 1 x M 2 ) e mod n

37 Attack on RSA Implementations  Timing attack: (Kocher 97) The time it takes to compute C d (mod N) can expose d.  Power attack: (Kocher 99) The power consumption of a smartcard while it is computing C d (mod N) can expose d.  Faults attack: (BDL 97) A computer error during C d (mod N) can expose d.

38 Security of Public Key Encryption Schemes  Security goals  One-wayness (OW): the adversary who sees a ciphertext is not able to compute the corresponding message  Indistinguishability (IND): observing a ciphertext, the adversary learns nothing about the plaintext. Also known as semantic security.  Non-malleability (NM): observing a ciphertext for a message m, the adversary cannot derive another ciphertext for a meaningful plaintext m’ related to m  Original RSA encryption is not secure  In IND: deterministic encryption  In NM: for example, from c=m e, c’ = 2 e c = (2m) e is easily obtained. It cannot be used in bidding scenario.

39 Security of Public Key Encryption Schemes  Indistinguishability m 0, m 1 b  R {0,1} PKE(pk, sk) Challenge: C=E(m b ) Guess b? The adversary win if he guess b correctly with a probability significantly greater than 1/2

40 Security of Public Key Encryption Schemes  Assume the existence of Decryption Oracle  Mimics an attacker’s access to the decryption device  Attack models  Chosen Plaintext Attack (CPA): the adversary can encrypt any plaintext of his choice. In public key encryption this is always possible.  Non-adaptive Chosen Ciphertext Attack (CCA1): the attacker has access to the decryption oracle before he sees a ciphertext that he wishes to manipulate  Adaptive Chosen Ciphertext Attack (CCA2): the attacker has access to the decryption oracle before and after he sees a ciphertext c that he wishes to manipulate (but, he is not allowed to query the oracle about the target ciphertext c.)

RSA Padding  RSA encryption without padding  Deterministic encryption (same plaintext  same ciphertext)  Multiplicative property: m 1 e. m 2 e = (m 1 m 2 ) e mod n  Lots of attacks possible  Redundancy checking is essential for security  RSA encryption with OAEP  RSA encryption after OAEP (Optimal Asymmetric Encryption Padding)  Proposed by Bellare and Rogaway  Probabilistic encoding of message before encryption  RSA becomes a probabilistic encryption  Secure against IND-CCA2

42 RSA with OAEP  OAEP  RSA encryption s=m  G(r) t=r  H(s) r=t  H(s) m=s  G(r) Encryption padding Decryption padding c=E(s,t) RSA encryption  RSA decryption  OAEP (s,t)=D(c) RSA decryption + m r s t + H G n-bit message l-bit random value G H Hash function (Random oracle) r : l-bit random value OAEP looks like a kind of Feistel network.

43 RSA Encryption with RSA-OAEP Padding EM = Padding string:all 0x00 mLen   k - 2 hLen - 2   Parameter : Hash, MGF  Input : M, L, (n, e) Random string, seedLen = hLen MGF(Seed, Len) = Hash(Seed || 0) || Hash(Seed || 1) ||... Hash(Seed || t) DB =  Hash L M M 01 lHashPS MaskedDB MGF Seed masked Seed MGF  00 C = (EM) e mod n (Optional) Label In PKCS #1 v2.0, v2.1

44 Diffie-Hellman / ElGamal-type Systems  Domain parameter generation  Based on the hardness of DLP  Generate a large (1024 bits or more) prime p  Find a generator g that generates the cyclic group Z p *  Domain parameter = {p, g}  Key generation  Pick a random integer x  [1, p-1]  Compute y = g x mod p  Public key (p, g, y) : publish  Private key x : keep secret  Applications  Public key encryption  Digital signatures  Key agreement

45 ElGamal Encryption Scheme  Keys & parameters  Domain parameter = {p, g}  Choose x  [1, p-1] and compute y = g x mod p  Public key (p, g, y)  Private key x  Encryption: m  (C 1, C 2 )  Pick a random integer k  [1, p-1]  Compute C 1 = g k mod p  Compute C 2 = m  y k mod p  Decryption  m = C 2  C 1 -x mod p  C 2  C 1 -x = (m  y k )  (g k ) -x = m  (g x ) k  (g k ) -x = m mod p

46 ElGamal Encryption Scheme -- Example  Key Generation  Let p=23, g=7  Private key x=9  Public key y = g x mod p = 7 9 mod 23 = 15  Encryption: m  (C 1, C 2 )  Let m=20  Pick a random number k=3  Compute C 1 = g k mod p = 7 3 mod 23 = 21  Compute C 2 = m  y k mod p = 20  15 3 mod 23 = 20  17 mod 23 = 18  Send (C 1,C 2 ) = (21,18) as a ciphertext  Decryption  m = C 2 / C 1 x mod p = 18 / 21 9 mod 23 = 18 / 17 mod 23 = 20

47 4. Digital Signatures RSA, ElGamal, DSA, KCDSA, Schnorr

48 Digital Signature  Digital Signature  Electronic version of handwritten signature on electronic document  Signing using private key (only by the signer)  Verification using public key (by everyone)  Hash then sign: sig(h(m))  Efficiency in computation and communication

49 Digital Signature  Security requirements for digital signature  Unforgeability ( 위조 방지 )  User authentication ( 사용자 인증 )  Non-repudiation ( 부인 방지 )  Unalterability ( 변조 방지 )  Non-reusability ( 재사용 방지 )  Services provided by digital signature  Authentication  Data integrity  Non-Repudiation

50  Digital Signature Combine Hash with Digital Signature and use PKC Provide Authentication and Non-Repudiation RSA; DSA, KCDSA, ECDSA, EC-KCDSA Digital Signature Signature Sender’s Private Key Hash Algorithm Hash Hash Algorithm Hash1 Hash2 Sender’s Public Key SEND Signature SigningVerifying

51 RSA Signature  Key generation  Choose two large (512 bits or more) primes p & q  Compute modulus n = pq, and  (n) = (p-1)(q-1)  Pick an integer e relatively prime to  (n), gcd(e,  (n))=1  Compute d such that ed = 1 mod  (n)  Public key (n, e) : publish  Private key d : keep secret (may discard p & q)  Signing / Verifying  S: s = m d mod n for 0 < m < n  V: m =? s e mod n  S: s = h(m) d mod n --- hashed version  V: h(m) =? s e mod n  RSA signature without padding  Deterministic signature, no randomness introduced

52 RSA Signature  RSA signature forgery: Attack based on the multiplicative property of RSA. y 1 = (m 1 ) d y 2 = (m 2 ) d, then (y 1 y 2 ) e = m 1 m 2 Thus y 1 y 2 is a valid signature of m 1 m 2 This is an existential forgery using a known message attack.

53 RSA Signing with RSA-PSS Padding M’ = EM =  Parameter : Hash, MGF, sLen  Input : M, (n, d) salt mHashPad MaskedDB MGF  Hash H salt DB = bc Pad = 0x (8 octets of all zeros) Hash M 01 PS Padding string: all 0x00 S = (EM) d mod n Random octet string of sLen octets emLen =  (|n|-1)/8 

54 ElGamal Signature Scheme  Keys & parameters  Domain parameter = {p, g}  Choose x  [1, p-1] and compute y = g x mod p  Public key (p, g, y)  Private key x  Signature generation: (r, s)  Pick a random integer k  [1, p-1]  Compute r = g k mod p  Compute s such that m = xr + ks mod p-1  Signature verification  y r r s mod p =? g m mod p -If equal, accept the signature (valid) -If not equal, reject the signature (invalid)  No hash function…

55 Digital Signature Algorithm (DSA) Private : x Public : p, q, g, y p : 512 ~ 1024-bit prime q : 160-bit prime, q | p-1 g : generator of order q x : 0 < x < q y = g x mod p  Signing r = (g k mod p) mod q s = k -1 (SHA1(m) + xr) mod q  Verifying m, (r,s) Pick a random k s.t. 0 < k < q w = s -1 mod q u1 = SHA1(m)  w mod q u2 = r  w mod q v = (g u1  y u2 mod p) mod q v =? r m, (r,s)

56 Korean Certificate-based Digital Signature Algorithm (KCDSA) Private : x Public : p, q, g, y z=h(Cert_Data) p : k (k=0 ~ 5) bit prime q : k (k=0~3) bit prime, q | p-1 g : generator of order q x : 0 < x < q y = g x mod p, x = x -1 mod q  Signing r = HAS160(g k mod p) e = r  HAS160(z || m) s = x(k - e) mod q  Verifying m, (r,s) Pick a random k s.t. 0 < k < q e = r  HAS160(z || m) v = y s  g e mod p HAS160(v) =? r m, (r,s)

57 Schnorr Signature Scheme  Domain parameters  p = a large prime (~ size 1024 bit), q = a prime (~size 160 bit)  q = a large prime divisor of p-1 (q | p-1)  g = an element of Z p of order q, i.e., g  1 & g q = 1 mod p  Considered in a subgroup of order q in modulo p  Keys  Private key x  R [1, q-1] : a random integer  Public key y = g x mod p  Signature generation: (r, s)  Pick a random integer k  R [1, q-1]  Compute r = h(g k mod p, m)  Compute s = k – xr mod q  Signature verification  r =? h(y r g s mod p, m)

58 Security of Digital Signature Schemes  Security goals  Total break: adversary is able to find the secret for signing, so he can forge then any signature on any message.  Selective forgery: adversary is able to create valid signatures on a message chosen by someone else, with a significant probability.  Existential forgery: adversary can create a pair (message, signature), s.t. the signature of the message is valid.

59 Security of Digital Signature Schemes  Attack models  Key-only attack: Adversary knows only the verification function (which is supposed to be public).  Known message attack: Adversary knows a list of messages previously signed by Alice.  Chosen message attack: Adversary can choose what messages wants Alice to sign, and he knows both the messages and the corresponding signatures.

60 5. Key Exchange Diffie-Hellman

61 Diffie-Hellman Key Agreement Scheme choose X a  [1, p-1] Y a = g X a mod p YaYa choose X b  [1, p-1] Y b = g X b mod p YbYb compute the shared key K a = Y b X a = g X b X a mod p compute the shared key K b = Y a X b = g X a X b mod p Domain Parameters p, g

62 Diffie-Hellman Problem  Computational Diffie-Hellman (CDH) Problem Given Y a = g X a mod p and Y b = g X b mod p, compute K ab = g X a X b mod p  Decision Diffie-Hellman (DDH) Problem Given Y a = g X a mod p and Y b = g X b mod p, distinguish between K ab = g X a X b mod p and a random string  Discrete Logarithm Problem (DLP) Given Y = g X mod p, compute X = log b Y. The Security of the Diffie-Hellman key agreement depends on the difficulty of CDH problem.

63 Man in the Middle Attack in Diffie-Hellman Key Agreement X b : private Y b = g X b : public YbYb YcYc X a : private Y a = g X a : public Y c = g X c for some X c YcYc YaYa Bob computes the session key K b = Y c X b = g X c X b Alice computes the session key K a = Y c X a = g X c X a Adversary computes the both session keys K b = Y b X c = g X c X b K a = Y a X c = g X c X a Problem comes from no authentication

64 Diffie-Hellman Key Agreement using Certified Key choose X a  [1, p-1] Y a = g X a mod p choose X b  [1, p-1] Y b = g X b mod p compute the shared key K a = Y b X a = g X b X a mod p compute the shared key K b = Y a X b = g X a X b mod p Domain Parameters p, g Certified key Y a and Y b Interaction is not required Agreed key is fixed, long-term use

65 MTI Protocols -- choose X a  [1, p-1] Y a = g X a mod p choose X b  [1, p-1] Y b = g X b mod p compute the shared key K a = Y b k a T b X a = g X b k a g k b X a compute the shared key K b = Y a k b T a X b = g X a k b g k a X b Domain Parameters p, g Certified key Y a and Y b by Matsumoto, Takashima, Imai TaTa TbTb Choose k a  [1, p-1] T a = g k a mod p choose k b  [1, p-1] T b = g k b mod p

66 6. Elliptic Curve Cryptosystem

67 Elliptic Curve (1)  Weierstrass form of Elliptic Curve y 2 + a 1 xy + a 3 = x 3 + a 2 x 2 + a 4 x + a 6  Example (over rational field) y 2 = x 3 – 4x + 1 E(Q) = {(x,y)  Q 2 | y 2 = x 3 – 2x + 2} U O E P = (2, 1), –P = (2, –1) [2]P = (12, -41) [3]P = (91/25, 736/125) [4]P = (5452/1681, /68921) P Q P + Q -Q P - Q

68 Elliptic Curve (2)  Example (over finite field GF(p) : p = 13) P = (2,1), –P = (2, 12), [2]P = (12, 11) [3]P = (0, 1), [4]P = (11, 12), ……, [18]P = O E Hasse’s Theorem : p – 2  p  # of E(p)  p + 2  p Scalar multiplication: [d]P  Elliptic Curve Discrete Logarithm Base of Elliptic Curve Cryptosystem (ECC) y = g x mod pQ = [d]P Find x for given Y Find d for given Q

69 Elliptic Curve Cryptosystems  Advantages Breaking PKC over Elliptic Curve is much harder We can use much shorter key Encryption/Decryption is much faster than that of other PKCs It is suitable for restricted environments like mobile phone, smart card  Disadvantages It’s new technique  There may be new attacks Too complex to understand ECC is a minefield of patents : e.g. US patents / – Normal Basis, – Curve over GF(p) / / – p=2^q-c for small c, etc…

70 Key Sizes and Algorithms  System strength, Symmetric Key strength, Public Key strength must be consistently matched for any network protocol usage.  Selection Rules Determine symmetric key sizes : n Symmetric Cipher  Key exchange Algorithm  Authentication Algorithm Sym.RSA/DHECC Sym.RSA/DHECC From Peter Gutmann’s tutorial From RSA’s Bulletin ( No 13)  Recommendation for RSA/ECC 512/112-bit : only for micropayment/smart card 1024/160-bit : for short term (1-year) security 2048/256-bit : for long term security (CA,RA)

71 Implementation Results  RSA Encryption/Decryption EncryptionDecryption PKCS#1-v ms18.05 ms PKCS#1-OAEP1.41 ms18.09 ms  Signature SigningVerifying PKCS#1-v ms1.24 ms PKCS#1-PSS18.24 ms1.28 ms DSA with SHA12.75 ms9.85 ms KCDSA with HAS ms9.55 ms  Modular Exponentiation vs. Scalar Multiplication of EC M.E. (1024-bit)S.M. (GF(2 162 ))S.M. (GF(p)) ms2.24 ms1.17 ms

72 Implementation Environments  RSA Encryption/Signature N : 1024 bits, public exponent : = Decryption/Signing uses Chinese Remainder Theorem (CRT) : CRT is roughly 3 times faster  DSA/KCDSA p : 1024-bit prime, q : 160-bit subprime Signing uses LL-method Verifying uses double-exponentiation  Modular Exponentiation vs. Scalar Multiplication of EC M.E./S.M. uses Window-method In the same security level, ECC is much faster that RSA/DSA PIII 450MHz Widows 98 MSVC with assembly