Cryptography. Helmer Aslaksen Department of Mathematics National University of Singapore



Similar documents
Number Theory. Proof. Suppose otherwise. Then there would be a finite number n of primes, which we may

An Introduction to the RSA Encryption Method

Public Key Cryptography and RSA. Review: Number Theory Basics

Public Key Cryptography: RSA and Lots of Number Theory

The application of prime numbers to RSA encryption

Discrete Mathematics, Chapter 4: Number Theory and Cryptography

RSA Encryption. Tom Davis October 10, 2003

Solutions to Problem Set 1

Computer Networks. Network Security 1. Professor Richard Harris School of Engineering and Advanced Technology

Hill s Cipher: Linear Algebra in Cryptography

1. The RSA algorithm In this chapter, we ll learn how the RSA algorithm works.

Principles of Public Key Cryptography. Applications of Public Key Cryptography. Security in Public Key Algorithms

The science of encryption: prime numbers and mod n arithmetic

How To Know If A Message Is From A Person Or A Machine

Basic Algorithms In Computer Algebra

Cryptography and Network Security Department of Computer Science and Engineering Indian Institute of Technology Kharagpur

Introduction to Hill cipher

Overview of Public-Key Cryptography

Cryptography and Network Security

Notes on Network Security Prof. Hemant K. Soni

Number Theory and Cryptography using PARI/GP

Lukasz Pater CMMS Administrator and Developer

Cryptography and Network Security Chapter 9

CHAPTER 5. Number Theory. 1. Integers and Division. Discussion

Symmetric Key cryptosystem

CSCE 465 Computer & Network Security

Lecture 6 - Cryptography

Mathematics of Internet Security. Keeping Eve The Eavesdropper Away From Your Credit Card Information

Advanced Cryptography

CS 758: Cryptography / Network Security

The Mathematics of the RSA Public-Key Cryptosystem

CIS 6930 Emerging Topics in Network Security. Topic 2. Network Security Primitives

CSC474/574 - Information Systems Security: Homework1 Solutions Sketch

Network Security. HIT Shimrit Tzur-David

Network Security. Security Attacks. Normal flow: Interruption: 孫 宏 民 Phone: 國 立 清 華 大 學 資 訊 工 程 系 資 訊 安 全 實 驗 室

Number Theory and the RSA Public Key Cryptosystem

Outline. Computer Science 418. Digital Signatures: Observations. Digital Signatures: Definition. Definition 1 (Digital signature) Digital Signatures

MATH 13150: Freshman Seminar Unit 10

FAREY FRACTION BASED VECTOR PROCESSING FOR SECURE DATA TRANSMISSION

Software Tool for Implementing RSA Algorithm

7! Cryptographic Techniques! A Brief Introduction

Lecture 3: One-Way Encryption, RSA Example

RSA and Primality Testing

MATH 537 (Number Theory) FALL 2016 TENTATIVE SYLLABUS

Cryptography and Network Security

RSA Attacks. By Abdulaziz Alrasheed and Fatima

Elements of Applied Cryptography Public key encryption

An Introduction to RSA Public-Key Cryptography

Public Key (asymmetric) Cryptography

Overview of Cryptographic Tools for Data Security. Murat Kantarcioglu

SECURITY IN NETWORKS

Lecture Note 5 PUBLIC-KEY CRYPTOGRAPHY. Sourav Mukhopadhyay

U.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, Notes on Algebra

Some practice problems for midterm 2

Cryptography: Motivation. Data Structures and Algorithms Cryptography. Secret Writing Methods. Many areas have sensitive information, e.g.

Network Security. Abusayeed Saifullah. CS 5600 Computer Networks. These slides are adapted from Kurose and Ross 8-1

1. Define: (a) Variable, (b) Constant, (c) Type, (d) Enumerated Type, (e) Identifier.

Network Security. Computer Networking Lecture 08. March 19, HKU SPACE Community College. HKU SPACE CC CN Lecture 08 1/23

Network Security Technology Network Management

Security in Distributed Systems. Network Security

Applied Cryptography Public Key Algorithms

Insight Guide. Encryption: A Guide

MATH 168: FINAL PROJECT Troels Eriksen. 1 Introduction

Secure Network Communication Part II II Public Key Cryptography. Public Key Cryptography

Overview/Questions. What is Cryptography? The Caesar Shift Cipher. CS101 Lecture 21: Overview of Cryptography

Cryptography Exercises

Introduction to Encryption

Network Security. Abusayeed Saifullah. CS 5600 Computer Networks. These slides are adapted from Kurose and Ross 8-1

Multiplicative Ciphers. Cryptography of Multiplicative Ciphers

Maths delivers! A guide for teachers Years 11 and 12. RSA Encryption

K80TTQ1EP-??,VO.L,XU0H5BY,_71ZVPKOE678_X,N2Y-8HI4VS,,6Z28DDW5N7ADY013

CS Computer Security Third topic: Crypto Support Sys

SECURITY IMPROVMENTS TO THE DIFFIE-HELLMAN SCHEMES

The Mathematical Cryptography of the RSA Cryptosystem

Module: Applied Cryptography. Professor Patrick McDaniel Fall CSE543 - Introduction to Computer and Network Security

EXAM questions for the course TTM Information Security June Part 1

Properties of Secure Network Communication

IT Networks & Security CERT Luncheon Series: Cryptography

Common Pitfalls in Cryptography for Software Developers. OWASP AppSec Israel July The OWASP Foundation

Network Security: Cryptography CS/SS G513 S.K. Sahay

Evaluation of the RC4 Algorithm for Data Encryption

Computer and Network Security

Forward Secrecy: How to Secure SSL from Attacks by Government Agencies

Outline. Digital signature. Symmetric-key Cryptography. Caesar cipher. Cryptography basics Digital signature

Network Security. Omer Rana

Network Security [2] Plain text Encryption algorithm Public and private key pair Cipher text Decryption algorithm. See next slide

Secure Network Communication Based on Text-to-Image Encryption

Speed Improvements for the RSA Encryption Method

Dr. Jinyuan (Stella) Sun Dept. of Electrical Engineering and Computer Science University of Tennessee Fall 2010

Digital Signature For Text File

Separable & Secure Data Hiding & Image Encryption Using Hybrid Cryptography

A short primer on cryptography

Cryptography and Network Security Chapter 10

CRYPTOGRAPHY IN NETWORK SECURITY

Cryptography: Authentication, Blind Signatures, and Digital Cash

Computer Security: Principles and Practice

ANALYSIS OF RSA ALGORITHM USING GPU PROGRAMMING

Chapter 7: Network security

Caesar Ciphers: An Introduction to Cryptography

Transcription:

Cryptography Helmer Aslaksen Department of Mathematics National University of Singapore aslaksen@math.nus.edu.sg www.math.nus.edu.sg/aslaksen/sfm/ 1

Basic Concepts There are many situations in life where you want to encode messages, so that even if they are seen, they will not be understood by other people than then intended recipient. The study of such encodings and decodings is called cryptography. The message you want to hide is called the plaintext, and the act of encoding it is called encryption or enciphering. The encoded plaintext is called the crypttext or the ciphertext, and the act of decoding it is called decryption or deciphering. The encryption system, also called a cipher, uses an encryption key, K E, and a decryption key, K D, for the encoding and decoding process. 2

Substitution Ciphers One of the most common ciphers is substitution. This scheme is the one used in the Sherlock Holmes story Mystery of the Dancing Men. The idea is straightforward: choose a rearrangement of the letters of the alphabet, and replace each letter in the plaintext by its corresponding one. a b c d e fg h i j k l mn op q r s t u v w x y z THEQUICKBROWNFXJMPSVLAZYDG The sentence please do not read this then becomes JWUTSU QX FXV PUTQ VKBS 3

More About Substitution Ciphers Note that our alphabet contains a space, which corresponds to a space in our key. We didn t need to do this, but it left the message in words of the same length. This, of course, makes the message easier to guess. Also, notice that we ignored case, i.e, A and a are the same. We could have distinguished between upper and lower case, in which case we would need to use a 53 letter alphabet and a 53 letter key. Theusualwaytobreaksuchacodeisacombination of frequency analysis, that is, knowing that the most commonly occurring letter in the English language is E, followed by T, plus a bit of trial and error. Leaving the spaces between words helps the cracker greatly. 4

The Caesar Cipher A variation on the arbitrary permutation discussed above is the Caesar cipher, named after Julius Caesar, who supposedly invented it himself. Here we convert our alphabet to numeric equivalents, say A =0,B =1,andso on, add an offset to each numeric equivalent (Caesar used 3), then re-encode the numbers as letters. For example, Caesar would replace A with D, B by E, and Z by C. 5

Public Key Cryptography All of the ciphers so far discussed are symmetric encryption routines, also called secret key ciphers. If you know the key used to encode the message, you can decrypt the message without too much work. This was true of all crypto systems up until the mid 1970 s: knowledge of how to encode a message allowed one also to decipher it. However, in 1976, W. Diffie and M. Hellman invented public key cryptography. In a public key system, someone who knows how to encipher a message cannot determine how to decipher the message without a prohibitively large computation. It is important to realize that there may be a procedure for doing so, but to carry out this process would take a prohibitively long time, say, hundreds of years on the fastest known computers. 6

Why Public Key Cryptography? Since knowledge of the encoding key K E does not give information about the decoding key K D, the encoding key K E canbemadepublic (hence the name public key ). This allows anyone to encode messages that only the recipient can decode. For example, suppose you want to make a credit card purchase over the Internet. Data sent across the Internet unencrypted is not secure. However, if the merchant provides a public key, you can encrypt your credit card number and transmit it without worry. Only the merchant can decrypt the message, even though anyone may send one. 7

Authentication Another feature of public key cryptography is authentication. In order to digitally sign a message, I could append my name encrypted with my deciphering key. The recipient can then decode it using my enciphering key. Then anyone can check that I was the actual sender, because only I could have encoded my name using my deciphering key. This feature is commonly used to digitally sign e-mail by software such as PGP. 8

Implementation Public key cryptography is very computationally intensive, so typically its use is limited to allow for the secure transmission of a secret key; this secret key is then used to encrypt the rest of the message using a symmetric encryption method such as DES (Data Encryption Standard). A common public key system in current use is RSA, named for its inventors: Rivest, Shamir and Adelman. 9

Some Number Theory Most public key systems rely on number theoretic results. Before we can discuss the implementation of one, we need to quickly go over the necessary background. Two numbers are said to be relatively prime if their greatest common divisor is 1. How can we determine the gcd of two numbers? If the numbers are not too large, just looking at their factors does the trick. gcd(138, 126) = 6 since 138 = 2 3 23 and 126 = 2 3 2 7. Theorem 1 Let a and b be two positive integers. Then there are integers x and y so that ax + by =gcd(a, b). 10

Modular Arithmetic Given three integers a, b and m, wesaythat a is congruent to b modulo m and write a b mod m if a b is divisble by m. 11 5mod3since11 5=6=2 3. We denote the set of integers modulo n as Z n. That is, Z n = { 0, 1, 2,...,n 1 }. If r is such that ar 1mod m, thenr is called the multiplicative inverse of a. Theorem 2 Let a and n be integers, with n 2. Then a has a multiplicative inverse modulo n if and only if gcd(a, n) =1. 2 2=4 1mod3, while 2x 1mod4 for any x. 11

Fermat s Little Theorem Theorem 3 (Fermat s Little Theorem, 1640) Let p be a prime. Any integer a satisfies a p a mod p and any integer a not divisible by p satisfies a p 1 1mod p. The second part follows from the first, since if a is not divisible by p, then a and p are relatively prime, so a is invertible mod p, and we can divide by a. 12

Euler s φ function When n is a positive integer, we define φ(n) to be the number of positive integers less than or equal to n that are relatively prime to n. If p is prime, then φ(p) =p 1, and if a and b are relatively prime, then φ(ab) =φ(a)φ(b). It can be shown that φ(n) =n p n(1 1/p). We now come to Euler s generalization of Fermat s result. This result is the central idea underlying the RSA public key cryptosystem. Theorem 4 (Euler, 1750) Let a and n be relatively prime integers, with n 2. Then a φ(n) 1mod n. Notice that if n = p, we get Fermat s Theorem. 13

RSA If you know that n = pq, then φ(n) =(p 1)(q 1), but in general, calculating φ(n) is as hard as factoring n, which, for very large n (say, 200 digits), is very hard indeed. This is the basic fact behind the RSA public key system. To set up the system, we pick at random two large primes p and q, of about 100 digits each. We then set n = pq so φ(n) =(p 1)(q 1). We also pick some other large number e<φ(n), which is relatively prime to φ(n). We make the numbers (n, e) public these form the key needed for encoding. We also compute the multiplicative inverse d of e. Then de yφ(n) = 1. The number d is the part of the key we keep private. 14

RSA: How? To encode a message: The sender divides the message up into blocks of equal length and to each block assigns an integer M with 0 <M<n. For each block of plaintext, the sender transmits m M e mod n. To decode the message: For each unit m of the crypttext received, the recipient computes M m d mod n. 15

RSA: Why? m d M ed M 1+yφ(n) M(M y ) φ(n) M. If gcd(m, n) = 1, the last step follows from Euler s Theorem. It turns out that it is true in general. 16

RSA: Example Encoding We choose p =29andq = 53. Then n = pq = 1537 and φ(n) =(p 1)(q 1) = 1456. We then choose e = 47, which is prime, but doesn t divide 1456. Hence gcd(47, 1456) = 1and the encryption key is (1537, 47). Suppose we want to send NO WAY. We set space: 00, A: 01, B: 02 etc. This gives 141500230125. Since n = 1537, we break the plaintext into block of three digits, so we get 141 500 230 125 If you use a computer, you can check that 141 47 658, 500 47 1408, 230 47 1250, 125 47 1252 mod 1537. The ciphertext is therefore 0658140812501252. Notice that we use blocks of four digits, since n = 1537. 17

RSA: Example Decoding To decode, we need to know that if we set d =31,wegetde =47 31 1mod 1456. This is easy to compute if you know φ(n) = (p 1)(q 1) = 1456, but if you only know n and not that n = pq, then you cannot compute φ(n) andd. If you use a computer, you can check that 658 31 141, 1408 31 500, 1250 31 230, 1252 31 125 mod 1537. This gives us back 141500230125. 18