0% found this document useful (0 votes)
127 views3 pages

Tutorial On Public Key Cryptography - RSA

The document describes the RSA key generation process and provides an example. It also describes how RSA encryption and decryption works using the generated public and private keys. Specifically, it shows: 1) How to generate the public and private keys by first choosing two prime numbers p and q, then computing n as their product and φ(n) as their totient function. It then chooses an encryption exponent e that is relatively prime to φ(n) and finds the decryption exponent d which satisfies de ≡ 1 (mod φ(n)). 2) How encryption works by computing the ciphertext c as c = me mod n using the public key (n, e) and a message m. Decryption computes

Uploaded by

thh42th
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
127 views3 pages

Tutorial On Public Key Cryptography - RSA

The document describes the RSA key generation process and provides an example. It also describes how RSA encryption and decryption works using the generated public and private keys. Specifically, it shows: 1) How to generate the public and private keys by first choosing two prime numbers p and q, then computing n as their product and φ(n) as their totient function. It then chooses an encryption exponent e that is relatively prime to φ(n) and finds the decryption exponent d which satisfies de ≡ 1 (mod φ(n)). 2) How encryption works by computing the ciphertext c as c = me mod n using the public key (n, e) and a message m. Decryption computes

Uploaded by

thh42th
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

RSA – the Key Generation – Example

1. Randomly choose two prime numbers p and q.


We choose p = 11 and q = 13.

2. Compute n = pq.
We compute n = pq = 11 · 13 = 143.
Tutorial on Public Key Cryptography – RSA 3. Randomly choose an odd number e in the range 1 < e < ϕ(n) which is

coprime to ϕ(n) (i.e., e ∈ Zϕ(n) ).
ϕ(n) = ϕ(p) · ϕ(q) = 10 · 12 = 120.

Thus, we choose e = 7 (e ∈ Z120 ).

4. Compute d ≡ e−1 (mod ϕ(n)) by Euclid’s algorithm. Thus, de ≡ 1


(mod ϕ(n)).
We compute d ≡ e−1 ≡ 7−1 ≡ 103 (mod ϕ(143) = 120).
Check that 120|7 ∗ 103 − 1 = 721 − 1 = 720.

c Eli Biham - November 5, 2006


383 Tutorial on Public Key Cryptography – RSA (14) c Eli Biham - November 5, 2006
384 Tutorial on Public Key Cryptography – RSA (14)

RSA – the Key Generation – Example (cont.) RSA – Encryption/Decryption – Example


5. Publish (n, e) as the public key, and keep d secret as the secret key. The encryption algorithm E:
We publish (n, e) = (143, 7) as the public key, and keeps d = 103 secret Everybody can encrypt messages m (0 ≤ m < nA) to user A by
as the secret key.
c = EA(m) = meA mod nA.

The ciphertext c (0 ≤ c < nA) can be sent to A, and only A can decrypt.
Encrypt m = 3:

EA(m) ≡ meA ≡ 37 ≡ 42 (mod 143)

c Eli Biham - November 5, 2006


385 Tutorial on Public Key Cryptography – RSA (14) c Eli Biham - November 5, 2006
386 Tutorial on Public Key Cryptography – RSA (14)

RSA – Encryption/Decryption – Example (cont.) Existential Forgery of an RSA Signature


The decryption algorithm D: Given a public key (nA, eA) of user A, can another user B create a message m
Only A knows his secret key dA and can decrypt: and a signature DA(m) ≡ mdA (mod nA)?
User B can forge a signature in the following way:
m = DA(c) = cdA mod nA.
B Chooses y ∈ Zn and calculates x ≡ EA(y) = y eA (mod nA).
Now B can claim that y ≡ xdA (mod nA) is A’s signature on x.
Decrypt c = 42:

DA(c) ≡ cdA ≡ 42103 ≡ 3 (mod 143)

Decrypt c = 2:
DA(c) ≡ cdA ≡ 2103 ≡ 63 (mod 143)

c Eli Biham - November 5, 2006


387 Tutorial on Public Key Cryptography – RSA (14) c Eli Biham - November 5, 2006
388 Tutorial on Public Key Cryptography – RSA (14)

Multiplication Property of RSA Random Self Reducibility of RSA


Multiplication Property: Problem:
Given a public key (nA, eA) of user A, and m1, m2 ∈ Zn then Given a public key (nA, eA) of user A:
Assume we are given an algorithm, called ALG, which given EA(m) ≡ meA
EA(m1 · m2 ) ≡ EA(m1) · EA(m2) (mod n) 1
(mod nA) can find the message m for 100 of the possible cryptograms.
Proof: Show a polynomial random algorithm which given EA(m) ≡ meA (mod nA)
EA(m1) ≡ me1A (mod nA) finds the message m with probability ≥ 12 for every cryptogram in Zn∗A .
EA(m2) ≡ me2A (mod nA)
and,

EA(m1 · m2) ≡ (m1 · m2)eA ≡ me1A · me2A ≡ EA(m1) · EA(m2) (mod nA)

QED

c Eli Biham - November 5, 2006


389 Tutorial on Public Key Cryptography – RSA (14) c Eli Biham - November 5, 2006
390 Tutorial on Public Key Cryptography – RSA (14)
Random Self Reducibility of RSA (cont.) Random Self Reducibility of RSA (cont.)
The Algorithm: Correctness:
Make t iterations of the following: If algorithm ALG succeeds, i.e., outputs x such that

1. Randomly Choose z ∈ Zn∗A . xeA ≡ (mz)eA ≡ meA · z eA (mod nA)


−1
2. Calculate z eA
(mod na). Then, m ≡ x · z (mod nA).

3. Let x = ALG(meA z eA (mod nA)). For z ∈ Zn∗


{z · x : x ∈ Zn} = z · Zn = Zn
4. If xeA ≡ meA z eA (mod nA) then output x · z −1 (mod nA) and finish.
because if for x1, x2 we have:

z · x1 ≡ z · x2 (mod n)

which implies

x1 ≡ z −1 · z · x1 ≡ z −1 · z · x2 ≡ x2 (mod n)

c Eli Biham - November 5, 2006


391 Tutorial on Public Key Cryptography – RSA (14) c Eli Biham - November 5, 2006
392 Tutorial on Public Key Cryptography – RSA (14)

Random Self Reducibility of RSA (cont.) Random Self Reducibility of RSA (cont.)
1 Note:
Thus, for every iteration we have 100 probability of success, thus in order to
find m with probability ≥ 12 , t must satisfy: Let p be a prime and g be a generator of Zp∗ .
 t
99  1 Thus, for a ∈ Zp∗ there exists z such that g z ≡ a (mod p). This z is called the

  ≤ discrete logarithm or index of a, modulo p, to the base of g. We denote
100  2

99 1 this value as indp,g (a) or DLOGp,g (a).
t log   ≤ log
100 2 DLOG is also random self reducible given a generator g of Zp∗ .
Thus, t ≥ 69 suffices.

Note: Can we find the message when EA(m) 6∈ Zn∗A ?


When the cryptogram EA(m) 6∈ Zn∗ , we can find either p or q. Thus, we can
find d and then m.

c Eli Biham - November 5, 2006


393 Tutorial on Public Key Cryptography – RSA (14) c Eli Biham - November 5, 2006
394 Tutorial on Public Key Cryptography – RSA (14)

Blind Signatures Blind Signatures using RSA


Usually when we sign a document we check its contents. Can Bob, with a public key (n, e), sign a message m (actually signs H(m))
But we might want people to sign documents without ever seeing them. without knowing its contents?

For example, Bob is a notary. Alice wants him to sign a document, but does Yes.
not want him to have any idea what he is signing. Bob doesn’t care what the We choose a random α ∈ Zn∗ and then ask Bob to sign
document says, he is just certifying that he notarized it at a certain time.
E(α) · m ≡ αe · m (mod n)
1. Alice takes the document and uses a “blinding factor”. we get:
2. Alice sends the blinded document to Bob. D(E(α) · m) ≡ (E(α) · m)d ≡ (αe · m)d ≡ α · md (mod n)
3. Bob signs the blinded document. −1
thus we need only to calculate α (mod n):
4. Alice computes the signature on the original document.
md ≡ α−1 · D(E(α) · m) (mod n)

Note that the function f (x) ≡ xe (mod n) is a permutation of Zn. Moreover,


if α ∈ Zn∗ then αe ∈ Zn∗ .
c Eli Biham - November 5, 2006
395 Tutorial on Public Key Cryptography – RSA (14) c Eli Biham - November 5, 2006
396 Tutorial on Public Key Cryptography – RSA (14)

An Example of Using Blind Signatures An Example of Using Blind Signatures (cont.)


Problem 1: Problem 2:
Alice wants a virtual 100 dollar note. The bank can trace this check to Alice.
Solution 1: Solution 2:
Alice goes to the bank and asks for such a note. The bank gives Alice a signature Use a blind signature.
on a virtual 100 dollar check. The bank signs a check m by using a blind signature:
Denote the bank’s public key by (n, e) and its secret key by d. Alice wants to get md. Thus, Alice chooses a random α ∈ Zn∗ and then asks
the bank to sign:
E(α) · m ≡ αe · m (mod n)
now Alice needs only to calculate α−1 (mod n):
d −1
m ≡α · D(E(α) · m) (mod n)

c Eli Biham - November 5, 2006


397 Tutorial on Public Key Cryptography – RSA (14) † c Eli Biham - November 5, 2006
398 Tutorial on Public Key Cryptography – RSA (14)
An Example of Using Blind Signatures (cont.) An Example of Using Blind Signatures (cont.)
Problem 3: Assume Alice tries to cheat by using one check mj which is worth a million
Alice can trick the bank into giving her a check worth more than 100 dollars. dollars.

Solution 3: If the bank does not ask for αj then Alice gets million dollars. On the other
hand, if the bank does ask for αj , giving it the real αj exposes her deceit.
• Alice prepares 100 versions of the check m1, . . . , m100. Alice would prefer to reveal βj such that

• Alice chooses random α1, . . . , α100 ∈ Zn∗ at random. m′j ≡ yj · βj−e (mod n)

• Alice gives yi = αie · mi (mod n) to the bank. where m′j is a check on 100 dollars.

• The bank asks Alice to reveal 99 of the α’s. Denote the remaining α by yj ≡ mj · αje = m′j · βje (mod n)
αk .
thus,
• The bank signs yk . βje ≡ αje · mj · m′−1
j (mod n)
• Alice calculates m ≡ d
αk−1 · (αke · m) d
(mod n). or
βj ≡ αj · mdj · m′−d
j (mod n)
Which means we can find (mj · m′−1 d
j ) .

c Eli Biham - November 5, 2006


399 Tutorial on Public Key Cryptography – RSA (14) c Eli Biham - November 5, 2006
400 Tutorial on Public Key Cryptography – RSA (14)

An Example of Using Blind Signatures (cont.) Examples


Another approach:: Question:
The bank will use different public keys for different bill values, i.e., the bank We are given the following implementation of RSA:
will use (e100, n100) for 100 dollar bills, (e20, n20) for 20 dollar bills, etc. A trusted center chooses p and q, and publishes n = pq. Then, n is used by all
For a bill to be valid, it must be formatted like m =“This is a 100 dollar bill, the users.
serial number: x”, where the serial number is a very long random chosen by He gives the i’th user a private key di and a public key ei, such that ∀i6=j ei 6= ej .
Alice, and the bill must be signed using the appropriate public key.

Show that if two users, i and j, for which gcd(ei, ej ) = 1, receive the same
message m, it is possible to reconstruct m by using n, ei, ej , mei , mej .
Solution:
gcd(ei, ej ) = 1 ⇒ ∃x, y xei + yej = 1
Thus,
(mei )x · (mej )y ≡ mxei+yej ≡ m (mod n)

Exercise: Show that even one user can reconstruct a message m without
cooperation of any other user.
c Eli Biham - November 5, 2006
401 Tutorial on Public Key Cryptography – RSA (14) c Eli Biham - November 5, 2006
402 Tutorial on Public Key Cryptography – RSA (14)

Examples (cont.) Examples (cont.)


Question: Solution:
Let p and q be prime, n = pq. Denote ℓ = lcm(p − 1, q − 1). Thus,
Alice wishes to send messages to Bob using the RSA cryptosystem. Unwisely
mℓ+1 ≡ ma(p−1)+1 ≡ 1a · m = m (mod p)
she does not choose her own keys, but allows Eve to choose them for her. The
only precaution that Alice takes is to check that e 6= 1 (mod ϕ(n)).
and
Show that Eve can still choose a pair of keys e, d such that encryption and mℓ+1 ≡ mb(q−1)+1 ≡ 1b · m = m (mod q)
decryption can be accomplished, but me ≡ m (mod n), for every m ∈ Zn∗ .
thus by the Chinese reminder theorem

mℓ+1 ≡ m (mod n).

c Eli Biham - November 5, 2006


403 Tutorial on Public Key Cryptography – RSA (14) c Eli Biham - November 5, 2006
404 Tutorial on Public Key Cryptography – RSA (14)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy