10
Gorham/Weaver Dr. Barton 27 March 2015 RSA Cryptosystem Throughout history many civilizations have devised secret codes in order to pass along information from one party to another. The first people to give a name to this practice were the Greeks when they were at war with other nations 1 . Cryptography, or “hidden” in Greek, was the practice and study of techniques for safe communication in the presence of a third party. The idea was to keep the message secret during transmission and if a third party intercepted the message they would not be able to decipher it. Early cryptography was solely concerned with converting messages into unreadable groups of figures to protect the message’s content during the time the message was being carried from one place to another (New World 2007). The process of cryptography begins with the encryption of a message to be sent to another party. The creator of this encryption shares how to decode the message with the member he would like to send the message too. So, Party A encrypts a

Senior Research Final Draft3

Embed Size (px)

Citation preview

Page 1: Senior Research Final Draft3

Gorham/WeaverDr. Barton27 March 2015

RSA Cryptosystem

Throughout history many civilizations have devised secret codes in order to pass along

information from one party to another. The first people to give a name to this practice were the

Greeks when they were at war with other nations1. Cryptography, or “hidden” in Greek, was the

practice and study of techniques for safe communication in the presence of a third party. The

idea was to keep the message secret during transmission and if a third party intercepted the

message they would not be able to decipher it. Early cryptography was solely concerned with

converting messages into unreadable groups of figures to protect the message’s content during

the time the message was being carried from one place to another (New World 2007).

The process of cryptography begins with the encryption of a message to be sent to

another party. The creator of this encryption shares how to decode the message with the member

he would like to send the message too. So, Party A encrypts a message, sends it to Party B, and

Party B is able to decrypt it. This is shown below in Figure 1.5

Figure 1.

Classes of encryption techniques are designed to secure symmetric cryptographic key material

for transmission using asymmetric (public-key) algorithms. To make this more clear,

symmetric-key algorithms have the same cryptographic keys for both encryption and decryption.

This being said, the RSA Cryptosystem has two different keys for encryption and decryption

Page 2: Senior Research Final Draft3

making it very difficult for an adversary to break the code. For example, if a bank wants to have

multiple customers, they use a public key system, which allows many people to give the bank

locks of their account. The bank itself only has one key that opens everyone’s individual locks.

It is similar to a master key. Public key systems are clumsy to use in transmitting long messages.

Instead they are often used to exchange symmetric keys, which are usually short5. This

symmetric key is then used to encrypt longer messages.

In the past, many nations used a shift when they would crypt a message. If the alphabet

is placed on a number line the letters of each message would be shifted forwards or backwards

during the encryption and the shift would be reversed during the decryption. This is an example

of a symmetric key.

Since the First World War, cryptography and the process of encryption have become very

difficult. Today, the encryption and decryption processes are heavily involved with

mathematical theory. These algorithms are hard to break and almost impossible for an

inexperienced adversary to figure out. The RSA or the Rivest, Shamir, Adleman was the first

practicable public-key cryptosystem1. This cryptosystem uses an asymmetric way to crypt and

decrypt messages. An asymmetric cryptosystem requires two separate keys; one that is public,

and the other, private. Today it is used in order to secure data transmission. In this system, the

encryption key is public while the decryption key is kept a secret. Therefore the key does not

need to be transmitted. Instead of sending how to decrypt the message all you have to send is the

cipher text itself. If the message is intercepted with a symmetric-key system, the way to decrypt

it is included with the cipher text.

The RSA Cryptosystem is an algorithm based on the practical difficulty of factoring the

product of two large prime numbers. In order to create an encryption, the user must base the

Page 3: Senior Research Final Draft3

public key off of two large prime numbers. If the prime numbers are large enough, factoring

them would take even a computer a lengthy period of time. In my opinion, factoring a large

prime number like 44,345,523 to find 2 prime numbers is harder than multiplying two prime

numbers together in order to create a public key.

To start off, the prime numbers must be kept a secret. Since the encryption key is public,

anyone can encrypt a message. However, if the public key is large enough, only someone who

knows the prime numbers can decode the message. So now we first create a key. Then we

choose two distinct prime numbers p and q; these should be of similar digit length and take the

Euler’s Totient Function (phi function) of the two numbers.

Lemma 1: If p is a positive prime number, then Φ(p) = p – 1.

Proof: If p is prime, then since its only positive divisors are 1 and p, all of the integers 1,

2, 3, … , p – 1 are relatively prime to p.

By multiplying p and q together we receive and integer y. Now we take the Euler Totient

function of y.

Lemma 2: For p and q distinct primes, Φ(pq) = Φ(p) Φ(q) = (p - 1)(q - 1).

Proof: There are pq - 1 natural numbers smaller than pq including

p, 2p, 3p, 4p, …, (q - 1)p and q, 2q, 3q, 4q, …, (p - 1)q, all of which have a factor other

than 1 in common with pq.

Since there are (q - 1) + (p - 1) of these numbers, this leaves

(pq) – 1 – (p - 1) – (q - 1) = pq – p – q + 1 = (p - 1)(q – 1)

This shows that Φ(pq) can be applied to both p and q at the same time.

So by using this function designated Φ we can compute

Φ(y) = Φ(p) Φ(q) = (p - 1)(q - 1)

Page 4: Senior Research Final Draft3

Now we choose an integer x so that 1< x <Φ(y) and the gcd(x, Φ(y)) = 1

In other words, x and Φ(y) are coprime.

Lemma 3: If p is prime and k is a positive integer, then gcd(n, pk) = 1 if and only if p does

not divide n.

Proof: First of all if p|n, then gcd(n, pk) ≠ 1 because p also divides pk.

Conversely, if gcd(n, pk) ≠ 1 then n and pk are not relatively prime, i.e., they share a

common factor greater than 1.

But the only factors of pk are powers of p and so p|n.

When choosing x, x must be coprime and thus the gcd(x, Φ(y)) = 1

Lemma 4: If p is prime and k is a positive integer, then Φ(pk) = pk – pk-1.

Proof: There are precisely pk-1 integers between 1 and pk that are divisible by p, namely

{p, 2p, 3p, …, pk-1p}.

So of the pk that are positive and less than or equal to pk, pk – pk-1 of them do not have a factor in

common with pk. This shows (pk) = pk – pk-1.

Lemma 5: For n > 2, Φ(n) is an even integer.

Proof: Divide this problem into two cases:

Case 1: n is a power of 2, i.e., n = 2k (k > 1). Then

Φ(n) = Φ(2k) = 2k – 2k-1 = 2k-1(2 – 1) = 2k-1, which is even.

Case 2: n is not a power of 2. In this case n is divisible by an odd prime p, so n = pkm (k

≥ 1) and gcd(pk, m) = 1.

So, Φ(n) = Φ(pkm) = (pk – pk-1) Φ(m) = pk-1(p-1) Φ(m)

Which is even (because 2|(p-1)). So now x is released as the public key exponent.Now we must

determine d (private key).

Page 5: Senior Research Final Draft3

d ≡ x -1(mod Φ(y))

Thus, we solve for d given that dx ≡ 1 (mod Φ(y)). And thus d is kept as the private key

exponent.

Euler’s Theorem shows us that for some prime number n, if n and a are coprime then n

and a have no common factors, n|(aΦ(n) – 1) and so, aΦ(n) ≡ 1(mod n). So far now we have the

public key which consists of the modulus y and the public exponent x. The private key however

consists of the modulus y and the private exponent d. Thus the variables a, b, Φ(y) must be kept

secret because they are used to calculate d.

The next step is to create the encryption. Therefore, give out your public key (y,x) and

keep the d value a secret. Now we wish to send out a message called TAP. Make TAP an

integer by using ASCII notation designated by b, such that T is 20, A is 01, and P is 16. Next

you produce the cipher text c corresponding to c ≡ bx (mod y). This is done through modular

exponentiation and next we send the c value to the recipient.

The decryption is done by recovering the b value from c by using the private key as

exponent d. This is done by computing:

b ≡ cd mod y.

This is a very simplified version of the RSA cryptosystem. The only problem with this

system is that a padding scheme is used in order to scramble the ciphertext before the algorithm

begins. This simplified version has a modular arithmetic system that is not 1 to 1, meaning that

you could used several different mods in order to obtain your message b. However, if a proper

padding scheme is used, the RSA system is a very effective code when securing data during

transmission. Your everyday credit card use and internet passwords are all, for the most part,

protected by this well built algorithm.

Page 6: Senior Research Final Draft3

Euler’s Totient Function

If n is a positive integer with gcd(a, n) = 1, then aΦ(n) ≡ 1(mod n).

Proof: If n =1, we wish to show that a0 ≡ 1(mod 1) which is obviously true. So assume

that n > 1 and let S = {a1, a2, …, aΦ(n)} be the set of positive integers less than n that are

relatively prime to n.

Since gcd(a, n) = 1, and we know that aa1, aa2, …, aaΦ(n) are congruent to a1, a2, …, aΦ(n)

in some order.

aa1 ≡ a’1(mod n),

aa2 ≡ a’2(mod n),

aaΦ(n) ≡ a’ Φ(n)(mod n).

Page 7: Senior Research Final Draft3

Work Cited

1http://www.faqs.org/espionage/Cou-De/Cryptology-History.html

2http://searchsecurity.techtarget.com/definition/cryptology

3http://mathworld.wolfram.com/RSAEncryption.html

4https://crypto.stanford.edu/~dabo/papers/RSA-survey.pdf

5http://www.laits.utexas.edu/~anorman/BUS.FOR/course.mat/SSim/history.html