Presentation is loading. Please wait.

Presentation is loading. Please wait.

7. Asymmetric encryption-

Similar presentations


Presentation on theme: "7. Asymmetric encryption-"β€” Presentation transcript:

1 7. Asymmetric encryption-
CIS Cryptography 7. Asymmetric encryption-

2 Public Key Cryptography
Alice Bob Alice and Bob want to exchange a private key in public.

3 Public Key Cryptography The Diffie-Hellman protocol
Let p is a large prime and π‘”οƒŽ 𝑍 𝑝 βˆ— . The order β„Ž of 𝑔 is a factor of π‘βˆ’1. 𝑍 𝑝 βˆ— has a generator for any factor h of π‘βˆ’1. p is called a safe prime if h = 2q, with q a prime.

4 Public Key Cryptography The Diffie-Hellman protocol
Alice ga mod p Bob gb mod p The private key is: gab mod p where p is a prime and g is a generator of Zp*

5 Example p = 43, g = 3, Alice and Bob share (p,g) = (43,3).
Alice picks her (secret) exponent: a random a = 8 οƒŽU [0:42]. Alice sends Bob: 38 ο‚Ί 25 (mod 43). Bob picks his (secret) exponent: a random b = 37οƒŽU [0:42]. Bob sends Alice: 337 ο‚Ί 20 (mod 43). The secret key agreed between the two is: 9 ο‚Ί 208 ο‚Ί 2537 (mod 43).

6 Man-in-the-middle attack
Alice picks a οƒŽU Zp* and sends Malice (β€œBob”): ga (mod p) Malice (β€œAlice”) picks m οƒŽ Zp* and sends Bob: gm (mod p) Bob picks b οƒŽU Zp* and sends Malice (β€œBob) Bob: gb (mod p) Malice (β€œBob”) sends Alice: gm (mod p) Alice computes: k1  (gm)a (mod p) Bob computes: k2  (gm)b (mod p)

7 The Computational Diffie-Hellman Problem, CDH
INPUT The description of a finite cyclic group 𝐺 of prime order q A generator element 𝑔 of 𝐺 𝑔 π‘Ž , 𝑔 𝑏 οƒŽ 𝐺, for some integers 0<π‘Ž,𝑏<π‘ž. OUTPUT 𝑔 π‘Žπ‘

8 The Computational Diffie-Hellman Assumption
A CDH solver is a PPT algorithm that solves the CDH problem. The CDH Assumption is that, for any CDH solver there exists a negligible function negl such that: for an arbitrary instance of the CDH problem, the CDH solver will succeed with probability ο‚£ negl for all sufficiently large inputs.

9 The Decisional Diffie-Hellman Problem, DDH
INPUT The description of a finite cyclic group G of prime order q A generator element g of G ga, gb, gc οƒŽ G, for some integers 0 < a,b,c< q. OUTPUT Decision that gc = gab or Decision that gc ο‚Ή gab

10 The Decisional Diffie-Hellman Assumption
A DDH solver is a PPT algorithm that solves the DDH problem. The DDH Assumption is that, for any DDH solver, there exists a negligible function negl such that: for an arbitrary instance of the DDH problem, the DDH solver will succeed with probability ο‚£ negl for all sufficiently large inputs.

11 The Discrete Logarithm Problem
The Discrete Logarithm Problem -- DL INPUT The description of a finite cyclic group 𝐺 of order π‘ž (say 𝑍 𝑝 βˆ— ) A generator element 𝑔 of 𝐺 h οƒŽ G. OUTPUT The unique integer π‘Ž<𝑝 such that β„Ž= 𝑔 π‘Ž π‘šπ‘œπ‘‘ 𝑝. We call the integer π‘Ž the discrete logarithm of β„Ž in base 𝑔 and write: π‘Ž= π‘™π‘œπ‘” 𝑔 β„Ž π‘šπ‘œπ‘‘ 𝑝.

12 The Discrete Logarithm Assumption
A DL solver is a PPT algorithm that solves the DL problem. The DL Assumption is that, for any DL solver, there exists a negligible function negl such that: for an arbitrary instance of the DL problem, the DDH solver will succeed with probability ο‚£ negl for all sufficiently large inputs.

13 The RSA cryptosystem Alice performs the following steps
Choose p, q large primes with |p| ο‚» |q|. Compute N = pq. Compute οͺ (N) = (p-1)(q-1). Choose a random integer e < οͺ (N) such that gcd(e,οͺ (N)) = 1 and compute the integer d such that ed = 1 (mod οͺ (N)). Make (N,e) the public key, keep (N,d) as private key, and discard p,q and οͺ (N).

14 The RSA cryptosystem Encryption Decryption
Let m < N be the confidential message that Bob wants to send to Alice. Bob creates the ciphertext: c  π‘š 𝑒 (π‘šπ‘œπ‘‘ 𝑁). Bob sends Alice: c Decryption To decrypt the ciphertext c Alice computes: π‘šβ† 𝑐 𝑑 (π‘šπ‘œπ‘‘ 𝑁).

15 Check We have: Therefore, ο‚Ί (mοͺ(n))t ο‚΄ m ο‚Ί 1ο‚΄m ο‚Ί m mod n
ed ο‚Ί 1 (mod οͺ (N)) , so ed ο‚Ί 1 + tοͺ (N). Therefore, Dd (Ee (m)) ο‚Ί (me)d ο‚Ί m ed ο‚Ί m tοͺ(N)+1 ο‚Ί (mοͺ(n))t ο‚΄ m ο‚Ί 1ο‚΄m ο‚Ί m mod n

16 Example Let p = 101, q = 113. Then N = 11413.
οͺ (N) = 100 x 112 = = 26527 For encryption use e = 3533. Alice publishes: N = 11413, e = 3533. Suppose Bob wants to encrypt: 9726. Bob computes mod = 5761 Bob sends Alice the ciphertext 5761. To decrypt it Alice computes the plaintext: (mod 11413) = 9726

17 Implementation Generate two large primes: p,q
N οƒŸ pq and πœ‘ 𝑁 = (p-1)(q-1) Choose random e: with 1 < e < οͺ (N) & gcd(e,οͺ (N))=1 𝑑← 𝑒 βˆ’1 π‘šπ‘œπ‘‘ πœ‘(𝑁) The public key is (N,e) and the private key is (N,d)

18 Cost In 𝑍 𝑛 : Cost of a modular multiplication (xο‚΄y) mod n is
O (k2), where k = log2n Cost of a modular exponentiation xz (mod n) is O (k2 log2z) = O (k2 log2 n)

19 Cryptanalysis of Public-key cryptosystems
Active attacks on cryptosystems Chosen-Plaintext Attack (CPA): The attacker chooses plaintexts and obtains the corresponding ciphertexts: the task of the attacker is successful if he can decrypt a (new) target ciphertext. Chosen-Ciphertext Attack (CCA1): The attacker chooses a number of ciphertexts and obtains the corresponding plaintexts: the task of the attacker is successful if he can decrypt a (new) target ciphertext. Adaptive Chosen-Ciphertext Attack (CCA2): This is a CCS1 attack in which the attacker can adaptively choose ciphertexts: the task of the attacker is successful if he can decrypt a (new) target ciphertext.

20 The RSA Problem INPUT N = pq with p,q prime nmbers.
e an integer such that gcd(e,(p-1)(q-1)) =1 c οƒŽ ZN . OUTPUT The unique integer m οƒŽ ZN such that me ο‚Ί c (mod N )

21 The RSA Assumption An RSA solver is a PPT algorithm that solves the RSA problem. The RSA Assumption is that, for any RSA solver, there exists a negligible function negl such that: for an arbitrary instance of the RSA problem, the RSA solver will succeed with probability ο‚£ negl for all sufficiently large inputs.

22 The Integer Factorization Problem
The IF Problem (IF) INPUT N an odd composite integer with at least two distinct prime factors. OUTPUT A prime p such that p | N.

23 The IF Assumption An integer factorizer is a PPT algorithm that solves the IF problem. The IF Assumption is that, for any IF solver, there exists a negligible function negl such that: for an arbitrary instance of the IF problem, the IF solver will succeed with probability ο‚£ negl for all sufficiently large inputs.

24 Security of RSA Relation to factoring.
If Factoring is easy then the RSA problem is easy: recovering the plaintext m from an RSA ciphertext c is easy if factoring is possible The converse is likely not to be true. Relation between factoring and the RSA problem If Factoring is easy then the RSA problem is easy.

25 The Rabin cryptosystem
Alice performs the following steps Choose p, q large primes with |p| = |q|. Compute n = pq. Pick a random integer b οƒŽU Zn* Make (n,b) public key, keep (p,q) as private key.

26 The Rabin cryptosystem
Encryption Let m οƒŽ Zn* be the confidential message that Bob wants to send to Alice. Bob creates the ciphertext: c  m(m+b) (mod n). Bob sends Alice: c Decryption To decrypt the ciphertext c Alice solves the quadratic equation: m2 + bm –c ο‚Ί 0 (mod n), for m < n.

27 The Rabin cryptosystem
Decryption From elementary mathematics: π‘š= βˆ’π‘ο‚± Ξ” 2 where  = b2 +4c (mod n). Since m was chosen in Zn*,  must be in QRn . Notice that if p,q are such that p ο‚Ί q ο‚Ί 3 (mod 4), then it is easier to compute square roots modulo N, as we shall see below.

28 Remarks Suppose p ο‚Ί q ο‚Ί 3 (mod 4), n = pq. Let y ο‚Ί π‘₯ 2 (mod p). Then:
because, 𝑦 (π‘βˆ’1)/2 ≑ π‘₯ 2 (π‘βˆ’1)/2 ≑ π‘₯ π‘βˆ’1 ≑1 (π‘šπ‘œπ‘‘ 𝑝)

29 Remarks (continued) It follows that: is a square root of y modulo p.
A similar argument applies for the other prime q. So we get the quadratic residues modulo p and modulo q. We then get the quadratic residue modulo n by using the Chinese Remainder Theorem.

30 Example Suppose n = 77. Then e (x) = x 2 (mod 77) d (y) = (mod 77)
Suppose Bob wants to decrypt y = 23

31 Example, continued Using the Chinese Remainder Theorem we compute
the 4 square roots of 23 modulo 77 to be:

32 The Rabin Problem INPUT N = pq with p,q prime numbers.
y ο‚Ί x 2 (mod N), x οƒŽ ZN* OUTPUT z οƒŽ ZN* such that z ο‚Ί x 2 (mod N).

33 Security of Rabin Relation to factoring.
Recovering the plaintext m from a Rabin ciphertext c is easy if the IF problem is easy. Relation between factoring and the Rabin problem Under CPA attacks the Rabin system is secure iff the IF problem is hard. Under CCA attacks the Rabin problem is completely insecure.

34 Security of Rabin Under CCA attacks the Rabin system is completely insecure. Proof: We show this for the case when 𝑏=0. The adversary picks an π‘š and computes 𝑐≑ π‘š 2 π‘šπ‘œπ‘‘ 𝑁 . Then he gets its decryption π‘šβ€². This is one of the 4 square roots of 𝑐, and with probability Β½, gcd π‘š β€² ο‚±π‘š,𝑁 =𝑝 or q. Then the adversary can decrypt any ciphertext.

35 The ELGamal cryptosystem
Alice performs the following steps Choose a large random primes p. Compute a random multiplicative generator g οƒŽ Zp* Pick x οƒŽU Zp-1 as private key Compute the public key y οƒŸ gx (mod p). Make (p,g,y) public key, and keep (p,x) as private key.

36 The ElGamal cryptosystem
Encryption Let m < p be the confidential message that Bob wants to send to Alice. Bob picks k οƒŽU Zp-1 and computes the ciphertext (c1, c2) c1 οƒŸ gk (mod p). c2 οƒŸ yk m (mod p). Decryption To decrypt the ciphertext (c1, c2) Alice computes m οƒŸ c2/c1x (mod p).

37 The ElGamal cryptosystem
Check: 𝑐 1 π‘₯ ≑ (𝑔 π‘˜ ) π‘₯ ≑ 𝑦 π‘˜ ≑ 𝑐 2 /π‘š π‘šπ‘œπ‘‘ 𝑝 .

38 Example Decryption: m = c2/c1x (mod p) = 31/157 (mod 43) = 14 .
Use p = 43, g =3, m = 14, x = 7, y = 37. Alice’s private key: x = 7 Alice’s public key: (p,g,y) = (43,3,37). Encryption with k = 26: c1 = gk (mod p) = 326 (mod 43) =15. c2 = yk m (mod p) = 3726 Γ—14 (mod 43) =31 . Decryption: m = c2/c1x (mod p) = 31/157 (mod 43) = 14 .

39 Security of ElGamal Relation to the DL.
Recovering the plaintext m from an ElGamal ciphertext c is easy if the DL problem is easy. ELGamal and the CDH problem For messages that are uniformly distributed, the ElGamal encryption system is secure against CPAs iff the CDH problem is hard.

40 Security of ElGamal For messages that are uniformly distributed, the ElGamal encryption system is secure against CPAs iff the CDH problem is hard.

41 Security of ElGamal Proof:
Suppose there exists an oracle that breaks ElGamal with non negligible probability ο₯ > 0. Then since π‘š= 𝑐 2 / 𝑐 1 π‘₯ (π‘šπ‘œπ‘‘ 𝑝) can be computed, 𝑐 2 /π‘š = 𝑔 π‘™π‘œπ‘” 𝑔 𝑦 π‘™π‘œπ‘” 𝑔 𝑐 1 (π‘šπ‘œπ‘‘ 𝑝) can also be computed. For an arbitrary CDH instance 𝑝,𝑔, 𝑔 1 =𝑦, 𝑔 2 = 𝑐 1 , take 𝑝,𝑔, 𝑔 1 as the ElGamal public key and 𝑐 1 , 𝑐 2 as ciphertext. Then the oracle outputs 𝑐 2 /π‘š = 𝑔 π‘™π‘œπ‘” 𝑔 𝑔 1 π‘™π‘œπ‘” 𝑔 𝑔 2 (π‘šπ‘œπ‘‘ 𝑝) which is a solution for the CDH instance.


Download ppt "7. Asymmetric encryption-"

Similar presentations


Ads by Google