Page!1 Math 409H Fall 2016 Texas A&M University Professor: David Larson Introduction Number Theory and Public Key Cryptography Kathryn Sommers Number theory is a very broad and encompassing subject. At its base, number theory is the study of integers, focusing mainly on the positive integers, also referred to as natural numbers, and the mathematical relationships between these numbers ( What ). Number theory includes many subjects, such as prime numbers and congruences. Many of the concepts and mathematical relationships of number theory are crucial elements to many methods of cryptography. Cryptography is the process of using ciphers or codes, often composed of algorithms, for encryption and decryption. Encryption is using ciphers to make information unreadable while decryption is using ciphers to make information readable again. One method of cryptography that is deeply rooted in number theory is Public Key Cryptography. Public Key Cryptography is a special type of cryptography where the encryption cipher is known to the public, but the cipher needed to decrypt the information is either impossible or nearly impossible to find (Manfredi). There are many types of Public Key Cryptography such as the RSA Public Key Cryptographic System and the Diffie-Hellman Public Key Cryptographic System both methods heavily rely on multiple areas of number theory.
Page!2 Number Theory As explained in the introduction, number theory is the study of integers and the relationships between these integers. Specifically, number theory deals with the set of natural numbers 1, 2, 3, 4, 5, 6, 7, 8, which are the positive integers. Since number theory focuses on the relationships between these numbers, this set of numbers is often broken down into smaller sets of numbers based on a common mathematical relationship between the numbers of the new set. We will take a look at types of numbers, congruences, and then primitive roots. Types of Numbers Each natural number can be categorized into one of three types: prime numbers, composite numbers, and unity. A prime number is a positive integer that has only two distinct divisors, namely 1 and the integer itself. Using this definition, one can find the set of prime numbers: 2, 3, 5, 7, 11, 13, 17,. Prime numbers play a key role in multiple areas of study within number theory. A composite number is a positive integer that has more than two distinct divisors. Using this definition, one can find the set of composite numbers: 4, 6, 8, 9, 10, 12, 14,. The last category of number is unity. 1 is the only number that can be categorized as unity since it is neither a prime number nor a composite number. Congruences Congruences refer to the congruential relationship between integers. Specifically, congruences refer to the remainders that result from dividing a number by an integer referred to as a modulus (Hershey). We will take a look at the basic written notation for congruences,
Page!3 a b (mod m) (Notation 1) where a is an integer, m is the modulus used to divide the integer, and b is the remainder. Here is an example of how congruences work and how to correctly write the notation. Let a = 11 and m = 2. Next, divide 11 by 2. This results in the remainder, b, equal to 1. Therefore the notation for this example is 11 1 (mod 2). With similar notation, further integers and mathematical processes can be implemented. It is important to note that there can be a different notation for instances when the number being divided is raised to a power. In these cases the rule might be written as an equation so the notation might look like this, b = (a)^d (mod m) (Equation 2) where d is the power to which the integer a has been raised, m is the modulus that will divide (a)^d with b as the remainder. For further examples and explanations of congruences, see the Exercises section. Primitive Roots Primitive roots can be used to greatly increase the ease of solving congruences where a is raised to a large integer d (See Equation 2). In this type of congruence, the primitive root of d would be the smallest factor of d, we will call it r, that if a was raised to the r power, the remainder b would stay the same. This means that b = (a)^d (mod m) and b = (a)^r (mod m) (Equation 3) are equal to each other with the exact same remainder.
Page!4 Public Key Cryptography Public key cryptography derives its name from the fact that part of the cipher used to encrypt information is known to the public. As previously stated, even though the encryption key is known to the public, the information is still very hard to decrypt, unless the decryption key is already known, since the decryption key is nearly or completely impossible to find when one only knows the encryption key (Gunnells). Within public key cryptography, there are many methods of encryption, each relying heavily on number theory. The Diffie-Hellman Public Key Cryptographic System This type of public key cryptography relies on the use of multiple parts of number theory including prime numbers, primitive roots, and congruences. This method is designed for two groups to contribute numbers to the public key. Publicly, both groups decide on a prime number, m, and a primitive root, a, of that prime number to use in their key. Privately, each of the groups choose an integer between 1 and m to use as an exponent for a. For Group 1, we will call their chosen integer A and we will call Group 2 s integer B. To encrypt information, Group 1 computes the remainder, x, using x = (a)^a (mod m) (Equation 4) and sends the resulting integer for x to Group 2. Similarly, Group 2 computers their remainder, y, using y = (a)^b (mod m) (Equation 5)
Page!5 and sends their result for y to Group 1. In order to decrypt the received integer, each group then takes the new integer that they have received and raises it to their original chosen integer and the reduces the result using (mod m). Hence, Group 1 would want to compute X, their decrypted integer, using X = (y)^a (mod m) (Equation 6) and Group 2 would want to compute Y, their decrypted integer, using Y = (x)^b (mod m). (Equation 7) This completes the encryption and decryption process for the Diffie-Hellman Public Key Cryptographic System. For further explanation and an example, see the Exercises section. The RSA Public Key Cryptographic System RSA Public Key Cryptographic System relies heavily on prime numbers and their unique characteristics. Specifically, RSA Public Key Cryptography utilizes the fact that multiplying together two large prime numbers results in an integer that is often extremely hard to factor (Welsh). For RSA Public Key Encryption, we utilize a version of Equation 2, C = (M)^e (mod n) (Equation 8) where M represents the information to be encrypted, e represents an integer chosen by the sender as part of the public key, n represents the other part of the public key, which is made up of two large prime numbers multiplied together, called p and q, and C represents the encrypted information. A similar equation is used to decrypt, D = (C)^d (mod n) (Equation 9)
Page!6 where C is the encrypted information, n is the same public key used to encrypt, d is the private key, and D is the decrypted message. Similarly, another equation can be used to decrypt a message. This alternate equation is as follows, ed 1 (mod (p-1)(q-1)) (Equation 10) where e is again part of the public key, d is the private key, 1 is the remainder, and p and q are the large prime numbers used to find n when encrypting the message. For further explanation and examples, see the Exercises section. Conclusion It is now clear to see that Public Key Cryptography relies heavily on many aspects of number theory. Since number theory is such an expansive subject, the cryptographic systems that can be derived from the concepts and relationships of number theory are great in number. In a world that is constantly looking for new ways to protect information for unwanted readers, public key cryptography and its underlying number theory are an important and growing field.
Page!7 Exercises 1. Does 3X 7 (mod 12) have a solution? (Hershey) Proof: By definition of notation for congruences, the modulus is 12, the integer that will be divided is 3X, and 7 is the remainder. Therefore, in order for 7 to be the remainder, X must be an integer that when multiplied by 3 and divided by 12 would leave a remainder of 7. However, since 12 is a composite number and can be factored into (3 x 4), (3X)/12 is equal to (3X)/(3 x 4). Cancelling out the 3 s, we get X/4, rendering it impossible to find an integer X such that the remainder is 7. Therefore, 3X 7 (mod 12) does not have a solution. 2. Does 6X 3 (mod 15) have a solution? (Hershey) Proof: By definition of notation for congruences, the modulus is 15, the integer that will be divided is 6X, and the remainder is 3. Therefore, for 3 to be the remainder, X must be an integer that when multiplied by 6 and then divided by 15 would leave a remainder of 7. Therefore, X=8 would be a solution since (6 x 8)/15 leaves a remainder of 3. Therefore 6X 3 (mod 15) has a solution. 3. What is (47)^1395 (mod 48)? (Hershey) Solution: Using known laws of exponents and primitive roots, (47)^1395 = (47)^1392 x (47)^3. Therefore, (47)^1395 (mod 48) = ((47)^1392 x (47)^3) (mod 48). Solving for the remainder, we find it to be 47. Hence, (47)^1395 47 (mod 48).
Page!8 4. What is (4)^3207 (mod 1024)? (Hershey) Solution: Using known laws of exponents and primitive roots, (4)^3207 = (4)^3202 x (4)^5. Therefore, (4)^3207 (mod 1024) = ((4)^3202 x (4)^5) (mod 1024). However, it is clear that (4)^5 0 (mod 1024). Therefore, the remainder will be 0 since multiplying anything by 0 is 0. Hence, (4)^3207 0 (mod 1024). 5. What is (2)^57 (mod 123)? (Hershey) Solution: Using known laws of exponents and primitive roots, (2)^57 = (2)^14 x (2)^42 x (2)^1. Therefore, (2)^57 (mod 123) = ((2)^14 x (2)^42 x (2)^1) (mod 123). Using the fact that both (2)^14 and (2)^42 are (2)^7 raised to a power, we will first find (2)^7 (mod 123). It is clear that (2)^7 = 5 (mod 123). Hence, (2)^57 (mod 123) = ((((2)^7)^2) x (((2)^7)^6) x ((2)^1)) (mod 123) = (((5)^2) x ((5)^6) x (2)) (mod 123) = 781250 (mod 123) = 77 Therefore, the remainder is 77 and (2)^57 77 (mod 123).
Page!9 6. Parties A and B decide upon the prime p = 101 and the primitive root a = 3. Suppose that Party A picks A = 70 and Party B picks B = 87. What quantity is developed in common by Parties A and B? (Hershey) Solution: Using the Diffie-Hellman Public Key Cryptographic System, we will first compute what Party A sends using Equation 4. Using the given values, x = (3)^70 (mod 101). Solving, we find x = 17. Next, we will compute what Party B sends using Equation 5. Again using given values, y = (3)^87 (mod 101). Solving, we find y = 8. It is clear that x does not equal y so we will now decrypt the messages. Now, using Equation 6 and the given values to find Party A s decrypted message, we get X = (8)^70 (mod 101) and we find X = 14. Next, using Equation 7 and the given values we find Party B s decrypted message. We find Y = (17)^87 (mod 101). Solving, we find that Y = 14. Clearly, X = Y so the quantity developed in common by Parties A and B is the decrypted messages by both parties, which shows that the use of the Diffie-Hellman Public Key Cryptographic System was successful.
Page!10 7. In a public-key cryptosystem using the RSA method, you intercept the cryptogram C = 10 sent to a receiver whose public key is e = 5 and n = 35. Find the integer M which was sent. (Welsh) Solution: Using the RSA Public Key Cryptographic System, we will start by applying the given values to Equation 8. Then, 10 = (M)^5 (mod 35). Therefore, 10 is the remainder when (M)^5 is divided by 35. Solving for M, we find M = 5. Hence, the initial integer that was sent was 5. 8. In an RSA system the public key of a given user is e = 31 and n = 3599. What is the private key of the user? (Welsh) Solution: Using the RSA Public Key Cryptographic System, we will want to use Equation 10. However, all the parts needed for equation 10 have not been given to us; specifically, we are missing p and q. Since we were given n = 3599 and we know that p and q are prime numbers due to the fact that RSA Encryption was used we must find a p and q such that pq = 3599. Solving, p and q are found to equal 59 and 61. Now we have all the parts needed to use Equation 10. Using Equation 10 we get, 31d 1 (mod (59-1)(61-1)) 31d 1 (mod 3480) Solving for d, we find d = 3031. Therefore the private key of the user is 3031. This example shows us why the RSA method is usually done with extremely large prime
Page!11 numbers, because in this example, I could easily find the primes used through a few attempts of multiplying prime numbers since the n was relatively small. For n much larger than this one, attempting to find n by multiplying prime numbers would take an extremely long time and could even be impossible.
Page!12 References [1] Gunnells, Paul E.. The mathematics of cryptology. Department of Mathematics and Statistics, University of Massachusetts, Amherst, 2004. Web. 12 October 2015. http:// people.math.umass.edu/~gunnells/talks/crypt.pdf [2] Hershey, John E.. Cryptography Demystified. The McGraw-Hill Companies, Inc., 2003. Print. [3] Manfredi, Michael. Modern Cryptography and Mathematics. The University of Warwick. Web. 11 October 2015. <http://www.furthermaths.org.uk/files/encryption.pdf> [4] Sommers, Kathryn. The Mathematics of Cryptography. 2015. Print. [5] Welsh, Dominic. Codes and Cryptography. Oxford University Press, New York, 1988. Print. [6] What is Number Theory? Brown University. Web. 08 December 2016. <https:// www.math.brown.edu/~jhs/frintch1ch6.pdf>