Public Key Cryptography Nor Shahida Seberi Siti Fatimah Saad T4MT1
7/27/2019 Public Key Cryptography MO03
http://slidepdf.com/reader/full/public-key-cryptography-mo03 1/12
Public Key Cryptography
Nor Shahida Seberi
Siti Fatimah SaadT4MT1
7/27/2019 Public Key Cryptography MO03
http://slidepdf.com/reader/full/public-key-cryptography-mo03 2/12
Cryptography
• The art of protecting information bytransforming it (encrypting it) into an
unreadable format, called cipher text.
• Only those who possess a secret key can
decipher (or decrypt ) the message into plain
text.
7/27/2019 Public Key Cryptography MO03
http://slidepdf.com/reader/full/public-key-cryptography-mo03 3/12
Types of
encryptions
Symmetricencryption Asymmetricencryption
7/27/2019 Public Key Cryptography MO03
http://slidepdf.com/reader/full/public-key-cryptography-mo03 4/12
Symmetric encryption
• The same key is used to encrypt and decrypt
the message.
• Example:
k = 4
Turn plain text SECRET into cipher text
S+4=W, E+4=I, C+4=G, R+4=V, E+4=I, T+4=X
7/27/2019 Public Key Cryptography MO03
http://slidepdf.com/reader/full/public-key-cryptography-mo03 5/12
Asymmetric encryption
• Also known as public key encryption
• Invented in 1976 by Whitfield Diffie and MartinHellman.
• it uses two keys
public key, k
private key, k’
• Private key not required for both parties
• The system is extremely secure
• One very popular public-key encryption programis Pretty Good Privacy (PGP)
7/27/2019 Public Key Cryptography MO03
http://slidepdf.com/reader/full/public-key-cryptography-mo03 6/12
7/27/2019 Public Key Cryptography MO03
http://slidepdf.com/reader/full/public-key-cryptography-mo03 7/12
Diffie-Hellman Example
• Block cipher• Block size of 7 bits. Possible 27 combinations
• Private key (a’1, a’2, … , a’n) of 7 integers: (1, 2, 5, 11, 32, 87, 141)
• Chose two special integers, w and m, such that w and m are relatively prime,meaning gcd(w ,m) = 1: w = 901, m = 1234
• Public key (a1, a2, … , an) of 7 integers using the equation: ai = w * a’i mod m:(901, 568, 803, 39, 450, 645, 1173)
• Partition SECRET into 7 bit blocks each block consisting of xn bits ( x 1, x 2, …, x n)
S1010011
E1000101
C1000011
R 1010010
E1000101
T1010100
• B x = ∑ x iai i=1
n
• S = 1 X (901) + 0 X (568) + 1 X (803) + 0 X (39) + 0 X (450) + 1 X (645) + 1 X (1173)
• S = 3522
7/27/2019 Public Key Cryptography MO03
http://slidepdf.com/reader/full/public-key-cryptography-mo03 8/12
Diffie-Hellman Example
• Encrypted blocks Bx received. Special version of subset-sum problem
• Which subset of (a’1, a’2, … , a’n) sums to B’ x where B’ x = B x * w -1 mod m
• w -1 is the modular inverse of w for m, w * w -1 mod m = 1
• B’ x = 3522 X (901)-1 mod 1234• B’ x = 3522 X 1171 mod 1234• B’ x = 234
1. sum ← 0 2. for i = n step -1 until 1 do
if ai + sum <= B’ x
then sum ← sum + ai;
subset(i)← 1
else subset(i)← 03. if sum = B’ x then exit with subset
else exit with “failure”
• Private key (1, 2, 5, 11, 32, 87, 141), B’ x = 234, find subset (1, 0, 1, 0, 0, 1, 1) = S
7/27/2019 Public Key Cryptography MO03
http://slidepdf.com/reader/full/public-key-cryptography-mo03 9/12
RSA
• Based on the difficulty of factoring
large numbers
• Developed by Ron Rivest, AdiShamir, and Leonard Adleman
at MIT in 1977.
7/27/2019 Public Key Cryptography MO03
http://slidepdf.com/reader/full/public-key-cryptography-mo03 10/12
Example
• Bob chooses two very large (distinct) prime numbers p and q ;
• n= pq , m= lcm { p−1, q −1} (lcm is the least common multiple );• Bob chooses r , where r >1 and r is coprime with m (i.e. r and m have no
factors in common);
• Bob then finds the unique s such that rs≡1(modm)
• Bob now tells everyone what n and r are, but does NOT say what p, q
or s are.
• Alice wants to send the message M (a single number) where M and n
are coprime and 0<M<n.
• Alice finds Mc, where Mc≡Mr (modn), and sends the message Mc to Bob.
• Bob receives the message Mc from Alice and decodes it.• Now Bob knows p,q ,m,n,r ,s, and he uses these to decode the message
Mc from Alice so as to find M. To do this Bob uses the theorem that
(Mc)s≡M(modn)
7/27/2019 Public Key Cryptography MO03
http://slidepdf.com/reader/full/public-key-cryptography-mo03 11/12
(1) Alice wishes to send the message M to Bob
(2) Bob chooses p=17, q=23; so n=391, m=176,
r =3 and s=59.
(3) Bob then tells Alice that n=391 and r =3.
(4) Note: It does not matter how many people
have this information, they still won't be able tofind s.
(5) Alice computes Mc and finds that Mc =180.
(5) Bob receives the coded message 180 from
Alice
(6) Bob now calculates M ≡18059(mod391), and
finds Alice's secret message M .
7/27/2019 Public Key Cryptography MO03
http://slidepdf.com/reader/full/public-key-cryptography-mo03 12/12