You are on page 1of 13

Asymmetric - Key Cryptography

28 March 2022 10:01

Introduction:-

○ In Symmetric Key Cryptography secret key is shared between two


persons.

○ In a community of 'n' people, n(n-1)/2 shared secret keys are needed


for symmetric key cryptography.

○ Symmetric Key Cryptography is also called as private key


cryptography.

○ In Asymmetric key cryptography secret key is unshared(personal) in


between two persons; each person creates his own secret key.

○ In a community on 'n' people, 'n' shared secret keys are needed for
Asymmetric Key Cryptography.

○ Asymmetric Key Cryptography is also called as Public Key


Cryptography, it uses two keys Public Key and Private Key.

3CSE-A CNS Page 1


General Idea Of Asymmetric Key Cryptography:-

Note:-

○ Whenever an application is based on a personal secret, we need to use


Asymmetric Key Cryptography.

○ Symmetric - Key Cryptography is based on Substitution and


Permutation of symbols.

○ Asymmetric - Key Cryptography is based on applying Mathematical


functions to numbers.

Some Of the Differences between Symmetric Key and Asymmetric Key


cryptography:

Symmetric Key Cryptography Asymmetric Key Cryptography


Same Algorithm is used Different Algorithms used
3CSE-A CNS Page 2
Same Algorithm is used Different Algorithms used
Same Key is used Different Keys used
Key is kept Secret Private Key is kept Secret
Faster Slower

The following are the algorithms used in Public Key Cryptography:

1. RSA

2. Robin Crypto System

3. Elgamal Cryptosystem

4. Diffie - Hellman

Before discuss about RSA algorithm we must know about Relative Prime
numbers.

Relatively Prime Numbers:-(Co-Prime Numbers)

○ Two numbers are said to be relatively prime, if they have no prime


factors in common, and their only common factor is 1.
(OR)
Let a and b are two numbers, If GCD(a,b) = 1 then a and b are
relatively prime numbers.

Are 6 and 13 are relative prime?

GCD(6,13) : (here a < b so swap a and b)


GCD(13,6) : GCD(6,13 mod 6) = GCD(6,1)
GCD(6,1) : GCD(1,6 mod 1) = GCD(1,0) = 1

GCD(6,13) = 1.

So, 6 and 13 are relatively prime numbers.

3CSE-A CNS Page 3


Are 83 and 19 are relatively prime numbers?

Are 12 and 17 are relative prime numbers?

RSA CRYPTOSYSTEM :-(Rivest, Shamir, and Adleman)

○ It is a Public Key Cryptography Algorithm. i.e. Encryption is done by


using Public Key and decryption is done by using Private Key.

○ This algorithm is was developed by Ron Rivest, Adi Shamir and


Leonard Adleman at MIT.

○ It is a Block Cipher and its size is not fixed.

○ In this, Palin text and Cipher text are integers between 0 and N-1 for
some 'N'.

○ A typical size for 'n' is 1024 bits, or 309 decimal digits.

Key Generation in RSA algorithm:-

3CSE-A CNS Page 4


Encryptions, decryption and key generation in RSA Algorithm

Solved Examples:-

1) Perform the encryption for the plain text 20 using RSA Algorithm
with the values p=5, q=11 and 13 as the public key.

3CSE-A CNS Page 5


d= 40-3 = 37

2) Perform the encryption for the plain text 88 using RAS Algorithm
with the values p=17, q=11 and e=7.

3) In the RSA Public key Cryptosystem, the private and public keys
are (e, n) and (d, n) respectively, where n = p*q and p and q are
large primes. Let M be an integer such that 0<M<n and f(n) = (p-1)
(q-1). Now consider the following equations.

i) M` = (M)^e mod n// c = p^e mod n


M = (M`)^d mod n // p = c^d mod n

ii) e.d = 1 mod n

iii) e.d = 1 mod f(n)

iv) M` = (M)^e mod f(n)


M = (M`)^d mod f(n)

Which of the above equations are correctly represent RSA


Cryptosystem?
3CSE-A CNS Page 6
Cryptosystem?

1) I and II
2) I and III
3) II and IV
4) III and IV

The working of Robin Cryptosystem is depends on the Chinese


Remainder Theorem.

Chinese Remainder Theorem (CRT):-

The Chinese remainder theorem (CRT) is used to solve a set of congruent


equations with one variable but different moduli, which are relatively
prime, as shown below:

CRT states that the above equations have a unique solution of the moduli
are relatively prime.

We can find out the value of x as follows:

Where

M = m1*m2*m3……..*mk.

M1 = M/m1, M2 = M/m2…….., Mk = M/mk

we can find out M1-1, M2-1,…, Mk-1 by using trial and error method
without using Extended Euclidean algorithm.
3CSE-A CNS Page 7
without using Extended Euclidean algorithm.

M1 * M1-1 = 1 mod m1 i.e. we can find out the value of M1-1 in such a
way that, the remainder is equal to 1 when we calculate (M1 *
M1-1)/m1.

Solve the following example using CRT with set of equations with different moduli:

Applications:-

a. To solve quadratic congruence

b. To represent very large integers in terms of list of small integers.

Rabin Cryptosystem :-

○ Rabin Cryptosystem is introduced by M. Robin.

○ In Rabin Cryptosystem the value of 'e' and 'd' are fixed. i.e. e = 2 and d
= 1/2.

The encryption is C ≡ P2 (mod n) and the decryption is P ≡ C1/2 (mod


3CSE-A CNS Page 8
○ The encryption is C ≡ P2 (mod n) and the decryption is P ≡ C1/2 (mod
n).

○ Public key in Rabin Cryptosystem is 'n' and Private key is tuple (p ,q).
i.e. Sender can encrypt the message using 'n' and Receiver can decrypt
the message using 'p' and 'q'.

Key Generation:-

Encryption:-

Decryption:-

3CSE-A CNS Page 9


Encryption, Decryption and Key Generation in Rabin Cryptosystem

Note :-

○ Rabin Cryptosystem is not deterministic. The decryption has four


answers. It is up to the receiver of the message to choose one of the
four as the final answer.

Example :-
Perform the encryption and decryption for the plain text 24 using Robin
Cryptosystem with the values p=23, q=7.

3CSE-A CNS Page 10


The working of Elgamal Cryptosystem depends on the Primitive Root
concept.

Primitive Root :-

The number 'a' is said to be primitive root of prime number 'p', if a1


mod p, a2 mod p, a3 mod p,……., ap-1 mod p are distinct.

Example :-

Check whether number 2 is primitive root of 5 or not ?

21 mod 5 2 mod 5 2
22 mod 5 4 mod 5 4
23 mod 5 8 mod 5 3
24 mod 5 16 mod 5 1

Here 2, 4, 3 and 1 all are distinct , so 2 is primitive root of 5.

Elgamal Cryptosystem :-

3CSE-A CNS Page 11


○ Elgmal Cryptosystem is introduced by Elgmal in 1985.

Key Generation:-

Encryption:-

Decryption:-

3CSE-A CNS Page 12


Example:-

Here is a trivial example. Bob chooses p = 11 and e1 = 2.


and d = 3 e2 = e1d mod 11= 8. So the public keys are (2, 8, 11) and the private
key is 3. Alice chooses r = 4 and calculates C1 and C2 for the plaintext 7.

Bob receives the ciphertexts (5 and 6) and calculates the plaintext.

3CSE-A CNS Page 13

You might also like