Docsity

RSA Functions and Encryption in Computer Network Security | CS 4803, Study notes of Computer Science

Toggle sidebar
bg1
CS 4803
Computer and Network Security
Alexandra (Sasha) Boldyreva
RSA function and encryption.
1
The RSA system. The basics.
•Def. Let N,f ! 1 be integers. The RSA function associated to
N,f is the function RSAN,f : ZN ' ZN defined by
RSAN,f (w) = wf mod N for all w # ZN.
•Claim. Let N ! 2 and e,d 󲰉 Z"(N) be integers such that ed $ 1
(mod "(N)). Then the RSA functions RSAN,e and RSAN,d are
•both permutations on ZN and
•inverses of each other, ie. RSAN,e = RSAN,d and
RSAN,d = RSAN,e.
•Proof. For any x󲰉ZN , modulo N:
•RSAN,d(RSAN,e(x)) 󲰨 (xe)d 󲰨 xed 󲰨 xed mod φ(N) 󲰨 x1 󲰨 x
•Similarly, RSAN,e(RSAN,d(y)) 󲰨 y
&&
&
&
&
%1
%1
&
2
•The RSA function associated to N,f can be efficiently computed
using MOD-EXP(!,f,N) algorithm.
•Hence, RSAN,e(!) is efficiently computable given N,e
•RSAN,e(!) = RSAN,d(!) is efficiently computable given N,d
•But RSAN,e(!) = RSAN,d(!) is believed hard (without d) for
a proper choice of parameters (good for crypto).
•Let’s build algorithms that generate RSA parameters.
•Claim. There is an O(k2) time algorithm that on inputs !(N), e
where e 󲰉 Z"(N) and N < 2k, returns d # Z"(N) satisfying
ed $ 1 (mod "(N)).
%1
%1
& &
3
•The RSA modulus generator:
(k)
1
Return (N,p,q)
1
10 NUMBER-THEORETIC PRIMITIVES
Definition 10.9 Amodulus generator with associated security parameter k(where k≥2 is an
integer) is a randomized algorithm that takes no inputs and returns integers N,p, q satisfying:
1. p, q are distinct, odd primes
2. N=pq
3. 2k−1≤N < 2k(ie. Nhas bit-length k).
An RSA generator with associated security parameter kis a randomized algorithm that takes no
inputs and returns a pair ((N, e),(N, p, q, d)) such that the three conditions above are true, and, in
addition,
4. e, d ∈Z∗
(p−1)(q−1)
5. ed ≡1 (mod (p−1)(q−1))
We call Nan RSA modulus, or just modulus. We call ethe encryption exponent and dthe decryption
exponent.
Note that (p−1)(q−1) = ϕ(N) is the size of the group Z∗
N. So ab ove, e,d are relatively prime to
the order of the group Z∗
N. As the above indicates, we are going to restrict attention to numbers
Nthat are the product of two distinct odd primes. Condition (4) for the RSA generator translates
to 1 ≤e, d < (p−1)(q−1) and gcd(e, (p−1)(q−1)) = gcd(d, (p−1)(q−1)) = 1.
For parameter generation to be feasible, the generation algorithm must be efficient. There are
many different possible efficient generators. We illustrate a few.
In modulus generation, we usually pick the primes p,q at random, with each being about k/2
bits long. The corresp onding modulus generator K$
mod with associated security parameter kworks
as follows:
Algorithm K$
mod
"1← 'k/2(;"2← )k/2*
Repeat
p$
←{2!1−1, . . . , 2!1−1};q$
←{2!2−1, . . . , 2!2−1}
Until the following conditions are all true:
– TEST-PRIME(p) = 1 and TEST-PRIME(q) = 1
–p+=q
– 2k−1≤N
N←pq
Return (N, e),(N, p, q , d)
Above, TEST-PRIME denotes an algorithm that takes input an integer and returns 1 or 0. It is
designed so that, with high probability, the former happens when the input is prime and the latter
when the input is composite.
Sometimes, we may want modulii product of primes having a special form, for example primes
p, q such that (p−1)/2 and (q−1)/2 are both prime. This corresponds to a different modulus
generator, which works as above but simply adds, to the list of conditions tested to exit the loop, the
conditions TEST-PRIME((p−1)/2)) = 1 and TEST-PRIME((q−1)/2)) = 1. There are numerous
other possible modulus generators too.
An RSA generator, in addition to N, p, q, needs to generate the exp onents e, d. There are several
options for this. One is to first choose N , p, q, then pick eat random subject to gcd(N, ϕ(N)) =
10 NUMBER-THEORETIC PRIMITIVES
Definition 10.9 Amodulus generator with associated security parameter k(where k≥2 is an
integer) is a randomized algorithm that takes no inputs and returns integers N,p, q satisfying:
1. p, q are distinct, odd primes
2. N=pq
3. 2k−1≤N < 2k(ie. Nhas bit-length k).
An RSA generator with associated security parameter kis a randomized algorithm that takes no
inputs and returns a pair ((N, e),(N, p, q, d)) such that the three conditions above are true, and, in
addition,
4. e, d ∈Z∗
(p−1)(q−1)
5. ed ≡1 (mod (p−1)(q−1))
We call Nan RSA modulus, or just modulus. We call ethe encryption exponent and dthe decryption
exponent.
Note that (p−1)(q−1) = ϕ(N) is the size of the group Z∗
N. So ab ove, e,d are relatively prime to
the order of the group Z∗
N. As the above indicates, we are going to restrict attention to numbers
Nthat are the product of two distinct odd primes. Condition (4) for the RSA generator translates
to 1 ≤e, d < (p−1)(q−1) and gcd(e, (p−1)(q−1)) = gcd(d, (p−1)(q−1)) = 1.
For parameter generation to be feasible, the generation algorithm must be efficient. There are
many different possible efficient generators. We illustrate a few.
In modulus generation, we usually pick the primes p,q at random, with each being about k/2
bits long. The corresp onding modulus generator K$
mod with associated security parameter kworks
as follows:
Algorithm K$
mod
"1← 'k/2(;"2← )k/2*
Repeat
p$
←{2!1−1, . . . , 2!1−1};q$
←{2!2−1, . . . , 2!2−1}
Until the following conditions are all true:
– TEST-PRIME(p) = 1 and TEST-PRIME(q) = 1
–p+=q
– 2k−1≤N
N←pq
Return (N, e),(N, p, q , d)
Above, TEST-PRIME denotes an algorithm that takes input an integer and returns 1 or 0. It is
designed so that, with high probability, the former happens when the input is prime and the latter
when the input is composite.
Sometimes, we may want modulii product of primes having a special form, for example primes
p, q such that (p−1)/2 and (q−1)/2 are both prime. This corresponds to a different modulus
generator, which works as above but simply adds, to the list of conditions tested to exit the loop, the
conditions TEST-PRIME((p−1)/2)) = 1 and TEST-PRIME((q−1)/2)) = 1. There are numerous
other possible modulus generators too.
An RSA generator, in addition to N, p, q, needs to generate the exp onents e, d. There are several
options for this. One is to first choose N , p, q, then pick eat random subject to gcd(N, ϕ(N)) =
10 NUMBER-THEORETIC PRIMITIVES
Definition 10.9 Amodulus generator with associated security parameter k(where k≥2 is an
integer) is a randomized algorithm that takes no inputs and returns integers N, p, q satisfying:
1. p, q are distinct, odd primes
2. N=pq
3. 2k−1≤N < 2k(ie. Nhas bit-length k).
An RSA generator with associated security parameter kis a randomized algorithm that takes no
inputs and returns a pair ((N, e),(N, p, q , d)) such that the three conditions above are true, and, in
addition,
4. e, d ∈Z∗
(p−1)(q−1)
5. ed ≡1 (mod (p−1)(q−1))
We call Nan RSA modulus, or just modulus. We call ethe encryption exponent and dthe decryption
exponent.
Note that (p−1)(q−1) = ϕ(N) is the size of the group Z∗
N. So above, e, d are relatively prime to
the order of the group Z∗
N. As the above indicates, we are going to restrict attention to numbers
Nthat are the product of two distinct odd primes. Condition (4) for the RSA generator translates
to 1 ≤e, d < (p−1)(q−1) and gcd(e, (p−1)(q−1)) = gcd(d, (p−1)(q−1)) = 1.
For parameter generation to be feasible, the generation algorithm must be efficient. There are
many different possible efficient generators. We illustrate a few.
In modulus generation, we usually pick the primes p, q at random, with each being about k/2
bits long. The corresponding modulus generator K$
mod with associated security parameter kworks
as follows:
Algorithm K$
mod
"1← 'k/2(;"2← )k/2*
Repeat
p$
←{2!1−1, . . . , 2!1−1};q$
←{2!2−1, . . . , 2!2−1}
Until the following conditions are all true:
– TEST-PRIME(p) = 1 and TEST-PRIME(q) = 1
–p+=q
– 2k−1≤N
N←pq
Return (N, e),(N, p, q , d)
Above, TEST-PRIME denotes an algorithm that takes input an integer and returns 1 or 0. It is
designed so that, with high probability, the former happens when the input is prime and the latter
when the input is composite.
Sometimes, we may want modulii product of primes having a special form, for example primes
p, q such that (p−1)/2 and (q−1)/2 are both prime. This corresponds to a different modulus
generator, which works as above but simply adds, to the list of conditions tested to exit the loop, the
conditions TEST-PRIME((p−1)/2)) = 1 and TEST-PRIME((q−1)/2)) = 1. There are numerous
other possible modulus generators too.
An RSA generator, in addition to N, p, q, needs to generate the exponents e, d. There are several
options for this. One is to first choose N, p, q , then pick eat random subject to gcd(N, ϕ(N)) =
4
pf3
pf4
pf5

Partial preview of the text

Download RSA Functions and Encryption in Computer Network Security | CS 4803 and more Study notes Computer Science in PDF only on Docsity!

CS 4803

Computer and Network Security

Alexandra (Sasha) Boldyreva

RSA function and encryption.

1

The RSA system. The basics.

• Def. Let N,f^!^ 1 be integers. The RSA function associated to

N,f is the function RSAN,f : ZN ' ZN defined by

RSAN,f (w) = wf^ mod N for all w # ZN.

• Claim. Let N^!^ 2 and e,d^ Z " (N) be integers such that ed^ $^1

(mod "(N)). Then the RSA functions RSAN,e and RSAN,d are

• both permutations on^ ZN and

• inverses of each other, ie. RSAN,e = RSAN,d and

RSAN,d = RSAN,e.

• Proof. For any x^ ZN , modulo N:

• RSAN,d(RSAN,e(x)) (xe)d^ xed^ xed^ mod^ (N)^ x^1 x

• Similarly, RSAN,e(RSAN,d(y))^ y

2

• The RSA function associated to N,f can be efficiently computed

using MOD-EXP(!,f,N) algorithm.

• Hence, RSAN,e(!) is efficiently computable given N,e

• RSAN,e(!)^ = RSAN,d(!) is efficiently computable given N,d

• But RSAN,e(!)^ = RSAN,d(!) is believed hard (without d) for

a proper choice of parameters (good for crypto).

• Let’s build algorithms that generate RSA parameters.

• Claim. There is an O(k^2 ) time algorithm that on inputs !(N), e

where e Z " (N) and N < 2k, returns d # Z " (N) satisfying

ed $ 1 (mod "(N)).

3

• The RSA modulus generator:

( k ) 1 Return ( N , p , q ) 10 NUMBER-THEORETIC PRIM Definition 10.9 A modulus generator with associated security parameter k (where k ≥ integer) is a randomized algorithm that takes no inputs and returns integers N, p, q satisfyi

  1. p, q are distinct, odd primes
  2. N = pq
  3. 2 k−^1 ≤ N < 2 k^ (ie. N has bit-length k). An RSA generator with associated security parameter k is a randomized algorithm that ta inputs and returns a pair ((N, e), (N, p, q, d)) such that the three conditions above are true, addition,
  4. e, d ∈ Z∗ (p− 1 )(q− 1 )
  5. ed ≡ 1 (mod (p − 1 )(q − 1 )) We call N an RSA modulus, or just modulus. We call e the encryption exponent and d the dec exponent. Note that (p − 1 )(q − 1 ) = ϕ(N ) is the size of the group Z∗ N. So above, e, d are relatively p the order of the group Z∗ N. As the above indicates, we are going to restrict attention to nu N that are the product of two distinct odd primes. Condition ( 4 ) for the RSA generator tra to 1 ≤ e, d < (p − 1 )(q − 1 ) and gcd(e, (p − 1 )(q − 1 )) = gcd(d, (p − 1 )(q − 1 )) = 1. For parameter generation to be feasible, the generation algorithm must be efficient. Th many different possible efficient generators. We illustrate a few. In modulus generation, we usually pick the primes p, q at random, with each being abo bits long. The corresponding modulus generator K$ mod with associated security parameter k as follows: Algorithm K$ mod " 1 ← 'k/ 2 ( ; " 2 ← )k/ 2 * Repeat p ←$ { 2!^1 −^1 ,... , 2!^1 − 1 } ; q ←$ { 2!^2 −^1 ,... , 2!^2 − 1 } Until the following conditions are all true:
  • TEST-PRIME(p) = 1 and TEST-PRIME(q) = 1
  • p += q
  • 2 k−^1 ≤ N N ← pq Return (N, e), (N, p, q, d) Above, TEST-PRIME denotes an algorithm that takes input an integer and returns 1 or 0 designed so that, with high probability, the former happens when the input is prime and the when the input is composite. Sometimes, we may want modulii product of primes having a special form, for example p, q such that (p − 1 )/ 2 and (q − 1 )/ 2 are both prime. This corresponds to a different m generator, which works as above but simply adds, to the list of conditions tested to exit the lo conditions TEST-PRIME((p − 1 )/ 2 )) = 1 and TEST-PRIME((q − 1 )/ 2 )) = 1. There are nu other possible modulus generators too. An RSA generator, in addition to N, p, q, needs to generate the exponents e, d. There are options for this. One is to first choose N, p, q, then pick e at random subject to gcd(N, ϕ( 10 NUMBER-THEORETIC PRIMITIVES Definition 10.9 A modulus generator with associated security parameter k (where k ≥ 2 is an integer) is a randomized algorithm that takes no inputs and returns integers N, p, q satisfying:
  1. p, q are distinct, odd primes
  2. N = pq
  3. 2 k−^1 ≤ N < 2 k^ (ie. N has bit-length k). An RSA generator with associated security parameter k is a randomized algorithm that takes no inputs and returns a pair ((N, e), (N, p, q, d)) such that the three conditions above are true, and, in addition,
  4. e, d ∈ Z∗ (p− 1 )(q− 1 )
  5. ed ≡ 1 (mod (p − 1 )(q − 1 )) We call N an RSA modulus, or just modulus. We call e the encryption exponent and d the decryption exponent. Note that (p − 1 )(q − 1 ) = ϕ(N ) is the size of the group Z∗ N. So above, e, d are relatively prime to the order of the group Z∗ N. As the above indicates, we are going to restrict attention to numbers N that are the product of two distinct odd primes. Condition ( 4 ) for the RSA generator translates to 1 ≤ e, d < (p − 1 )(q − 1 ) and gcd(e, (p − 1 )(q − 1 )) = gcd(d, (p − 1 )(q − 1 )) = 1. For parameter generation to be feasible, the generation algorithm must be efficient. There are many different possible efficient generators. We illustrate a few. In modulus generation, we usually pick the primes p, q at random, with each being about k/ 2 bits long. The corresponding modulus generator K$ mod with associated security parameter k works as follows: Algorithm K$ mod " 1 ← 'k/ 2 ( ; " 2 ← )k/ 2 * Repeat p ←$ { 2!^1 −^1 ,... , 2!^1 − 1 } ; q ←$ { 2!^2 −^1 ,... , 2!^2 − 1 } Until the following conditions are all true:
  • TEST-PRIME(p) = 1 and TEST-PRIME(q) = 1
  • p += q
  • 2 k−^1 ≤ N N ← pq Return (N, e), (N, p, q, d) Above, TEST-PRIME denotes an algorithm that takes input an integer and returns 1 or 0. It is designed so that, with high probability, the former happens when the input is prime and the latter when the input is composite. Sometimes, we may want modulii product of primes having a special form, for example primes p, q such that (p − 1 )/ 2 and (q − 1 )/ 2 are both prime. This corresponds to a different modulus generator, which works as above but simply adds, to the list of conditions tested to exit the loop, the conditions TEST-PRIME((p − 1 )/ 2 )) = 1 and TEST-PRIME((q − 1 )/ 2 )) = 1. There are numerous other possible modulus generators too. An RSA generator, in addition to N, p, q, needs to generate the exponents e, d. There are several options for this. One is to first choose N, p, q, then pick e at random subject to gcd(N, ϕ(N )) =

10 NUMBER-THEORETIC P

Definition 10.9 A modulus generator with associated security parameter k (where k integer) is a randomized algorithm that takes no inputs and returns integers N, p, q sat

  1. p, q are distinct, odd primes
  2. N = pq
  3. 2 k−^1 ≤ N < 2 k^ (ie. N has bit-length k). An RSA generator with associated security parameter k is a randomized algorithm tha inputs and returns a pair ((N, e), (N, p, q, d)) such that the three conditions above are tr addition,
  4. e, d ∈ Z∗ (p− 1 )(q− 1 )
  5. ed ≡ 1 (mod (p − 1 )(q − 1 )) We call N an RSA modulus, or just modulus. We call e the encryption exponent and d the exponent. Note that (p − 1 )(q − 1 ) = ϕ(N ) is the size of the group Z∗ N. So above, e, d are relative the order of the group Z∗ N. As the above indicates, we are going to restrict attention t N that are the product of two distinct odd primes. Condition ( 4 ) for the RSA generator to 1 ≤ e, d < (p − 1 )(q − 1 ) and gcd(e, (p − 1 )(q − 1 )) = gcd(d, (p − 1 )(q − 1 )) = 1. For parameter generation to be feasible, the generation algorithm must be efficient. many different possible efficient generators. We illustrate a few. In modulus generation, we usually pick the primes p, q at random, with each being bits long. The corresponding modulus generator K$ mod with associated security paramet as follows: Algorithm K$ mod " 1 ← 'k/ 2 ( ; " 2 ← )k/ 2 * Repeat p ←$ { 2!^1 −^1 ,... , 2!^1 − 1 } ; q ←$ { 2!^2 −^1 ,... , 2!^2 − 1 } Until the following conditions are all true:
  • TEST-PRIME(p) = 1 and TEST-PRIME(q) = 1
  • p += q
  • 2 k−^1 ≤ N N ← pq Return (N, e), (N, p, q, d) Above, TEST-PRIME denotes an algorithm that takes input an integer and returns 1 designed so that, with high probability, the former happens when the input is prime and when the input is composite. Sometimes, we may want modulii product of primes having a special form, for exam p, q such that (p − 1 )/ 2 and (q − 1 )/ 2 are both prime. This corresponds to a differen generator, which works as above but simply adds, to the list of conditions tested to exit th conditions TEST-PRIME((p − 1 )/ 2 )) = 1 and TEST-PRIME((q − 1 )/ 2 )) = 1. There are other possible modulus generators too. An RSA generator, in addition to N, p, q, needs to generate the exponents e, d. There options for this. One is to first choose N, p, q, then pick e at random subject to gcd(N

Definition 10.9 A modulus generator with associated security parame

integer) is a randomized algorithm that takes no inputs and returns inte

1. p, q are distinct, odd primes

2. N = pq

3. 2 k−^1 ≤ N < 2 k^ (ie. N has bit-length k).

An RSA generator with associated security parameter k is a randomize

inputs and returns a pair ((N, e), (N, p, q, d)) such that the three conditio

addition,

4. e, d ∈ Z∗ (p− 1 )(q− 1 )

5. ed ≡ 1 (mod (p − 1 )(q − 1 ))

We call N an RSA modulus, or just modulus. We call e the encryption exp

exponent.

Note that (p − 1 )(q − 1 ) = ϕ(N ) is the size of the group Z∗ N. So above,

the order of the group Z∗ N. As the above indicates, we are going to rest

N that are the product of two distinct odd primes. Condition ( 4 ) for the

to 1 ≤ e, d < (p − 1 )(q − 1 ) and gcd(e, (p − 1 )(q − 1 )) = gcd(d, (p − 1 )(q

For parameter generation to be feasible, the generation algorithm m

many different possible efficient generators. We illustrate a few.

In modulus generation, we usually pick the primes p, q at random, w

bits long. The corresponding modulus generator K$ mod with associated s

as follows:

Algorithm K$ mod

" 1 ← 'k/ 2 ( ; " 2 ← )k/ 2 *

Repeat

p ←$ { 2!^1 −^1 ,... , 2!^1 − 1 } ; q ←$ { 2!^2 −^1 ,... , 2!^2 − 1 }

Until the following conditions are all true:

– TEST-PRIME(p) = 1 and TEST-PRIME(q) = 1

– p += q

– 2 k−^1 ≤ N

N ← pq

Return (N, e), (N, p, q, d)

Above, TEST-PRIME denotes an algorithm that takes input an integer

designed so that, with high probability, the former happens when the inp

when the input is composite.

Sometimes, we may want modulii product of primes having a special

p, q such that (p − 1 )/ 2 and (q − 1 )/ 2 are both prime. This correspon

generator, which works as above but simply adds, to the list of conditions

conditions TEST-PRIME((p − 1 )/ 2 )) = 1 and TEST-PRIME((q − 1 )/ 2 ))

other possible modulus generators too.

An RSA generator, in addition to N, p, q, needs to generate the expon

options for this. One is to first choose N, p, q, then pick e at random s

4

  • The random-exponent RSA generator:
  • Often for efficiency we want^ e^ to be small, e.g. 3. Then

1 , and compute d via the algorithm of Proposition 10 .8. This random-exponent RSA generator,

denoted K$ rsa, is detailed below:

Algorithm K$ rsa

(N, p, q) ←$ K$ mod

M ← (p − 1 )(q − 1 )

e ←$ Z∗ M

Compute d by running the algorithm of Proposition 10 .8 on inputs M, e

Return ((N, e), (N, p, q, d))

In order to speed-up computation of RSAN,e, however, we often like e to be small. To enable this,

we begin by setting e to some small prime number like 3 , and then picking the other parameters

appropriately. In particular we associate to any odd prime number e the following exponent-e RSA

generator :

Algorithm Ke rsa

Repeat

(N, p, q) ←$ K mo$ d(k)

Until

  • e < (p − 1 ) and e < (q − 1 )
  • gcd(e, (p − 1 )) = gcd(e, (q − 1 )) = 1

M ← (p − 1 )(q − 1 )

Compute d by running the algorithm of Proposition 10 .8 on inputs M, e

Return ((N, e), (N, p, q, d))

    1. 3 One-wayness problems

The basic assumed security property of the RSA functions is one-wayness, meaning given N, e, y

it is hard to compute RSA− N^1 ,e(y). One must be careful to formalize this properly though. The

formalization chooses y at random.

Definition 10.10 Let Krsa be an RSA generator with associated security parameter k, and let A

be an algorithm. We consider the following experiment:

Experiment Expo Kwrs-ak ea(A)

((N, e), (N, p, q, d)) ←$ Krsa

x ←$ Z∗ N ; y ← xe^ mod N

x′^ ←$ A(N, e, y)

If x′^ = x then return 1 else return 0

The ow-kea-advantage of A is defined as

Advo Kwrs-ak ea(A) = Pr

[

Expo Kwrs-ak ea(A) = 1

]

Above, “kea” stands for “known-exponent attack.” We might also allow a chosen-exponent attack,

abbreviated “cea,” in which, rather than having the encryption exponent specified by the instance

of the problem, one allows the adversary to choose it. The only condition imposed is that the

adversary not choose e = 1.

( k ) 1 appropriately. In particular we associate to any odd prime number e the following exponent-e RSA generator : Algorithm Ke rsa Repeat (N, p, q) ←$ K$ mod(k) Until

  • e < (p − 1 ) and e < (q − 1 )
  • gcd(e, (p − 1 )) = gcd(e, (q − 1 )) = 1 M ← (p − 1 )(q − 1 ) Compute d by running the algorithm of Proposition 10 .8 on inputs M, e Return ((N, e), (N, p, q, d))

10. 3. 3 One-wayness problems

The basic assumed security property of the RSA functions is one-wayness, meaning given N, e, y it is hard to compute RSA− N^1 ,e(y). One must be careful to formalize this properly though. The formalization chooses y at random. Definition 10.10 Let Krsa be an RSA generator with associated security parameter k, and let A be an algorithm. We consider the following experiment: Experiment Expo Kwrs-ak ea(A) ((N, e), (N, p, q, d)) ←$ Krsa x ←$ Z∗ N ; y ← xe^ mod N x′^ ←$ A(N, e, y) If x′^ = x then return 1 else return 0 The ow-kea-advantage of A is defined as Advo Kwrs-ak ea(A) = Pr

[

Expo Kwrs-ak ea(A) = 1

]

Above, “kea” stands for “known-exponent attack.” We might also allow a chosen-exponent attack, abbreviated “cea,” in which, rather than having the encryption exponent specified by the instance of the problem, one allows the adversary to choose it. The only condition imposed is that the adversary not choose e = 1. Bellare and Rogaway 11 1 , and compute d via the algorithm of Proposition 10 .8. This random-exponent RSA generator, denoted K$ rsa, is detailed below: Algorithm K$ rsa (N, p, q) ←$ K$ mod M ← (p − 1 )(q − 1 ) e ←$ Z∗ M Compute d by running the algorithm of Proposition 10 .8 on inputs M, e Return ((N, e), (N, p, q, d)) In order to speed-up computation of RSAN,e, however, we often like e to be small. To enable this, we begin by setting e to some small prime number like 3 , and then picking the other parameters appropriately. In particular we associate to any odd prime number e the following exponent-e RSA generator : Algorithm Ke rsa Repeat (N, p, q) ←$ K$ mod(k) Until

  • e < (p − 1 ) and e < (q − 1 )
  • gcd(e, (p − 1 )) = gcd(e, (q − 1 )) = 1 M ← (p − 1 )(q − 1 ) Compute d by running the algorithm of Proposition 10 .8 on inputs M, e Return ((N, e), (N, p, q, d))
    1. 3 One-wayness problems The basic assumed security property of the RSA functions is one-wayness, meaning given N, e, y it is hard to compute RSA− N^1 ,e(y). One must be careful to formalize this properly though. The formalization chooses y at random. Definition 10.10 Let Krsa be an RSA generator with associated security parameter k, and let A be an algorithm. We consider the following experiment: Experiment Expo Kwrs-ak ea(A) ((N, e), (N, p, q, d)) ←$ Krsa x ←$ Z∗ N ; y ← xe^ mod N x′^ ←$ A(N, e, y) If x′^ = x then return 1 else return 0 The ow-kea-advantage of A is defined as Advo Kwrs-ak ea(A) = Pr [ Expo Kwrs-ak ea(A) = 1 ] . Above, “kea” stands for “known-exponent attack.” We might also allow a chosen-exponent attack, abbreviated “cea,” in which, rather than having the encryption exponent specified by the instance of the problem, one allows the adversary to choose it. The only condition imposed is that the adversary not choose e = 1. ( k ) 1 Bellare and Rogaway 11 1 , and compute d via the algorithm of Proposition 10 .8. This random-exponent RSA generator, denoted K$ rsa, is detailed below: Algorithm K$ rsa (N, p, q) ←$ K$ mod M ← (p − 1 )(q − 1 ) e ←$ Z∗ M Compute d by running the algorithm of Proposition 10 .8 on inputs M, e Return ((N, e), (N, p, q, d)) In order to speed-up computation of RSAN,e, however, we often like e to be small. To enable this, we begin by setting e to some small prime number like 3 , and then picking the other parameters appropriately. In particular we associate to any odd prime number e the following exponent-e RSA generator : Algorithm Ke rsa Repeat (N, p, q) ←$ K$ mod(k) Until
  • e < (p − 1 ) and e < (q − 1 )
  • gcd(e, (p − 1 )) = gcd(e, (q − 1 )) = 1 M ← (p − 1 )(q − 1 ) Compute d by running the algorithm of Proposition 10 .8 on inputs M, e Return ((N, e), (N, p, q, d))
    1. 3 One-wayness problems The basic assumed security property of the RSA functions is one-wayness, meaning given N, e, y it is hard to compute RSA− N^1 ,e(y). One must be careful to formalize this properly though. The formalization chooses y at random. Definition 10.10 Let Krsa be an RSA generator with associated security parameter k, and let A be an algorithm. We consider the following experiment: Experiment Expo Kwrs-ak ea(A) ((N, e), (N, p, q, d)) ←$ Krsa x ←$ Z∗ N ; y ← xe^ mod N x′^ ←$ A(N, e, y) If x′^ = x then return 1 else return 0 The ow-kea-advantage of A is defined as Advo Kwrs-ak ea(A) = Pr [ Expo Kwrs-ak ea(A) = 1 ] . Above, “kea” stands for “known-exponent attack.” We might also allow a chosen-exponent attack, abbreviated “cea,” in which, rather than having the encryption exponent specified by the instance of the problem, one allows the adversary to choose it. The only condition imposed is that the adversary not choose e = 1. d ← MOD-INV( e , M ) 1 d ← MOD-INV( e , M ) 1 5 Hard RSA-related problem
  • Def [ow-kea] For an adversary A consider an experiment:

The ow-kea - advantage of A is defined as the probability of the

above experiment outputting 1.

RSA assumption. There is no efficient adversary whose ow-kea

advantage is not negligible.

10. 3. 3 One-wayness problems

The basic assumed security property of the RSA functions is one-wayness, meaning given N, e, y it is hard to compute RSA− N^1 ,e(y). One must be careful to formalize this properly though. The formalization chooses y at random. Definition 10.10 Let Krsa be an RSA generator with associated security parameter k, and let A be an algorithm. We consider the following experiment: Experiment Expo Kwrs-ak ea(A) ((N, e), (N, p, q, d)) ←$ Krsa x ←$ Z∗ N ; y ← xe^ mod N x′^ ←$ A(N, e, y) If x′^ = x then return 1 else return 0 The ow-kea-advantage of A is defined as Advo Kwrs-ak ea(A) = Pr [ Expo Kwrs-ak ea(A) = 1 ] . Above, “kea” stands for “known-exponent attack.” We might also allow a chosen-exponent attack, abbreviated “cea,” in which, rather than having the encryption exponent specified by the instance of the problem, one allows the adversary to choose it. The only condition imposed is that the adversary not choose e = 1. ( k ) 1 6

  • Let’s study several known attacks that “break” RSA, i.e.

compute an inverse of the RSA function on random inputs

without knowing the trapdoor.

x xe^ mod N easy easy with d hard without d 7 Some known attacks on RSA function

  • Factoring the RSA modulus.
    • If one can factor N, i.e. compute p,q, s.t. N=pq then one

can compute d=e-1^ mod (p-1)(q-1)

  • The best known algorithm to factor is GNFS.
  • Theorem [RSA with low secret exponent]. Let N=pq, where

q<p<2q and p,q are prime. Let d<1/3!N1/4. Then given (N,e)

one can efficiently compute d.

8

Plain RSA is not secure

• Under the RSA assumption it is hard to recover a message

given the public key and a ciphertext.

• Nevertheless, the plain RSA is not a good encryption scheme.

• E.g. it is not IND-CPA secure. Why?

• One might try to add a random padding to a message before

applying the RSA function, but as we saw it does not

necessarily helps.

M C=M

e

mod N

easy

easy with d

hard without d

13

RSA-OAEP

M 0...0 $

G

H

RSA N,e

C

C

RSA N,d

H

G

M z $

Output M iff z=0...

G,H are hash functions

14

RSA-OAEP

AlgorithmK (( N , e ), ( N , p , q , d )) ←$ K $ rsa Return (( N , e ), ( N , d )) 1 AlgorithmE( N , e )( M ) r ←$ { 0 , 1 } k^0 s ← M || 0 k^1 ⊕ G ( r ) t ← r ⊕ H ( s ) C ←< s || t > e^ mod N Return C 1 AlgorithmD( N , d )( C ) W ← Cd^ mod N Parse W as s || t r ← H ( s ) ⊕ t M ′^ ← s ⊕ G ( r ) Parse M ′^ as M || z If z = 0 k^1 thenReturn C Else return ⊥ G : { 0 , 1 } k^0 → { 0 , 1 } k − k^0 1 H : { 0 , 1 } k − k^0 → { 0 , 1 } k^0 1

Hash functions:

If z = 0 k^1 then return M else return ⊥ 15

Security of RSA-OAEP

• RSA-OAEP has not been proven IND-CCA

secure.

• But it is proven IND-CCA secure assuming the

RSA assumption, and when G,H are modeled as

random oracles.

• Assuming the RSA problem is hard, RSA-OAEP

is IND-CCA secure in the Random Oracle (RO)

model.

16

RO model

• The RO model assumes that all parties (adversary included)

have oracle access to a truly random function.

• This is not true in reality. The model is ideal.

• In practice real hash functions such as SHA1 are used in place

of random oracles.

• The belief is that security of the practical schemes holds in

the standard model.

• However there are several examples of uninstantiable

schemes (the schemes that are proven secure in the RO

model but shown to be insecure for any instantiation of

random oracles with a real function.)

• All currently known uninstantiable schemes are rather

artificial.

17

Hybrid encryption

• Asymmetric encryption uses number-theoretic operations and

is slower than symmetric encryption that often uses block

ciphers.

• Also we often want to encrypt long messages.

• In practice one usually

1. encrypts a randomly chosen symmetric key K using an

asymmetric encryption algorithm and then

2. encrypts a message using a symmetric encryption

algorithm and K.

• This is called hybrid encryption

18

Hybrid encryption

• Let^ be an asymmetric encryption scheme and

let be a symmetric encryption scheme, s.t.

the set of keys for SE is always in the message space of AE.

Then the associated hybrid scheme is as

follows:

• Note that the hybrid scheme is an asymmetric encryption

scheme

12 ASYMMETRIC ENCRYPTION

under K via the symmetric scheme to get a ciphertext Cs, and transmit (Ca, Cs). This is called hybrid encryption. More precisely, hybrid encryption is a transform that given any asymmetric encryption scheme and any symmetric encryption scheme associates to them a new asymmetric encryption scheme: Scheme 8.5 Let AE = (Ka, Ea, Da) be an asymmetric encryption scheme, and let SE = (Ks, Es, Ds) be a stateless symmetric encryption scheme such that Keys(SE) ⊆ Plaintexts(pk) for every pk that might be output by Ka. The hybrid encryption scheme associated to AE, SE is the asymmetric encryption scheme AE = (Ka, E, D) whose key-generation algorithm is the same as that of AE and whose encryption and decryption algorithms are defined as follows: Algorithm Epk (M ) K ←$ Ks^ ; Cs^ ←$ E Ks (M ) If Cs^ = ⊥ then return ⊥ Ca^ ←$ E pka (K) ; C ← (Ca, Cs) Return C Algorithm Dsk (C) Parse C as (Ca, Cs) K ← Da sk (Ca) If K = ⊥ then return ⊥ M ← Ds K (Cs) Return M Under this hybrid encryption scheme, one can (asymmetrically) encrypt any message M that is in the plaintext-space of the underlying symmetric encryption scheme. Hybrid encryption is used for numerous reasons. The principal one is cost. The number-theoretic operations underlying common asymmetric encryption schemes are computationally costly relative to the operations on block ciphers that underly common symmetric encryption schemes. In practice one wants to minimize the amount of data to which these number-theoretic operations are applied. Accord- ingly, rather than encrypt the possibly long message M directly under pk via the given asymmetric scheme, one uses hybrid encryption. The costly number-theoretic operations are thus applied only to data whose length k is fixed and not dependent 12 ASYMMETRIC ENCRYPTION under K via the symmetric scheme to get a ciphertext Cs, and transmit (Ca, Cs). This is called hybrid encryption. More precisely, hybrid encryption is a transform that given any asymmetric encryption scheme and any symmetric encryption scheme associates to them a new asymmetric encryption scheme: Scheme 8.5 Let AE = (Ka, Ea, Da) be an asymmetric encryption scheme, and let SE = (Ks, Es, Ds) be a stateless symmetric encryption scheme such that Keys(SE) ⊆ Plaintexts(pk) for every pk that might be output by Ka. The hybrid encryption scheme associated to AE, SE is the asymmetric encryption scheme AE = (Ka, E, D) whose key-generation algorithm is the same as that of AE and whose encryption and decryption algorithms are defined as follows: Algorithm Epk (M ) K ←$ Ks^ ; Cs^ ←$ E Ks (M ) If Cs^ = ⊥ then return ⊥ Ca^ ←$ E pka (K) ; C ← (Ca, Cs) Return C Algorithm Dsk (C) Parse C as (Ca, Cs) K ← Da sk (Ca) If K = ⊥ then return ⊥ M ← Ds K (Cs) Return M Under this hybrid encryption scheme, one can (asymmetrically) encrypt any message M that is in the plaintext-space of the underlying symmetric encryption scheme. Hybrid encryption is used for numerous reasons. The principal one is cost. The number-theoretic operations underlying common asymmetric encryption schemes are computationally costly relative to the operations on block ciphers that underly common symmetric encryption schemes. In practice one wants to minimize the amount of data to which these number-theoretic operations are applied. Accord- ingly, rather than encrypt the possibly long message M directly under pk via the given asymmetric scheme, one uses hybrid encryption. The costly number-theoretic operations are thus applied only to data whose length k is fixed and not dependent on the length of M. 2 ASYMMETRIC ENCRYPTION nder K via the symmetric scheme to get a ciphertext Cs, and transmit (Ca, Cs). his is called hybrid encryption. More precisely, hybrid encryption is a transform that given any asymmetric ncryption scheme and any symmetric encryption scheme associates to them a new symmetric encryption scheme: cheme 8.5 Let AE = (Ka, Ea, Da) be an asymmetric encryption scheme, and let E = (Ks, Es, Ds) be a stateless symmetric encryption scheme such that Keys(SE) ⊆ laintexts(pk) for every pk that might be output by Ka. The hybrid encryption cheme associated to AE, SE is the asymmetric encryption scheme AE = (Ka, E, D) hose key-generation algorithm is the same as that of AE and whose encryption nd decryption algorithms are defined as follows: Algorithm Epk (M ) K ←$ Ks^ ; Cs^ ←$ E Ks (M ) If Cs^ = ⊥ then return ⊥ Ca^ ←$ E pka (K) ; C ← (Ca, Cs) Return C Algorithm Dsk (C) Parse C as (Ca, Cs) K ← Da sk (Ca) If K = ⊥ then return ⊥ M ← Ds K (Cs) Return M nder this hybrid encryption scheme, one can (asymmetrically) encrypt any message that is in the plaintext-space of the underlying symmetric encryption scheme. ybrid encryption is used for numerous reasons. The principal one is cost. The umber-theoretic operations underlying common asymmetric encryption schemes re computationally costly relative to the operations on block ciphers that underly ommon symmetric encryption schemes. In practice one wants to minimize the mount of data to which these number-theoretic operations are applied. Accord- ngly, rather than encrypt the possibly long message M directly under pk via the iven asymmetric scheme, one uses hybrid encryption. The costly number-theoretic perations are thus applied only to data whose length k is fixed and not dependent

12 ASYMMETRIC ENCRYPTION

under K via the symmetric scheme to get a ciphertext Cs, and transmit (Ca, Cs). This is called hybrid encryption. More precisely, hybrid encryption is a transform that given any asymmetric encryption scheme and any symmetric encryption scheme associates to them a new asymmetric encryption scheme: Scheme 8.5 Let AE = (Ka, Ea, Da) be an asymmetric encryption scheme, and let SE = (Ks, Es, Ds) be a stateless symmetric encryption scheme such that Keys(SE) ⊆ Plaintexts(pk) for every pk that might be output by Ka. The hybrid encryption scheme associated to AE, SE is the asymmetric encryption scheme AE = (Ka, E, D) whose key-generation algorithm is the same as that of AE and whose encryption and decryption algorithms are defined as follows: Algorithm Epk (M ) K ←$ Ks^ ; Cs^ ←$ E Ks (M ) If Cs^ = ⊥ then return ⊥ Ca^ ←$ E pka (K) ; C ← (Ca, Cs) Return C Algorithm Dsk (C) Parse C as (Ca, Cs) K ← Da sk (Ca) If K = ⊥ then return ⊥ M ← D Ks (Cs) Return M Under this hybrid encryption scheme, one can (asymmetrically) encrypt any message M that is in the plaintext-space of the underlying symmetric encryption scheme. Hybrid encryption is used for numerous reasons. The principal one is cost. The number-theoretic operations underlying common asymmetric encryption schemes are computationally costly relative to the operations on block ciphers that underly common symmetric encryption schemes. In practice one wants to minimize the amount of data to which these number-theoretic operations are applied. Accord- ingly, rather than encrypt the possibly long message M directly under pk via the given asymmetric scheme, one uses hybrid encryption. The costly number-theoretic operations are thus applied only to data whose length k is fixed and not dependent on the length of M. 19

Hybrid encryption

• Theorem. Let^ be an asymmetric encryption

scheme and let be a symmetric encryption

scheme, s.t. the set of keys for SE is always in the message

space of AE. Let be the associated hybrid

scheme as defined on the previous slide. Then if the

components are IND-CPA, then the associated hybrid

scheme is also IND-CPA.

• An analogues theorem can be stated and proved for the

case of chosen-ciphertext attacks (if the components are

IND-CCA secure, then the hybrid scheme is IND-CCA

secure).

12 ASYMMETRIC ENCRYPTION

under K via the symmetric scheme to get a ciphertext Cs, and transmit (Ca, Cs). This is called hybrid encryption. More precisely, hybrid encryption is a transform that given any asymmetric encryption scheme and any symmetric encryption scheme associates to them a new asymmetric encryption scheme: Scheme 8.5 Let AE = (Ka, Ea, Da) be an asymmetric encryption scheme, and let SE = (Ks, Es, Ds) be a stateless symmetric encryption scheme such that Keys(SE) ⊆ Plaintexts(pk) for every pk that might be output by Ka. The hybrid encryption scheme associated to AE, SE is the asymmetric encryption scheme AE = (Ka, E, D) whose key-generation algorithm is the same as that of AE and whose encryption and decryption algorithms are defined as follows: Algorithm Epk (M ) K ←$ Ks^ ; Cs^ ←$ Es K (M ) If Cs^ = ⊥ then return ⊥ Ca^ ←$ E pka (K) ; C ← (Ca, Cs) Return C Algorithm Dsk (C) Parse C as (Ca, Cs) K ← Da sk (Ca) If K = ⊥ then return ⊥ M ← D Ks (Cs) Return M Under this hybrid encryption scheme, one can (asymmetrically) encrypt any message M that is in the plaintext-space of the underlying symmetric encryption scheme. Hybrid encryption is used for numerous reasons. The principal one is cost. The number-theoretic operations underlying common asymmetric encryption schemes are computationally costly relative to the operations on block ciphers that underly common symmetric encryption schemes. In practice one wants to minimize the amount of data to which these number-theoretic operations are applied. Accord- ingly, rather than encrypt the possibly long message M directly under pk via the given asymmetric scheme, one uses hybrid encryption. The costly number-theoretic operations are thus applied only to data whose length k is fixed and not dependent 12 ASYMMETRIC ENC under K via the symmetric scheme to get a ciphertext Cs, and transmit This is called hybrid encryption. More precisely, hybrid encryption is a transform that given any as encryption scheme and any symmetric encryption scheme associates to th asymmetric encryption scheme: Scheme 8.5 Let AE = (Ka, Ea, Da) be an asymmetric encryption schem SE = (Ks, Es, Ds) be a stateless symmetric encryption scheme such that K Plaintexts(pk) for every pk that might be output by Ka. The hybrid e scheme associated to AE, SE is the asymmetric encryption scheme AE = whose key-generation algorithm is the same as that of AE and whose e and decryption algorithms are defined as follows: Algorithm Epk (M ) K ←$ Ks^ ; Cs^ ←$ E Ks (M ) If Cs^ = ⊥ then return ⊥ Ca^ ←$ E pka (K) ; C ← (Ca, Cs) Return C Algorithm Dsk (C) Parse C as (Ca, Cs) K ← Da sk (Ca) If K = ⊥ then return ⊥ M ← D Ks (Cs) Return M Under this hybrid encryption scheme, one can (asymmetrically) encrypt an M that is in the plaintext-space of the underlying symmetric encryption Hybrid encryption is used for numerous reasons. The principal one is number-theoretic operations underlying common asymmetric encryptio are computationally costly relative to the operations on block ciphers tha common symmetric encryption schemes. In practice one wants to min amount of data to which these number-theoretic operations are applied ingly, rather than encrypt the possibly long message M directly under p given asymmetric scheme, one uses hybrid encryption. The costly number operations are thus applied only to data whose length k is fixed and not 12 ASYMMETRIC ENCRYPTION under K via the symmetric scheme to get a ciphertext Cs, and transmit (Ca, Cs). This is called hybrid encryption. More precisely, hybrid encryption is a transform that given any asymmetric encryption scheme and any symmetric encryption scheme associates to them a new asymmetric encryption scheme: Scheme 8.5 Let AE = (Ka, Ea, Da) be an asymmetric encryption scheme, and let SE = (Ks, Es, Ds) be a stateless symmetric encryption scheme such that Keys(SE) ⊆ Plaintexts(pk) for every pk that might be output by Ka. The hybrid encryption scheme associated to AE, SE is the asymmetric encryption scheme AE = (Ka, E, D) whose key-generation algorithm is the same as that of AE and whose encryption and decryption algorithms are defined as follows: Algorithm Epk (M ) K ←$ Ks^ ; Cs^ ←$ E Ks (M ) If Cs^ = ⊥ then return ⊥ Ca^ ←$ E pka (K) ; C ← (Ca, Cs) Return C Algorithm Dsk (C) Parse C as (Ca, Cs) K ← D sak (Ca) If K = ⊥ then return ⊥ M ← Ds K (Cs) Return M Under this hybrid encryption scheme, one can (asymmetrically) encrypt any message M that is in the plaintext-space of the underlying symmetric encryption scheme. Hybrid encryption is used for numerous reasons. The principal one is cost. The number-theoretic operations underlying common asymmetric encryption schemes are computationally costly relative to the operations on block ciphers that underly common symmetric encryption schemes. In practice one wants to minimize the amount of data to which these number-theoretic operations are applied. Accord- ingly, rather than encrypt the possibly long message M directly under pk via the given asymmetric scheme, one uses hybrid encryption. The costly number-theoretic operations are thus applied only to data whose length k is fixed and not dependent 20