11.07.2015 Views

Cryptography - Sage

Cryptography - Sage

Cryptography - Sage

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Man in the Middle AttackThe man-in-the-middle attack is a protocol for an eavesdropper E to intercept a messageexchange between A and B. The attack is premised on a Diffie-Hellman key exchange, butthe principle applied to any public key cryptosystem for which the keys used for public keyexchange is not certified with a cerification authority.We assume that A and B have agreed on a prime p and a primitive element a of Z/pZ, andthat E is positioned between A and B. Having observed this Diffie-Hellman initializationE prepares for the man-in-the-middle attack.1. A chooses a secret key x, creates a public key a x , and sends it to B, which is interceptedby E.2. E chooses a private integer z at random, and creates the alternative public key a zwhich she sends to B, pretending to be A. At the same time she sends same key a z to A,now posing as B.3. Now E has established a common session key a xz with A and common session keya yz with B. Message exchanges between A and B pass through E and can be deciphered,read, modified, re-enciphered, and resent in transit.The breakdown of the key exchange protocol is due to lack of identity authentication ofthe communicating parties. If, for instance the public key (a, a x , p) of A could be confirmedwith an independent certification authority, then B would not have confused E with A.ExercisesThe RSA cryptosystem is based on the difficulty of factoring large integers into its compositeprimes.Based on Fermat’s little theorem, we know that a m ≡ 1 mod p exactly when p−1 dividesm. Therefore we recover the identity a u ≡ a mod p where u is of the form 1 + (p − 1)r.Now given any e such that e and p − 1 have no common divisors, there exists a d such thated ≡ 1 mod p − 1. In other words, u = ed is of the form 1 + (p − 1)r. This means that themapa ↦→ a e mod pfollowed bya e mod p ↦→ (a e mod p) d mod p ≡ a ed mod p = a mod pare inverse maps. This only works for a prime p.Exercise 8.1 Use SAGE to find a large prime p and to compute inverse exponentiationpairs e and d. The following functions are of use:Diffie–Hellman 75

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!