You are on page 1of 26

Public Key Cryptography

And RSA

BY
VINEETH MATHEW
(1NH02EC059)
Cryptography

•The art of secret message writing.

•Creating texts that can be only read


by authorized individuals .
Cryptographic goals

Confidentiality
Data integrity
Authentication
Non-repudiation
Terminology
 Plaintext: Original intelligible
message
Encryption algorithm: It

performs various
substitutions and
transformations on the plaintext
Key: Is a word that is used to encrypt the plaintext

Ciphertext: Is a scrambled message produced as ou


Decryption algorithm: Opposite of encryption algor



Encryption
Plain-text input Cipher-text
“The quick “AxCv;5bmEseTfid3
brown fox )fGsmWe#4^,sdgfM
jumps over wir3:dkJeTsY8R\s@
the lazy !q3%”
dog”
Encryption
Algorithm

key
Decryption
Cipher-text Plain-text output
“The quick
“AxCv;5bmEseTfid3)f brown fox
GsmWe#4^,sdgfMwir jumps over
3:dkJeTsY8R\s@!q3 the lazy
%” dog”
Decryption
Algorithm

key
Mathematical Notation
P: plaintext
C: ciphertext
K : key
E: encryption function
D: decryption function
C = Ek(P)

P = Dk(C)
Types of Cryptography
Using Keys

• Secret key cryptography: one key


• Public key cryptography: two keys -
public, private
Secret Key Cryptography
Plain-text input Plain-text output
Cipher-text
“The quick “The quick
brown fox “AxCv;5bmEseTfid3)f brown fox
jumps over GsmWe#4^,sdgfMwir jumps over
the lazy 3:dkJeTsY8R\s@!q3 the lazy
dog” %” dog”
Encryption Decryption
Algorithm Algorithm

Same key
(shared secret)
Public Key
Cryptography
Public-Key Cryptography
• 1976: W. Diffie and M.E. Hellman
proposed the first public-key
• public-key/asymmetric cryptography
involves the use of two keys:

a public-key, which may be known by anybody

a private-key, which is kept private


Essential Steps

• Each user generates a pair of keys


• Each user places one key in public
register
Public Key Cryptography
Clear-text Input Cipher-text Clear-text Output
“The quick “The quick
brown fox “Py75c%bn&*)9| brown fox
jumps over fDe^bDFaq#xzjFr@g jumps over
the lazy 5=&nmdFg$5knvMd’r the lazy
dog” kvegMs” dog”
Encryption Decryption
Algorithm Algorithm

Different keys
Public Key Cryptography
Public Key Cryptography
Public Key Cryptography
Public Key Cryptography
•Advantage •Disadvantages

• Solves problem of • Extremely slow


passing the key • Large key size
• Only the private key
must be kept secret
Secret v. Public Keys
Attribute Secret Key Public Key

Current algorithms DES, 3DES, Blowfish RSA, Diffie-Hellman,


DSA

Speed Fast Slow

Keys Only one key Private: kept secret


Public: widely distributed

Key length 56-bit usually 1,024 suggested (RSA)


128-bit considered safe
RSA
Algorithm
RSA
By Rivest, Shamir &Adleman
Best known & widely used
It is based on number theory
The key size ranges between
512 and 2048
The RSA Algorithm– Key
Generation
• Select p,q ; p and q both prime
• Calculate n = p x q
• Calculate Φ (n) = ( p − 1)(q − 1)
• Select integer e gcd(Φ (n), e) = 1; 1 < e < Φ (n)
• Calculate d d = e −1 mod Φ( n)
• Public Key KU = {e,n}
• Private key KR = d
The RSA Algorithm –

Encryption
•Plaintext: M<n
•Ciphertext: C = Me (mod n)
Decryption
•Ciphertext: C
•Plaintext: M = Cd (mod n)
RSA Example
• Select primes: p=17 & q=11
• Compute n = p*q =17×11=187
• Compute ø(n)=(p–1)(q-1)= 16×10=160
• Select e : gcd(e,160)=1; e=7
5 Compute d = e-1 mod φ(n) = 7 -1mod 160
=23
6. Publish public key KU={7,187}
7. Keep secret private key KR= 23
RSA Example

given message M = 88 (ie. 88<187)

Encryption
C = 887 mod 187 = 11 C = Me (mod n)
Decryption
M = 1123 mod 187 = 88 M = Cd (mod n)
Biblography

Cryptography And Network Security


-William Stallings

Applied Cryptography
- Bruce Schneier
THANK YOU