Está en la página 1de 12

Public Key Cryptography

Nor Shahida Seberi Siti Fatimah Saad T4MT1

Cryptography
The art of protecting information by transforming 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.

Types of encryptions

Symmetric encryption

Asymmetric encryption

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

Asymmetric encryption
Also known as public key encryption Invented in 1976 by Whitfield Diffie and Martin Hellman. 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 program is Pretty Good Privacy (PGP)

Diffie-Hellman Example
Block cipher Block size of 7 bits. Possible 27 combinations Private key (a1, a2, , an) 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 * ai mod m: (901, 568, 803, 39, 450, 645, 1173) Partition SECRET into 7 bit blocks each block consisting of xn bits (x1, x2, , xn)

S E C R E T 1010011 1000101 1000011 1010010 1000101 1010100


Bx =
i=1

xiai

S = 1 X (901) + 0 X (568) + 1 X (803) + 0 X (39) + 0 X (450) + 1 X (645) + 1 X (1173) S = 3522

Diffie-Hellman Example
Encrypted blocks Bx received. Special version of subset-sum problem Which subset of (a1, a2, , an) sums to Bx where Bx = Bx * w-1 mod m w-1 is the modular inverse of w for m, w * w-1 mod m = 1

Bx = 3522 X (901)-1 mod 1234 Bx = 3522 X 1171 mod 1234 Bx = 234


1. sum 0 2. for i = n step -1 until 1 do if ai + sum <= Bx then sum sum + ai; subset(i) 1 else subset(i) 0 3. if sum = Bx then exit with subset else exit with failure

Private key (1, 2, 5, 11, 32, 87, 141), Bx = 234, find subset (1, 0, 1, 0, 0, 1, 1) = S

RSA
Developed by Ron Rivest, Adi Shamir, and Leonard Adleman at MIT in 1977. Based on the difficulty of factoring large numbers

Example
Bob chooses two very large (distinct) prime numbers p and q; n=pq, m= lcm {p1, q1} (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 rs1(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 McMr(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)sM(modn)

(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 to find s. (5) Alice computes Mc and finds that Mc=180. (5) Bob receives the coded message 180 from Alice (6) Bob now calculates M18059(mod391), and finds Alice's secret message M.

También podría gustarte