You are on page 1of 16

SWE3002 – Information and

System Security
Module 3
MODULE –3: Public Key Crypto Systems

Number theory fundamentals


Principles of public key crypto systems
RSA algorithm
Diffie Hellman Key exchange
Public key cryptography

 Public key cryptography or asymmetric cryptography is


a cryptographic system that uses pairs of keys.
 Public keys which may be disseminated widely and
private keys which are known only to the owner.
 In such a system, any person can encrypt a message
using the receiver’s public key, but that encrypted
message can only be decrypted with the receiver’s
private key.
RSA algorithm
 RSA (Rivest Shamir Adleman) is an algorithm used to
encrypt and decrypt messages.
 This algorithm was developed in 1977.
 It is an asymmetric cryptographic algorithm .
 This is also called public key cryptography because one
of the keys can be given to anyone.
RSA algorithm
RSA algorithm
Example
 User A wants to send a number 4 to User B
 Select two prime numbers p = 3, q = 11
 n = p * q = 3 * 11 = 33
 ø(n) = 2 * 10 = 20
 Public key generation
 Select a number e such that e is 1 < ø(n) and gcd(e,
ø(n)) = 1
 Let e = 13, such that gcd(13,20) = 1
 The public key is {e,n} = {13,33}
Example
 Private key generation
 Find a number d such that 1 = 7 -1 * 6
e * d mod ø(n) = 1 = 7 – 1(13 -1*7)
 d is modular multiplicative = 2 * 7 -1 * 13
inverse = 2 (20 -1*13) -1 *13
 13d mod 20 = 1 = 2 * 20 -3 *13
 20 = 1* 13 + 7 = -3 + 20 = 17
Private key = {17,33}
 13 = 1 *7 + 6
7 = 1 * 6 + 1

Example
 User A know the public key {13,33}
 Important p < n ie 4 < 33
 Cipher text = 413 mod 33
 (43)4 * 4 mod 33
 (31)4 * 4 mod 33
 (-2)4 * 4 mod 33
 64 mod 33 = 31
 User A sends cipher text 31 to User B
Example
 User B decrypt the message using private key { 17,33}
 Plaintext = 31 17 mod 33
 ((-2) 5)3 * 22 mod 33
 -((2) 5)3 * 22 mod 33
 -(-1)3 * 22 mod 33
4
Exercises
 Perform the encryption and decryption using RSA
algorithm for the following data
 1. p = 3 q = 11 e = 7 m = 5
 2. p = 5 q = 11 e = 3 m = 9
 3. p = 7 q = 11 e = 17 m = 8
 4. p = 11 q = 13 e = 11 m = 7
 5. p = 17 q = 31 e = 7 m = 2
Exercise
In public key system using RSA, you intercept
the cipher text C = 10 sent to a user whose
public key e = 5 n = 35 What is the plain text?
Exercise
 In public key system using RSA, you intercept the cipher
text C = 20 sent to a user whose public key e = 13 n = 77
What is the plain text?
Efficient encryption

However, with a very small public key, such


as e = 3, RSA becomes vulnerable to a
simple attack.
During key generation the user selects a
value of e that is relatively prime to ø (n).
Thus, if a value if e is selected first, and the
primes p and q are generated, it may turn
out that gcd(ø(n), e) /= 1.
In that case, the user must reject the p, q
values and generate a new p, q pair.
Efficient decryption
 We cannot similarly choose a small constant value of d
for efficient operation.
 A small value of d is vulnerable to a brute-force attack
and to other forms of cryptanalysis [WIEN90].
 However, there is a way to speed up computation using
the Chinese Remainder Theorem (CRT) to compute mod
p & q separately, and then combine results to get the
desired answer.
 This is approx 4 times faster than calculating “Cd mod n”
directly. Note that only the owner of the private key
details (who knows the values of p & q)
RSA Security

brute force key search - infeasible given size of


numbers
mathematical attacks - based on difficulty of
computing ø(n), by factoring modulus n
timing attacks - on running of decryption
chosen ciphertext attacks - given properties of
RSA

You might also like