Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
3 views12 pages

04 - Encryption Algorithms

The document discusses public key cryptography algorithms, focusing on RSA and Diffie-Hellman. It details the RSA algorithm's process for generating public and private keys using large prime numbers and provides examples of its implementation. Additionally, it explains the Diffie-Hellman key exchange method for securely sharing secret keys between two users.

Uploaded by

Afaq
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)
3 views12 pages

04 - Encryption Algorithms

The document discusses public key cryptography algorithms, focusing on RSA and Diffie-Hellman. It details the RSA algorithm's process for generating public and private keys using large prime numbers and provides examples of its implementation. Additionally, it explains the Diffie-Hellman key exchange method for securely sharing secret keys between two users.

Uploaded by

Afaq
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/ 12

PUBLIC KEY CRYPTOGRAPHY ALGORITHMS

 Rivest Shamir Adleman (RSA)


 Diffie-hellman

 Digital Signature Standard (DSA)

 Eliptic-Curve Cryptography (ECC)

 Most Widely used algorithms are RSA and


Diffie-Hellman.
RSA Public-key Encryption Algorithm
“It is not what it is, but what it seems to be”
W. Shakespeare
• The RSA algorithm was invented by Rivest, Shamir and
Adleman in 1977.

1. Let p and q be two distinct large random primes. The


modulus n is the product of these two primes, n=pq
Euler’s function of n is given by
(n)=(p-1)(q-1)
Now, let us select a number 1<e< (n) such that
gcd(e, (n))=1
and compute d with
d=e-1(mod (n))
using the extended Euclid's algorithm. Under this scheme, e
is the public exponent and d is the private exponent.
Usually, one selects a small public exponent (e.g., e=216+1).
• The modulus n and the public exponent e are published.
The value of d and the prime numbers p and q are kept
secret.
RSA Algorithm
RSA Example
1. Select two primes, p = 17 and q = 11
2. Calculate n = pq = 17  11 = 187
3. Calculate (n) = (p-1)(q-1) = 16  10 = 160
4. Select e s.t. e is relatively prime to (n) and less than (n); in
this case, e = 7
5. Determine d s.t. de  1 mod 160 and d < 160. The correct value
is d = 23 (7  23 = 161 = 160 + 1)
6. PU = {7, 187}, PR = {23, 187}
RSA 2ND EXAMPLE

M
C M
e d

5
DIFFIE-HELLMAN KEY EXCHANGE

 A number of commercial products employ this


key exchange technique.
 The purpose of this algorithm is to enable two
users to exchange a secret key securely that
can be used for subsequent encryption of
messages.
 The algorithm itself is limited to the exchange
of the keys.
ALGORITHM

 Public Key Technique for exchanging secret


keys
 The secret key is calculated by both parties

 Requires some global public elements

 Based on difficulty in solving for x:

 a = b x mod c

 a, b, c know n
ALGORITHM

 q and α are global public values


 User A :
 C hoose private key : X A < q
 C alculate public key: Y A = αX A mod q

 User B:
 C hoose private key : X B < q
 C alculate public key : Y B =αX B mod q
ALGORITHM
Calculation of Secret Key
 User A knows private X A & public Y B
K = Y B X A mod q
 User B knows private X B & public Y A
K = Y A X B mod q

Proof
 YAXB mod q= (αX A mod q)X B mod q
= αX A X B mod q by mod arithmetic rules
= αX B X A mod q
= (αX B mod q) X A mod q
= Y B X A mod q
1. Alice and Bob agree on q = 23 and α = 5.
2 Alice chooses X A = 6 and sends 56mod 23 = 8.
3 Bob chooses X B = 15 and sends 515mod 23 = 19.
4 Alice computes 196mod 23 = 2.
5 Bob computes 815 mod 23 = 2.

Then 2 is the shared secret.


Clearly, much larger values of X A , X B , and q are required. An eavesdropper
cannot discover this value even if she knows q and α and can obtain each of
the messages.
EXERCISE

 Find the secret key if


 q=11, α =2, xA = 9, xB = 4.
 So yA = 2xA = 29 (mod 11).
 yA = 6.

 Similary, 2xB = 24 = 16= 5 (mod 11), so yB = 5

 . K= 59 (mod 11). Which is K=9 mod 11

 K=64 (mod 11) which is k=9 mod 11

You might also like