Vous êtes sur la page 1sur 3

Alice Sends a Letter to Bob

Noah Curtis
April 6, 2011

Public-key cryptography could be argued to be one of the most used technologies in the
world that no one knows about. Most of us use it daily as we use any of the numerous
technologically advanced gadgets in our 21st Century life. Nearly every computer in use today
uses some sort of public-key encryption, either internally or through the use of the internet,
which is nearly fundamentally run on the idea of public-key encryption itself. A common,
modern day example is your email. You send a message to someone so that only they can read it
and they reply so that only you can read it; simple enough. Undermining the process though are
sets of methods that create keys, both public and private, that allow users to encrypt and decrypt
messages that are sent and received.
One of the most renowned techniques is called the RSA algorithm. The RSA algorithm is
an algorithm, obviously, that involves three basic operations: key generation, encryption, and
decryption. The process generates two keys, one public and one private. The public-key can be
known by anyone, whereas the private-key is only known by the creator of the keys. The public-
key is used to encrypt a message to be sent to the creator of the key. The private-key is then used
by the keys’ creator to decrypt the message and read it.
A simple way to understand this is to think, Valentine’s Day in 5th grade. Everyone
creates a public box for their classmates to put letters in, but only the person who created the box
can look at the letters. And thus begins the story of how Alice Sent a Letter to Bob.
It was Valentine’s Day in Ms. Prime’s class where she was teaching her students how to
build their encrypted Valentine’s boxes. She quickly reviewed the need for 2 keys and how
they’re used. Ms. Prime then told the class that they would need to choose two distinct prime
numbers, p and q, preferably at random so that it could be kept secret.
The mention of distinct prime numbers caught Bob’s attention. He perked up and
randomly selected two distinct prime numbers using his abacus. He set p=61 and q=53.
Ms. Prime proceeded to explained that pq = n, where n is the modulus for both the public
and private keys. Bob found his n = 61 · 53 = 3233. She then went on to explain that this new
product, n, would be used in the function, φ(n) = (p − 1)(q − 1). Bob used the function and
produced
φ(3233) = (61 − 1)(53 − 1) = 3120. Alice knew the function, φ(n), was Euler’s totient function
and discretely started writing a letter.
Ms. Prime then clarified that the class needed to pick an integer e such that 1 < e < φ(n)
and gcd(e,φ(n)) = 1. So Bob thought to himself..."I need an e such that 1 < e < 3120 and is
coprime to 3120..." Bob let e = 17 and set it aside because e was going to be used as part of the
public-key.
Ms. Prime kept moving along explaining that the class would then determine d = mod
φ(n). Bob scratched his head and thought about it. Alice saw Bob thinking and giggled to herself,
because she knew Bob hadn’t a clue. She knew, she had taken modular arithmetic over the
summer and that she needed to find the multiplicative inverse of e mod φ(n).
Bob figured it out finally and got d = 2753. Bob was all set, he had all his pieces to his
encrypted box. Bob diligently put them together. His public-key was (n = 3233, e = 17) and his
private-key was (n = 3233, d = 2753). Bob quickly stashed his private-key away, while sly’ly
putting his public-key on his desk for everyone in the class to see.
Alice saw Bob put his public-key up and finished writing the note she had been working
on all class long. She then added her signature to the message by encrypting her public-key into
the message. She produced a hash value of the message, Alice and raises it to the d (mod n),

= xo. She attaches the xo to the message for Bob to figure out.
Alice takes Bob’s public-key and figures the encryption function is (mod 3233),
given c = (mod n). Alice pads her secret letter she’s been working on, to the padding scheme

m=65. Alice contrives c = (mod 3233) = 2790. And with that she sends her letter off to
Bob, where it ends up in Bob’s encrypted box.
Bob wakes up from his nap after completing such an arduous project in building his
encrypted box and notices there’s a note in his box. It reads, “c = 2790”. Well rested, Bob
realizes he needs to decrypt it so that he can recover the message from c given his private-key, d
= 2753, which he stashed away. He finds it and computes m = (mod n) such that, m =

(mod 3233) = 65.


Bob notices there is something else, there’s a part that reads after reversing the padding
scheme, “xo -encrypt it”. Bob stops and he thinks, he wasn’t that well rested. After a little
thought though he realizes it is a signature saying who the author of the letter was and that he

needs to raise xo to the power of e mod n, . He does so and finds =


Alice.
The bell rings and the students leave. Ms. Prime starts cleaning up all the imaginary, real,
rational, and irrational numbers strewn all over the place. As she does, so she comes across a
message encoded in an RSA algorithm. Using the Chinese remainder algorithm she reads it :
p and q ~~~> p = 61 and q = 53
pq = n ~~~> n = 61 · 53 = 3233
φ(n) = (p − 1)(q − 1) ~~~> φ(3233) = (61 − 1)(53 − 1) = 3120
1 < e < φ(n) and comprime to φ(n) ~~~> let e = 17
public-key ~~~> (n = 3233, e = 17)
d= mod φ(n) ~~~> d = (mod 3120) = 2753
private-key ~~~> (n = 3233, d = 2753)
c= (mod n) ~~~> (mod 3233)
Be Mine xo ~~~> m = 65
c= (mod n) ~~~> c = (mod 3233) = 2790
c = 2790
m= (mod n) ~~~> m = (mod 3233) = 65
m = 65~~~> Be Mine xo
~~~> (mod 3233) = Alice

(1) http://en.wikipedia.org/wiki/RSA
(2) http://en.wikipedia.org/wiki/Public-key_cryptography

Vous aimerez peut-être aussi