0% found this document useful (0 votes)
51 views15 pages

RSA Cryptography: Public Key Encryption Algorithm

RSA involves a public key and a private key for encryption and decryption. The public key can encrypt messages, and only the private key can decrypt them. RSA generates the keys by choosing two random prime numbers to compute n, then selecting a number e that is relatively prime to φ(n). The private key exponent d is calculated such that d*e is congruent to 1 modulo φ(n). Encryption uses the public key to encrypt messages and decryption uses the private key to decrypt ciphertexts. The security of RSA relies on the difficulty of factoring the product of the two large prime numbers.
Copyright
© © All Rights Reserved
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)
51 views15 pages

RSA Cryptography: Public Key Encryption Algorithm

RSA involves a public key and a private key for encryption and decryption. The public key can encrypt messages, and only the private key can decrypt them. RSA generates the keys by choosing two random prime numbers to compute n, then selecting a number e that is relatively prime to φ(n). The private key exponent d is calculated such that d*e is congruent to 1 modulo φ(n). Encryption uses the public key to encrypt messages and decryption uses the private key to decrypt ciphertexts. The security of RSA relies on the difficulty of factoring the product of the two large prime numbers.
Copyright
© © All Rights Reserved
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/ 15

RSA

Cryptograp
hy
Public Key E
ncryption A
lgorithm
What is it?
1. RSA – Rivest, Shamir,
Adleman

2. Algorithm for public key


cryptography. Public-key
cryptography refers to a
cryptographic system
requiring two separate keys,
one to lock or encrypt the
plaintext and one to unlock
or decrypt the cypher text.

3. Wildly used in e-commerce

4. Involves 3 steps – key


generation, encryption and
decryption
RSA involves a public key and a private key. The public
key can be known to everyone and is used for
encrypting messages. Messages encrypted with the
public key can only be decrypted using the private key.
The keys for the RSA algorithm are generated the
following way:
Key Generation
0 Two large distinct prime numbers p and q, chosen at random

0 Block B of text has been encoded by some function g into an integer T such that T
is an integer and 0 < T < n (Calculate n=pq, where n is the mod of p and q)

0 Compute the Euler phi function. φ(n) = (p – 1)(q – 1) because n is the product of
2 primes.

0 Choose an integer e such that 1 < e < φ(n) and


gcd(e,φ(n)) = 1 (e and φ(n) are co-prime)

0 gcd(e,φ(n)) = 1 means that 1 is a linear combination of e and φ(n):


Use Euclidean algorithm to find unique value for d and such that 1 < d < φ(n)

d * e = 1 modφ(n) therefore, d = e -1 (mod φ(n) )

0 Public key is pair of values (e,n).

0 Private key is pair values (d,n)


Example 1
0 Select 2 prime numbers p=17, q=13

0 Calculate n = pq = 17x13 = 221

0 Calculate φ(n) = (p – 1)(q – 1) = 16x12 = 192

0 Select e such that e is relatively prime to φ(n) = 192


and less than φ(n) ; we choose e = 11
0 1<e< φ(n) and gcd(e, φ(n) )=1
Example 1 cont’d
0 So n = 221, φ(n) = 192, e = 11

0 Determine d such that de = 1(mod 221) and d<221 using extended


Euclidean algorithm (pg 273) with 11 and 192 (gcd(192, 11)).
192 = (17 * 11) + 5 or 5 = 192 – (17 * 11)
11 = (2 * 5) + 1 or 1 = 11 – (2 * 5)
5 = (5 * 1) + 0
from which
1 = 11 – 2 * 5
= 11 – 2[192 – 17 * 11]
= 35 * 11 – 2 * 192
Therefore, d = 35
0 d=e-1 mod φ(n)
⇒ d.e mod φ(n) =1
So n = 221, φ(n) = 192, e = 11
d.11 mod 192 =1 φ(n) φ(n) +1 φ(n) +1/e
192 193 193/11= 17.
Therefore, d = 35 54545
192+192= 385 385/11= 35
384
384+ 192= 573 573/11=
576 52.0909
Encryption
Plaintext : M < n
Cipher Text: C = M e (mod n)

Decryption
Cipher Text : C
Plaintext : M = C d (mod n)
Example 1 Cont’d
Encrypt:
Plaintext : Let M = 8 < n
Cipher Text: C = M e (mod n) = 8 11 (mod 221)

= 83 * 83 * 83 * 82 mod 221
= 512 * 512 * 512 * 64 mod 221
=70 * 70 * 70 * 64 mod 221
= 4900 * 4480 mod 221
= 38 * 60 mod 221
= 2280 mod 221
= 70
Computational Aspects
0 Exponentiation in Modular Arithmetic:
[(a mod n) x (b mod n)]mod n = ( a x b ) mod n

X16 = X1 x X2 x X3 x … x X15

x11 = x1+2+8 = (x)(x2)(x8)


Example 1 Cont’d
Decrypt:
Cipher Text : C = 70
Plaintext : T = C d (mod n) = 70 35 (mod 221)

= (702)17 * 70 mod 221 = (4900)17 * 70 mod 221


= 3817 * 70 mod 221 = (382)8 * 38 * 70 mod 221
= (1444)8 * 38 * 70 mod 221 = (118)8 * 38 * 70 mod 221
= (1182)4 * 38 * 70 mod 221 = (13924) 4 * 38 * 70 mod 221
= 14 * 38 * 70 mod 221 = 2660 mod 221
=8
Example 2
0 In a public key system using RSA, you interpret the
ciphertext C=10 sent to a use whose public key is e =
5, n = 35. What is the plaintext M?
The Security of RSA
Four approaches to attacking the RSA Algorithm are:
0 Brute Force – trying all possible keys (small value of d
is vulnerable to this)
0 Mathematical Attacks – factoring the product of 2
primes (p and q should only differ in length by a few
digits)
0 Timing Attacks – Depend on running time of
algorithms
0 Chosen Ciphertext attacks – exploits properties of RSA
system

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