Sie sind auf Seite 1von 3

Public Key Cryptography : nrich.maths.

org

http://nrich.maths.org/2200

Copyright University of Cambridge. All rights reserved.

Public Key Cryptography


Stage: 5 Article by Toni Beardon

The idea of Public Key Cryptography is to send messages in such a way that only the person who receives them can understand them even if the method of encryption is discovered by 'an enemy' who intercepts the messages. The person who sends the message encodes it; the person who receives the message decodes it (puts it back into a readable form). Public Key Cryptography was discovered (or invented?) by R. Rivest, A. Shamir and L.Adleman about 1970. This method has been widely used to ensure security and secrecy in electronic communication and particularly where financial transactions are involved. The method depends on the fact that while it is easy to calculate the product of two large prime numbers (particularly with the help of a computer) it is, for all practical purposes, impossible to find the factors of a large number if it has only very large prime factors. This is because all methods of finding such factors would take many many thousands of years by even the fastest modern computers. In order to understand this article you need to know that two numbers are said to be congruent in modulus arithmetic if their difference is divisible by the modulus. For example 23 is congruent to 2 modulus 7 because the difference between 2 and 23 is divisible by 7. Another way of expressing this is to say a b (mod m) if and only if a = pm + b where p is an integer. Everything else you need to know is explained in the article. The Basic Idea Bob wants to receive a coded message from Alice EVERYBODY knows how to write the message in code. Bob is the ONLY person who knows how to decode the coded message. The idea is that Bob chooses two (very large) prime numbers p and q, and then writes n Then n is used to code the message, but p and q are needed to decode the message.

= pq.

The Details 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 (mod m) 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. r Alice finds M c , where M c M (mod n), and sends the message M c to Bob. Bob receives the message M c from Alice and decodes it. Now Bob knows p, q, m, n, r, s, and he uses these to decode the message M c from Alice so as s to find M . To do this Bob uses the theorem that (M c ) M (mod n)

1 of 3

07/07/2013 10:38 AM

Public Key Cryptography : nrich.maths.org

http://nrich.maths.org/2200

In the following example we use small numbers so that you can work through it using a calculator. In practice the numbers would be very big. An example (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. = 391 and r = 3. = 180.

(3) Bob then tells Alice that n

(4) Note: It does not matter how many people have this information, they still won't be able to find (5) Alice computes M c and finds that M c

(5) Bob receives the coded message 180 from Alice (6) Bob now calculates M find it?

18059 (mod 391), and finds Alice's secret message M . Can you

In order to find Alice's message you may need some help from the following section. Working with modulus arithmetic You need to use the following facts: (1) If a

b (mod n) then ac bc (mod n)


k

(2) If a b (mod n) then ak b The proofs of these results are simple. (1) If a

(mod n).

b (mod n) then n divides a b and if n divides a b then n divides (a b)c = ac bc which is the same as saying ac bc (mod n).
(2) As ak

bk always has a factor a b for all k it follows that if n divides a b then n divides ak bk so if a b (mod n) then ak bk (mod n).

In order to find the secret number that Alice sent to Bob as described above you will need to use the same sort of method as in the following example. Suppose you want to find x where 13 13 (0 x 100) and 17 x (mod 101). As 17 is too large for most calculators to show exactly we start with 17
6

= 24137569 and, first dividing this by 101, we find that 17 = (238985)(101) + 84so we now know that 176 84 (mod 101).The next step is to 13 use this to tackle 17 . 842 17 119952 (mod 101) 119952 = 1187 101 + 65 65 (mod 101).
Hence x

1713 = (176 )2 17

= 65.
s

Finally we prove the theorem that (M c ) coprime, given that \+(i) rs 1 (mod

= M rs M (mod n), where M and n are m) \\ \+(ii) m = lcm [(p 1), (q 1)]\\ \+(iii) n =
07/07/2013 10:38 AM

2 of 3

Public Key Cryptography : nrich.maths.org

http://nrich.maths.org/2200

\\ Proof As M and n are coprime we know that M and p are coprime and M and q are coprime. By Fermat's Little Theorem it follows that

M p1 1 (mod p) M q1 1 (mod q)
j

Also (p 1) and (q

1) divide m so say m = j(p 1) = k(q 1) , then M m = (M p1 ) 1j 1 (mod p).

Similarly

M m = (M q1 ) 1k 1
m

(mod q).
m

So both p and q divide M 1 and, as n = pq, it follows that M 1 (mod n). We know that rs 1 (mod m) so rs = 1 + mt for some integer t. Putting all this together we have

M rs = (M 1 )(M mt ) M

(mod n).

For Further Reading Singh, Simon (1999) 'The Code Book - The Science of Secrecy from Ancient Egypt to Quantum Cryptography', The Fourth Estate, London ISBN 1 85702 879 1 Flannery, Sarah (2000) 'In Code - A Mathematical Journey' Profile Books, ISBN 1 86197 222 9 This is a unique book, written by a teenager, and highly recommended for all young people interested in mathematics.

http://www.cam.ac.uk

Copyright 1997 - 2012. University of Cambridge. All rights reserved. http://nrich.maths.org /public/terms.php NRICH is part of the family of activities in the Millennium Mathematics Project http://mmp.maths.org .

3 of 3

07/07/2013 10:38 AM

Das könnte Ihnen auch gefallen