special topics in cryptographymohammad/courses/crypto/sp18/slides/class โ€ฆย ยท diffie hellman key...

19
Special Topics in Cryptography Mohammad Mahmoody

Upload: others

Post on 19-Aug-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Special Topics in Cryptographymohammad/courses/crypto/sp18/slides/Class โ€ฆย ยท Diffie Hellman Key Agreement โ€ขPublic parameters: large prime a (multiplicative) generator ๐‘”for

Special Topics in Cryptography

Mohammad Mahmoody

Page 2: Special Topics in Cryptographymohammad/courses/crypto/sp18/slides/Class โ€ฆย ยท Diffie Hellman Key Agreement โ€ขPublic parameters: large prime a (multiplicative) generator ๐‘”for

Last time

โ€ข Public-key encryption and key-agreement

โ€ข Diffie Hellman (key agreement protocol)

โ€ข RSA public key encryption

โ€ข Digital signatures

Today

Page 3: Special Topics in Cryptographymohammad/courses/crypto/sp18/slides/Class โ€ฆย ยท Diffie Hellman Key Agreement โ€ขPublic parameters: large prime a (multiplicative) generator ๐‘”for

Public Key Encryption

โ€ข Secure communication even without shared secret keys!

Page 4: Special Topics in Cryptographymohammad/courses/crypto/sp18/slides/Class โ€ฆย ยท Diffie Hellman Key Agreement โ€ขPublic parameters: large prime a (multiplicative) generator ๐‘”for

Recalling Public Key Encryption

โ€ข Key generation: Gen 1๐‘› โ†’ ๐‘’๐‘˜, ๐‘‘๐‘˜

โ€ข Encryption: Enc ๐‘’๐‘˜,๐‘š โ†’ ๐‘

โ€ข Decryption: Dec ๐‘‘๐‘˜, ๐‘ = ๐‘šโ€ฒ

โ€ข Completeness: decrypting correction ๐‘š = ๐‘šโ€ฒ

โ€ข Security: same as CPA security for private-key, but the adversary does not need any encryption oracle: it has the encryption key itself!

Page 5: Special Topics in Cryptographymohammad/courses/crypto/sp18/slides/Class โ€ฆย ยท Diffie Hellman Key Agreement โ€ขPublic parameters: large prime a (multiplicative) generator ๐‘”for

Recalling Key Agreement

โ€ข Interactive protocol between randomized Alice and Bob

โ€ข The sequence of messages ๐‘‡ = (๐‘ก1, ๐‘ก2, โ€ฆ ๐‘ก๐‘š) is called โ€œtranscriptโ€

โ€ข At the end, Alice and Bob output key ๐‘˜๐ด, ๐‘˜๐ต

โ€ข Completeness: getting same keys ๐‘˜๐ด = ๐‘˜๐‘ = ๐‘˜๐‘’๐‘ฆ

โ€ข Security: suppose |๐‘˜๐‘’๐‘ฆ| = ๐‘›, then(๐‘‡, ๐‘˜๐‘’๐‘ฆ) is computationally indistinguishable from ๐‘‡, ๐‘ˆ๐‘›Namely, even if ๐‘‡ is known, ๐‘˜๐‘’๐‘ฆ is indistinguishable from uniform ๐‘ˆ๐‘›

Page 6: Special Topics in Cryptographymohammad/courses/crypto/sp18/slides/Class โ€ฆย ยท Diffie Hellman Key Agreement โ€ขPublic parameters: large prime a (multiplicative) generator ๐‘”for

Diffie Hellman Key Agreement

โ€ข Public parameters: large prime ๐‘ž a (multiplicative) generator ๐‘” for ๐’๐’’

1. Alice picks ๐‘ฅ โ† {1,โ€ฆ ๐‘ž โˆ’ 1} and Bob picks ๐‘ฆ โ† 1,โ€ฆ๐‘ž โˆ’ 1 at random

2. Alice sends ๐‘Ž = ๐‘”๐‘ฅ to Bob and Bob sends ๐‘ = ๐‘”๐‘ฆ to Alice.

3. Alice takes ๐‘๐‘ฅ = ๐‘”๐‘ฅ๐‘ฆ = ๐‘˜ and Bob takes ๐‘Ž๐‘ฆ = ๐‘”๐‘ฅ๐‘ฆ = ๐‘˜ as the key.

โ€ข To implement in efficiently, we use โ€œfast exponentiationโ€ algorithm that computes ๐‘Ž๐‘ฆ mod ๐‘ž in time polynomial in lengths of ๐‘ž, ๐‘ฆ, ๐‘Ž

Page 7: Special Topics in Cryptographymohammad/courses/crypto/sp18/slides/Class โ€ฆย ยท Diffie Hellman Key Agreement โ€ขPublic parameters: large prime a (multiplicative) generator ๐‘”for

RSA Public-Key Encryption

Page 8: Special Topics in Cryptographymohammad/courses/crypto/sp18/slides/Class โ€ฆย ยท Diffie Hellman Key Agreement โ€ขPublic parameters: large prime a (multiplicative) generator ๐‘”for

Main Idea of RSA: Trapdoor Permutations

โ€ข Intuition: Permutation ๐œ‹ โˆถ 0,โ€ฆ๐‘ โˆ’ 1 โ†’ 0,โ€ฆ๐‘ โˆ’ 11. Easy to compute ๐œ‹ publically2. Easy to โ€œinvertโ€ ๐œ‹ only if have the trapdoor.

โ€ข Key generation find: ๐‘’๐‘˜ = ๐œ‹ and ๐‘‘๐‘˜ = ๐œŽ for permutations ๐œ‹, ๐œŽ such that :1. for all ๐‘ฅ โˆˆ 0,โ€ฆ๐‘ โˆ’ 1 : ๐œŽ ๐œ‹ ๐‘ฅ = ๐‘ฅ namely ๐œŽ(โ‹…) = ๐œ‹โˆ’1(โ‹…)2. Given ๐œ‹(๐‘ฅ) it is โ€œhardโ€ to invert it to find ๐‘ฅ. Formally, for all poly-time ๐ด

Pr๐‘ฅโ† 0,โ€ฆ๐‘โˆ’1

๐ด ๐œ‹ ๐‘ฅ = ๐‘ฅ โ‰ค negl(๐‘›) where ๐‘› โ‰ˆ log(๐‘) is sec parameter

โ€ข What is useful intuitively?โ€ข Why cannot we use it naively?

Page 9: Special Topics in Cryptographymohammad/courses/crypto/sp18/slides/Class โ€ฆย ยท Diffie Hellman Key Agreement โ€ขPublic parameters: large prime a (multiplicative) generator ๐‘”for

Number Theory 101- (continued)

โ€ข gcd ๐‘,๐‘€ = greatest common divisor of ๐‘€,๐‘

โ€ข ๐œ‘ ๐‘ = ๐‘– 1 โ‰ค ๐‘– โ‰ค ๐‘, gcd ๐‘, ๐‘– = 1 |

โ€ข ๐œ‘(๐‘) for prime ๐‘ ?

โ€ข ๐œ‘ ๐‘๐‘ž for primes ๐‘, ๐‘ž ?

โ€ข Eulerโ€™s theorem: if gcd ๐‘Ž, ๐‘ = 1 โ†’ ๐‘Ž๐œ‘(๐‘) = 1 (mod ๐‘)

Page 10: Special Topics in Cryptographymohammad/courses/crypto/sp18/slides/Class โ€ฆย ยท Diffie Hellman Key Agreement โ€ขPublic parameters: large prime a (multiplicative) generator ๐‘”for

RSA Trapdoor Permutation

โ€ข Eulerโ€™s theorem: if gcd ๐‘Ž, ๐‘ = 1 โ†’ ๐‘Ž๐œ‘(๐‘) = 1 (mod ๐‘)

โ€ข ๐‘Ž๐œ‘(๐‘) โ‹… ๐‘Ž๐œ‘ ๐‘ โ‹… ๐‘Ž๐œ‘ ๐‘ โ€ฆ = 1 ๐‘Ž1+๐‘˜โ‹…๐œ‘(๐‘) = ๐‘Ž (mod ๐‘)

โ€ข If ๐‘’ โ‹… ๐‘‘ = 1 + ๐‘˜ โ‹… ๐œ‘(๐‘) which is the same as ๐‘’ โ‹… ๐‘‘ = 1 mod ๐œ‘ ๐‘› then ๐‘Ž๐‘’ ๐‘‘ = ๐‘Ž (mod ๐œ‘ ๐‘ )

which means ๐œ‹ ๐‘ฅ = ๐‘ฅ๐‘’ is inverse of ๐œŽ ๐‘ฆ = ๐‘ฆ๐‘‘ for gcd ๐‘ฅ, ๐‘ = 1

โ€ข Interestingly ๐œŽ ๐œ‹ ๐‘ฅ = ๐‘ฅ even for gcd ๐‘ฅ, ๐‘ โ‰  1

Page 11: Special Topics in Cryptographymohammad/courses/crypto/sp18/slides/Class โ€ฆย ยท Diffie Hellman Key Agreement โ€ขPublic parameters: large prime a (multiplicative) generator ๐‘”for

How to use RSA Trapdoor Permutation for public-key encryption?โ€ข Intuition: Permutation ๐œ‹ โˆถ 0, โ€ฆ๐‘ โˆ’ 1 โ†’ 0,โ€ฆ๐‘ โˆ’ 1

1. Easy to compute ๐œ‹ publically

2. Easy to โ€œinvertโ€ ๐œ‹ only if have the trapdoor.

โ€ข What is useful intuitively?

โ€ข Why cannot we use it naively?

Page 12: Special Topics in Cryptographymohammad/courses/crypto/sp18/slides/Class โ€ฆย ยท Diffie Hellman Key Agreement โ€ขPublic parameters: large prime a (multiplicative) generator ๐‘”for

One โ€œcorrectโ€ way to use RSA trapdoor permutation for public key encryption

โ€ข Actual Randomized (CPA secure) Encryption of a big ๐‘: Pick ๐‘Ÿ, ๐‘  โˆˆ {0, โ€ฆ , ๐‘ โˆ’ 1} at random and output [๐œ‹ ๐‘Ÿ , ๐‘ , ๐‘Ÿ, ๐‘  โŠ• ๐‘]

Page 13: Special Topics in Cryptographymohammad/courses/crypto/sp18/slides/Class โ€ฆย ยท Diffie Hellman Key Agreement โ€ขPublic parameters: large prime a (multiplicative) generator ๐‘”for

More efficient way, using an โ€œidealโ€ hash function

โ€ข Let โ„Ž: 0,1 ๐‘› โ†’ 0,1 ๐‘› be an โ€œideaโ€ hash functionโ€ข Key gen: generate a pair ๐‘’๐‘˜ = ๐‘”(โ‹…), ๐‘‘๐‘˜ = ๐‘”โˆ’1 (โ‹…)

โ€ข Encryption of ๐‘š โˆˆ 0,1 ๐‘›: pick ๐‘Ÿ โ† 0,1 ๐‘›, output ๐‘ = ๐‘” ๐‘Ÿ , โ„Ž ๐‘Ÿ โŠ•๐‘š

โ€ข Decryption of ๐‘ = (๐‘ฆ, ๐‘ง) : output ๐‘š = ๐‘”โˆ’1 ๐‘ฆ โŠ• ๐‘ง

โ€ข Even possible to do it efficiently in a CCA secure way using ideal hashing

Page 14: Special Topics in Cryptographymohammad/courses/crypto/sp18/slides/Class โ€ฆย ยท Diffie Hellman Key Agreement โ€ขPublic parameters: large prime a (multiplicative) generator ๐‘”for

We need prime numbers for RSA and DH !

โ€ข We need large prime numbers!

โ€ข How many prime numbers are there?

โ€ข How can we fine one?

Page 15: Special Topics in Cryptographymohammad/courses/crypto/sp18/slides/Class โ€ฆย ยท Diffie Hellman Key Agreement โ€ขPublic parameters: large prime a (multiplicative) generator ๐‘”for

Public Key Authentication:Digital Signatures

โ€ข Secure authentication without shared secret keys!

Page 16: Special Topics in Cryptographymohammad/courses/crypto/sp18/slides/Class โ€ฆย ยท Diffie Hellman Key Agreement โ€ขPublic parameters: large prime a (multiplicative) generator ๐‘”for

Making MACs public key (just like how we moved to public key encryption)

Page 17: Special Topics in Cryptographymohammad/courses/crypto/sp18/slides/Class โ€ฆย ยท Diffie Hellman Key Agreement โ€ขPublic parameters: large prime a (multiplicative) generator ๐‘”for

Defining Digital Signatures

โ€ข Alice has a signing key ๐‘ ๐‘˜ and a verification key ๐‘ฃ๐‘˜

โ€ข Using ๐‘ ๐‘˜ Alice can sign ๐‘š with ๐œŽ = Sign๐‘ ๐‘˜(๐‘š)

โ€ข If Bob verifies Verif๐‘ฃ๐‘˜ ๐‘š, ๐œŽ = 1 he can be sure Alice signed ๐‘š

โ€ข Security:

Page 18: Special Topics in Cryptographymohammad/courses/crypto/sp18/slides/Class โ€ฆย ยท Diffie Hellman Key Agreement โ€ขPublic parameters: large prime a (multiplicative) generator ๐‘”for

One possible idea based on TDPs (e.g. RSA)

โ€ข Signing key: โ€œprivate keyโ€ (or the trapdoor)

โ€ข Verification key: โ€œpublic keyโ€ (or the description of the permutation)

โ€ข To sign ๐‘š publish ๐œŽ ๐‘š = ๐‘ก

โ€ข To verify (๐‘š, ๐‘ก) accept if and only if: ๐œ‹ ๐‘ก = ๐‘š

โ€ข Is it secure signature?

Page 19: Special Topics in Cryptographymohammad/courses/crypto/sp18/slides/Class โ€ฆย ยท Diffie Hellman Key Agreement โ€ขPublic parameters: large prime a (multiplicative) generator ๐‘”for

โ€œHash and signโ€ using ideal hash function