Public-Key Technique 1. Public-Key Cryptography. Agenda. Public-Key Technique 2. L94 - Public-Key Cryptography. L94 - Public-Key Cryptography

Similar documents
Lecture 1: Introduction to Public key cryptography

Public Key Algorithms

Chapter 8 Public-key Cryptography and Digital Signatures

CIS 551 / TCOM 401 Computer and Network Security

CRYPTOGRAPHY AND NUMBER THEORY

Public Key Cryptography

10 Modular Arithmetic and Cryptography

Definition: For a positive integer n, if 0<a<n and gcd(a,n)=1, a is relatively prime to n. Ahmet Burak Can Hacettepe University

CIS 6930/4930 Computer and Network Security. Topic 5.2 Public Key Cryptography

Number theory (Chapter 4)

Public Key Algorithms

Public-Key Cryptosystems CHAPTER 4

Public Key Cryptography

Chapter 4 Asymmetric Cryptography

Asymmetric Cryptography

CPSC 467b: Cryptography and Computer Security

Lecture Notes, Week 6

Network Security Technology Spring, 2018 Tutorial 3, Week 4 (March 23) Due Date: March 30

Asymmetric Encryption

Lecture V : Public Key Cryptography

Cryptography. pieces from work by Gordon Royle

Discrete Mathematics GCD, LCM, RSA Algorithm

Public Key Cryptography. All secret key algorithms & hash algorithms do the same thing but public key algorithms look very different from each other.

CPE 776:DATA SECURITY & CRYPTOGRAPHY. Some Number Theory and Classical Crypto Systems

Introduction to Public-Key Cryptosystems:

basics of security/cryptography

Security Issues in Cloud Computing Modern Cryptography II Asymmetric Cryptography

LECTURE 5: APPLICATIONS TO CRYPTOGRAPHY AND COMPUTATIONS

Slides by Kent Seamons and Tim van der Horst Last Updated: Oct 1, 2013

8.1 Principles of Public-Key Cryptosystems

10 Public Key Cryptography : RSA

Practice Assignment 2 Discussion 24/02/ /02/2018

The RSA cryptosystem and primality tests

1 Recommended Reading 1. 2 Public Key/Private Key Cryptography Overview RSA Algorithm... 2

Overview. Background / Context. CSC 580 Cryptography and Computer Security. March 21, 2017

Cryptography. P. Danziger. Transmit...Bob...

Theme : Cryptography. Instructor : Prof. C Pandu Rangan. Speaker : Arun Moorthy CS

Cosc 412: Cryptography and complexity Lecture 7 (22/8/2018) Knapsacks and attacks

Introduction to Cybersecurity Cryptography (Part 4)

L7. Diffie-Hellman (Key Exchange) Protocol. Rocky K. C. Chang, 5 March 2015

Encryption: The RSA Public Key Cipher

Introduction to Modern Cryptography. Benny Chor

Introduction to Cybersecurity Cryptography (Part 4)

1 Number Theory Basics

RSA. Ramki Thurimella

Hans Delfs & Helmut Knebl: Kryptographie und Informationssicherheit WS 2008/2009. References. References

ENEE 457: Computer Systems Security 10/3/16. Lecture 9 RSA Encryption and Diffie-Helmann Key Exchange

Introduction to Cryptography. Lecture 8

Cryptography IV: Asymmetric Ciphers

Number Theory & Modern Cryptography

RSA RSA public key cryptosystem

Lemma 1.2. (1) If p is prime, then ϕ(p) = p 1. (2) If p q are two primes, then ϕ(pq) = (p 1)(q 1).

Introduction to Modern Cryptography. Benny Chor

Public-key Cryptography and elliptic curves

Number Theory: Applications. Number Theory Applications. Hash Functions II. Hash Functions III. Pseudorandom Numbers

Lecture 5: Arithmetic Modulo m, Primes and Greatest Common Divisors Lecturer: Lale Özkahya

Cryptography and Network Security Prof. D. Mukhopadhyay Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Introduction to Cybersecurity Cryptography (Part 5)

Eindhoven University of Technology MASTER. Kleptography cryptography with backdoors. Antheunisse, M. Award date: 2015

during transmission safeguard information Cryptography: used to CRYPTOGRAPHY BACKGROUND OF THE MATHEMATICAL

Notes for Lecture 17

CHALMERS GÖTEBORGS UNIVERSITET. TDA352 (Chalmers) - DIT250 (GU) 11 April 2017, 8:30-12:30

2. Cryptography 2.5. ElGamal cryptosystems and Discrete logarithms

ASYMMETRIC ENCRYPTION

CPSC 467: Cryptography and Computer Security

Intro to Public Key Cryptography Diffie & Hellman Key Exchange

An Introduction to Cryptography

Public Key 9/17/2018. Symmetric Cryptography Review. Symmetric Cryptography: Shortcomings (1) Symmetric Cryptography: Analogy

Discrete Logarithm Problem

Notes. Number Theory: Applications. Notes. Number Theory: Applications. Notes. Hash Functions I

Cryptography and Secure Communication Protocols

Candidates must show on each answer book the type of calculator used. Only calculators permitted under UEA Regulations may be used.

Review. CS311H: Discrete Mathematics. Number Theory. Computing GCDs. Insight Behind Euclid s Algorithm. Using this Theorem. Euclidian Algorithm

Week 7 An Application to Cryptography

Logic gates. Quantum logic gates. α β 0 1 X = 1 0. Quantum NOT gate (X gate) Classical NOT gate NOT A. Matrix form representation

8 Elliptic Curve Cryptography

An Introduction to Probabilistic Encryption

Cryptography and Number Theory

Implementation Tutorial on RSA

THE RSA CRYPTOSYSTEM

Cryptography and RSA. Group (1854, Cayley) Upcoming Interview? Outline. Commutative or Abelian Groups

One can use elliptic curves to factor integers, although probably not RSA moduli.

CS483 Design and Analysis of Algorithms

Math 299 Supplement: Modular Arithmetic Nov 8, 2013

OWO Lecture: Modular Arithmetic with Algorithmic Applications

Other Public-Key Cryptosystems

Public Key Cryptography

Simple Math: Cryptography

Public-Key Encryption: ElGamal, RSA, Rabin

My brief introduction to cryptography

CSCI3390-Lecture 16: Probabilistic Algorithms: Number Theory and Cryptography

The RSA public encryption scheme: How I learned to stop worrying and love buying stuff online

Great Theoretical Ideas in Computer Science

Topics in Cryptography. Lecture 5: Basic Number Theory

Introduction to Modern Cryptography. Lecture RSA Public Key CryptoSystem 2. One way Trapdoor Functions

Polynomial Interpolation in the Elliptic Curve Cryptosystem

CPSC 467b: Cryptography and Computer Security

Exam Security January 19, :30 11:30

Addition. Ch1 - Algorithms with numbers. Multiplication. al-khwārizmī. al-khwārizmī. Division 53+35=88. Cost? (n number of bits) 13x11=143. Cost?

Number Theory. CSS322: Security and Cryptography. Sirindhorn International Institute of Technology Thammasat University CSS322. Number Theory.

Transcription:

Public-Key Technique A pair of keys is used Private Key used by one party key kept secret in one system to sign messages to be sent to the other party for authentication to decrypt messages received from the other party Public-Key Cryptography Number Theory, RSA, Diffie-Hellmann Public Key used by the other party key may widely be published to many systems to encrypt messages to be sent to the other party for privacy to verify messages received from the other party for authentication Called asymmetric algorithms, D.I. Manfred Lindner Public-Key, v. Agenda Introduction Number Theory RSA Diffie-Hellmann, D.I. Manfred Lindner Public-Key, v. Public-Key Technique Methodology S Private Key, P Public Key Security association between Alice and Bob Alice generates one key pair (P A, S A ), keeps S A secret in her system and give P A to Bob Security association between Bob and Alice Bob generates one key pair (P B, S B ), keeps S B secret in his system and give P B to Alice Encrypted messages from Alice to Bob C = f E (P B, M) M = f D (S B, C) done by Bob to decrypt Encrypted messages from Bob to Alice C = f E (P A, M) M = f D (S A, C) done by Alice to decrypt, D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Page -, D.I. Manfred Lindner Page -

Public-Key Technique (Privacy) Public-Key Algorithms Alice Original message (Plaintext M) Alice wants to send secretly over an insecure channel (privacy aspect) Bob Decoded message M = f D (S B, C) Encryption Method Decryption Method Ciphertext C = f E (P B, M) encryption key, P B decryption key, S B RSA for encryption and digital signature El-Gamal and DSS for digital signature Diffie-Helman allows establishment of a shared secret They are all very different from each other All hash algorithms do the same thing: they take a message and perform an irreversible transformation on it All the secret-key algorithms do the same thing: they take a block and encrypt in a reversible way and allow message ciphers by chaining mechanism of blocks, D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Public-Key, v. Public-Key Technique (Authentication) Agenda Bob Original message (Plaintext M) Bob wants to sign his message to proof that the message comes from him (authentication aspect) Encryption Method Ciphertext C = f E (S B, M) encryption key, S B Introduction Number Theory RSA Diffie-Hellmann Note: If Alice can decode the message she knows that the message comes from Bob Alice Note: This ciphertext is not a real cipher because everybody who knows the public key can read it Decoded message M = f D (P B, C) Decryption Method decryption key, P B, D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Page -, D.I. Manfred Lindner Page -

Natürliche Zahlen a teilt n -> b -> b * a = n b ist der komplementäre Teiler p = Primzahl ( prime ) als Teiler nur und p Primzahlen sind ungerade Zahlen (Ausnahme p=) Untersuchung, ob eine Zahl Primzahl ist Überprüfen aller Zahlen bis Wurzel aus p Primfaktorzerlegung ( prime factorisation ) = * = *** = *****= ** = ** = ***** = ** Primfaktoren bleiben übrig Natürliche Zahlen kgv (kleinstes gemeinsames Vielfaches) bilde Produkt der höchsten Potenzen aller überhaupt vorkommender Primfaktoren = **= * = ***= * kgv (, ) = * * = ggt (a, n) * kgv (a, n) = a * n = **= * = ***= * ggt (, ) = kgv (, ) = * * = * = = *, D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Public-Key, v. Natürliche Zahlen ggt (größter gemeinsamer Teiler) gcd ( greatest common divisor) bilde Produkt der Primfaktoren, die in beiden Zerlegungen gleichzeitig vorkommen = * = *** = *****= ** = ** = ***** = ** ggt (, ) = ** = ggt (a, n) = -> teilerfremd ( relatively prime ) = ***= * = * ggt (, ) = ggt durch Euklid statt Faktorisierung ggt lässt sich mit dem Euklid-Algorithmus leicht berechnen: Zwei Zahlen (n) und (a) = * + (n = q*a + r) -> ggt(n,a) = ggt (a, r) mit <= r < a = * + = * + = * + = * + = * ist ggt von und, D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Page -, D.I. Manfred Lindner Page -

Vielfachsummendarstellung des ggt Vielfachsummendarstellung: ist g = ggt (n, a) dann gibt es ganze Zahlen s und t so dass g = t*a + s*n Lemma von Bezout die Werte t und s lassen sich mit dem erweiterten Euklid- Algorithmus leicht berechen, D.I. Manfred Lindner Public-Key, v. ggt und modulo Wenn ggt (n, a) = gilt laut Vielfachsummendarstellung = t*a + s*n Betrachtet man diese Gleichung bezüglich mod n = t*a oder auch (t*a) mod n = t*a geteilt durch n ergibt Rest Man schreibt auch anstelle von t a - (mod n) Dann ist a ist bezüglich modulo n invertierbar Es existiert daher ein komplementärer Teiler t der obige Gleichung erfüllt Anmerkung: in der normalen Arithmetik wäre t = /a = a - (der Kehrwert von a) und daher ein Bruch (rationale Zahl) In der Restklassenarithmetik gibt es aber keine Brüche sondern nur natürliche Zahlen dennoch lässt sich hier (wenn a und n teilerfremd sind) mittels erweiterten Euklid eine natürliche Zahl t finden, die obige Gleichung erfüllt, D.I. Manfred Lindner Public-Key, v. Restklassenarithmetik Modulo (mod) Restklassenarithmetik verwendet natürliche Zahlen kleiner n,,, n- Auf diese Zahlen lassen sich alle Operationen wie Addition, Multiplikation, Subtraktion anwenden Das Ergebnis einer solchen Operation wird durch n geteilt und der dabei entstandene Rest als modulo von n (mod n) bezeichnet a mod n = r ist gleichbedeutend mit der Aussage es gibt eine ganze Zahl k gibt für die gilt: a = k * n + r Introduction Most of the public-key algorithms are based on modular arithmetic Modular arithmetic uses non-negative integer numbers less than some positive integer n performs ordinary arithmetic operations like addition or multiplication on such numbers but replaces the ordinary arithmetic result a with its remainder r when divided by n the result r is expressed by a mod n r = a mod n that means we can find an integer k such that a = k * n + r, D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Page -, D.I. Manfred Lindner Page -

, D.I. Manfred Lindner Page -, D.I. Manfred Lindner Public-Key, v. Modular Addition (mod ) + M C K, D.I. Manfred Lindner Public-Key, v. Encryption / Decryption (add mod ) Addition of constant K mod can be used for encryption of digits each decimal digit maps to a different decimal digit reversible way constant K is the secret key cipher like Caesar Cipher Mono alphabetic substitution of course not a good cipher Decryption subtracting the secret constant if less than then add, D.I. Manfred Lindner Page -, D.I. Manfred Lindner Public-Key, v. Encryption / Decryption (add mod ) Decryption (cont.) instead of subtracting you can add the additive inverse additive inverse of K is the number you have to add in order to get e.g. is the inverse of because ( + ) mod = Encryption with K = (M + ) mod = C Decryption with add-inv(k) = (C + ) mod = M Ciphertext C = f E (K, M) Plaintext M = f D (K, C), D.I. Manfred Lindner Public-Key, v. Modular Multiplication (mod ) x M C K

Encryption / Decryption (mult mod ) Encryption with K = (M * ) mod = C Decryption multiplying C with the multiplicative inverse Ciphertext C = f E (K, M) multiplicative inverse of K is the number you have to multiply to get (K * mult-inv(k)) mod n = in ordinary arithmetic mult-inv(k) = /K because K * /K = /K is a fraction but in modulo arithmetic we have only integers so we cannot find mult-inv(k) for all possible values of K How to Find the Multiplicative Inverse Finding multiplicative inverse t in mod n arithmetic is not obvious especially for a large number n for a given a and n -> find number t such that (a*t) mod n = brute-force search with n = digit number will not work But if the two numbers a and n are relatively prime then because of the general rule of Bezout = t*a + s*n and finally if the rule of Bezout is performed modulo n (t*a) mod n =.) there must exists such inverse number t.) the number t can be found by the Extended Euclid's algorithm note to Euclid: Basic Euclid s algorithm finds gcd (greatest common divisor) of two numbers (a, n) alternatively t can be found by using the Euler formula a φ(n) mod n = (t*a) mod n = a φ(n) mod n -> t = a φ(n)- mod n useful only if value for φ(n) is known, D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Public-Key, v. Decryption (mult mod ) Decryption (cont.) for our example we can find multiplicative inverse mod just by trying if (K * mult-inv(k)) mod = so we find: ( * mult-inv()) mod = -> mult-inv() = ( * mult-inv()) mod = -> mult-inv() = ( * mult-inv()) mod = -> mult-inv() = ( * mult-inv()) mod = -> mult-inv() = Therefore for K = we can decrypt by multiplying with mult-inv(k) = (C * ) mod = M Again that is not a good cipher Plaintext M = f D (K, C) Relatively Prime Why are the numbers,, and the only ones with multiplicative inverse mod? They are the only ones which are relatively prime to each of these numbers does not share any common factors with other than (gcd is ) the largest integer that divides and is the largest integer that divides and is the largest integer that divides and is but and have two factors in common -> and, D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Page -, D.I. Manfred Lindner Page -

Euler Function In turns out that in general when working with mod n all numbers which are relatively prime to n have a multiplicative inverse but none of the other numbers How many numbers less than n are relatively prime to n? notation for that amount is φ(n) φ(n). Euler function there is no simple formula but in special cases of n we can determine φ(n) -> see next slides, D.I. Manfred Lindner Public-Key, v. Explanation φ(n) Why? p and q are prime numbers and n = p*q n could be divided only by p or q n could not divided by other numbers because p and q are prime (only, p or q are possible as factors) there are n = (p*q-) numbers -> (,, n-) we want to exclude all numbers which are not relatively prime those are the numbers that are either multiples of p or q we have the numbers q, q, (p-)q which are in sum p- multiples of q which are less than p*q we have the numbers p, p, (q-)p which are in sum q- multiples of p which are less than p*q the rest must be relatively prime φ(n) = (p*q -) - (p-) - (q-) = p*q - - p + - q + = p*q - p - q + = (p - ) * (q - ), D.I. Manfred Lindner Public-Key, v. φ(n) for Prime Numbers If n = prime then φ(n) = n- all the integers,, n- are relatively prime to n greatest common divisor with n is for all of them note: a number n is prime means that the only divisors are and n itself it cannot written as a product of other numbers If n = product of two distinct prime numbers p and q then φ(n) = (p-)*(q-), D.I. Manfred Lindner Public-Key, v. Example p =, q = p*q = = n *, *, *, * are not relatively prime to because greatest common divisor is instead of that is p- times -> times *, *, *, *, *, * are not relatively prime to because greatest common divisor is instead of that is q- times -> times φ() = (p-)*(q-) = all other numbers are relatively prime to, D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Page -, D.I. Manfred Lindner Page -

Example p =, q = p*q = = n, D.I. Manfred Lindner Public-Key, v. Modular Exponentiation (mod ) X Y K M C, D.I. Manfred Lindner Public-Key, v. Euler Euler's theorem if two numbers a and n are relatively prime then a φ(n) mod n = (Euler.) and for any integer k a +k*φ(n) mod n = a (Euler.) that is because (a * a k*(φ(n)) ) mod n = (a * a (φ(n))k ) mod n = a * k = a It turns out that if n = product of two distinct prime numbers p and q then the formula s of Euler are valid even if the number a is not relatively prime to n (so for all x with x <= n) φ(n) = (p-)*(q-) x (p-)*(q-) mod n = (Euler.) x +k*(p-)*(q-) mod n = x (Euler.) Encryption (exp mod ) Encryption with K = (M ) mod = C K = or K = can be used Ciphertext C = f E (K, M) because all input digits are mapped to a unique output digit K = or or or cannot be used because some input digits are mapped to the same output digit K = or K = or K = makes no sense because input and output digits are the same Exists exp-inverse of K for decryption? exp-inverse is the number so that (M K ) exp-inv(k) mod = M note: in ordinary arithmetic exp-inv(k) = /K = K - Yes sometimes!, D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Page -, D.I. Manfred Lindner Page -

Decryption Aspects (exp mod ) Example mod : only numbers,, and are relative prime to φ()= for K = K φ(n) mod n = is valid because of Euler Proof : mod = mod = (t*k) mod n = because of lemma of bezout performed modulo n Agenda Introduction Number Theory RSA Diffie-Hellmann exp-inv(k) can be found by using (t*k) mod n = = K φ(n) mod n -> t = K φ(n)- mod n (exp-inv()*) mod = mod -> exp-inv()* = - mod = mod = Therefore for K = decryption with exp-inv(k) = (C ) mod = M examples mod =, mod = mod = mod =, mod = mod = mod =, mod = mod = Plaintext M = f D (K, M), D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Public-Key, v. Important Rule for Exponentiation Looking to the table columns and are the same, and are the same, and are the same, and are the same, Theory proofs x y mod n = x y mod φ(n) mod n this formula is not true for all values of n but it is true if n is prime or the product of two primes for any x with x < n in our case n = (prime factors are p=, q=) numbers,, and are relative prime to φ() = = (p-)*(q-) = * x y mod = x (y mod ) mod so column i+ th and i th are the same Special important case for public-key algorithm (RSA) if y mod φ(n) = then for any number x x y mod n = x mod n or (x y = x) mod n we need this trick for later for to perform RSA decryption modulo function is a one-way function, in order to reverse we need a trapdoor, this trick shows the possible trapdoor, D.I. Manfred Lindner Public-Key, v. RSA algorithm generate public and private keys two large primes: p and q build n = p*q φ(n) = (p-)*(q-) p and q remains secret select e that is relatively prime to φ(n) =(p-)*(q-) use Basic Euclid to proof you have found such an e gcd (φ(n), e) = with < e < φ(n) therefore it must also exists a multiplicative inverse d of e d such that (e*d) mod φ(n) = note: because of (Euler.) e φ(n) mod n = is valid from (Euler.): a φ(n) mod n = is valid if a and n are relatively prime to each other but in our case e is only relatively prime to φ(n); but if n = p*q (product of two primes) then (Euler.) is valid for all numbers x with x less n (Euler.) -> hence also for number e, D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Page -, D.I. Manfred Lindner Page -

RSA algorithm generate public and private keys (cont.) find d that is the multiplicative inverse of e that is (e*d) mod φ(n) = d can be found using the Extended Euclid algorithm now the public key is <e, n> and the private key is <d, n> it is not feasible to determine the private key from the public key you need to know p and q in order to build φ(n) but factoring is a hard problem finding p and q based on n, D.I. Manfred Lindner Public-Key, v. RSA Algorithm Proof Proof of correctness we have chosen (e*d) mod φ(n) = that means that we can write e*d = + k*φ(n) = + k*(p-)*(q-) because of (Euler.) the following rule is valid x +k*(p-)*(q-) mod n = x for all x less then n therefore for any x if we build x ed mod n then x ed mod n = x ( + k*(p-)*(q-)) mod n = x mod n if we encrypt and decrypt: Encrypt: C = M e mod n Decrypt: M = C d mod n C d =(M e ) d = (M ed ) = M mod n If we sign and verify: Sign: S = M d mod n Verify: M = S e mod n S e =(M d ) e = M de = M mod n q.e.d, D.I. Manfred Lindner Public-Key, v. RSA Encryption / Decryption encryption with public key divide the plaintext message (regarded as bit string) into blocks of M s where every M falls in the interval < M < n compute C = M e mod n (with public key) decryption M = C d mod n (with private key) privacy aspect sign a message using private key compute S = M d mod n (with private key) verification M = S e mod n (with public key) authentication and integrity aspect RSA Example p =, q = hence n =, φ(n) = choose e = relatively prime to take (gcd = ) compute d = d = (mod ) encryption C = M mod decryption M = C mod M < therefore encode every letter of the message as single block; numbers represent A Z, D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Page -, D.I. Manfred Lindner Page -

RSA Example (cont.) RSA Security S U Z A N N E Plaintext Sender M M (mod ) Ciphertext, D.I. Manfred Lindner Public-Key, v. C C (mod ) S U Z A N N E Plaintext Receiver There is a possible misuse an eavesdropper can guess what is going to be transmitted although he is not able to decrypt he can encrypt all expected messages with the public key and compares the result with the ciphertext he has eavesdropped especially a problem with short messages if there is a match then he knows what was transmitted Therefore is necessary to use special guidelines of how to format RSA message e.g. short messages should be concatenated with a large random number (e.g. bits) PKCS Public-Key Cryptography Standard, D.I. Manfred Lindner Public-Key, v. RSA Security Security depends on difficulty of factoring find p and q from n If you can factor quickly you can break RSA factoring the public value n into p and q, building φ(n) and knowing public value e allows you to find d by performing the same computations (Euclid's algorithm) as done by the key generation Fortunately factoring is a hard problem Currently -bit numbers are the largest which can be factorized The minimum length proposed for n is bits and for p and q bits each, D.I. Manfred Lindner Public-Key, v. RSA Performance Aspects Finding large prime numbers typically greater than pseudo prime numbers (random numbers) are used and checked with Fermat s theorem If n is prime then for < a < n -> a n- mod n = taken from (Euler.): a φ(n) mod n = if a and n are relatively prime if n is prime then φ(n) =n- If n is really a prime number all numbers a are relatively prime and Fermat's rule is valid primality test: For a number n to check pick a number a < n If a n- mod n = is not fulfilled then n is certainly not prime If a n- mod n = is fulfilled then n may or may not be prime (risk for failure is to in case of randomly generated number of about hundred digits) Try multiple values of number a to make the test more reliable Special attention for Carmichael numbers, D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Page -, D.I. Manfred Lindner Page -

RSA Performance Aspects Finding e and d Euclid s algorithm normal -> gcd of e and φ(n) = extended -> multiplicative-inverse Exponentiation with big numbers square and multiply algorithm and do modular reduction after each multiply e.g. result of mod = * = = mod = * = = mod = * = = mod = * = = mod = * = = mod Agenda Introduction Number Theory RSA Diffie-Hellmann, D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Public-Key, v. RSA Facts RSA is special type of block cipher Variable key-length usually - bits compromise between enhanced security and efficiency plaintext block need to be smaller than the key length Ciphertext block will be the length of the key Typically much slower to implement than conventional block ciphers like DES or IDEA unsuitable for encrypting large messages times (HW) to times (SW) slower mostly used to encrypt a session key for performing a secret-key algorithm, D.I. Manfred Lindner Public-Key, v. Diffie-Hellman (DH) Oldest public-key system still in use Compared to RSA it does neither encryption nor signatures Allows two individuals to agree on a shared key even though they can only exchange information in public this secret is used for symmetric encryption better performance than doing this with RSA DH used for key establishment, D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Page -, D.I. Manfred Lindner Page -

Diffie-Hellman Algorithm Select p prime and g < p g and p might be public, strong primes are used for p -> more secure if (p-)/ is also a prime Select random secret numbers SA, SB SA,SB are the private DH keys Alice: SA -> T A = g SA mod p Bob: SB -> T B = g SB mod p Exchange T A and T B these are the public DH keys Produce shared key K Alice: K = T B SA = (g SB ) SA = g SBSA = g SASB mod p Bob: K = T A SB = (g SA ) SB = g SASB = g SBSA mod p, D.I. Manfred Lindner Public-Key, v. Diffie-Hellman Algorithm Nobody else can compute SA or SB and hence g SASB in reasonable time even though he knows T A = g SA mod p even though he knows T B = g SB mod p Based on the fact that discrete logarithm modulo a very large prime number is hard to compute no one has found any efficient method to do this, D.I. Manfred Lindner Public-Key, v. Diffie-Hellman Algorithm Diffie-Hellman Example selects p, g selects SA p, g, T A = g SA mod p selects SB p =, g = selects SA =,, T A = g mod = selects SB = T B = g SB mod p T B = g mod = computes (T B ) SA = (g SB mod p) SA = g SBSA mod p = K computes (T A ) SB = (g SA mod p) SB = g SASB mod p = K computes mod = computes mod = Alice Bob Alice Bob, D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Page -, D.I. Manfred Lindner Page -

Man-in-the-middle Attack Problem: when T A and T B are sent over a public network and an active intruder is present Alice will establish a secret key with whoever transmitted T B but it might not be Bob Bob will establish a secret key with whoever transmitted T A but it might not be Alice There is no authentication (!) in the key exchange process of DH vulnerable against man-in-the-middle attack also known as bucket brigade attack DH is only secure against passive attacks Man-in-the-middle Attack Man-in-the-middle Attack Intruder intercepts communication, impersonates in both directions intruder handles a different secret key with every party Solutions to overcome this attack published public numbers e.g. in the newspapers or PKI techniques not possible to make active attacks, because the advertised values cannot be changed or cannot at least be easily changed authentication via out-band channel T A and T B are transmitted by voice communication over telephone network authentication based on voice recognition of other party, D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Public-Key, v. Man-in-the-middle Attack Man-in-the-middle Attack Alice SA p, g, T A = g SA mod p Intruder SZ p, g, T A = g SZ mod p T B = g SB mod p Bob SB Solutions to overcome this attack (cont.) authentication via encryption Alice and Bob know some sort of secret e.g. each other's publickey encrypt DH value with other side's public-key receiver can decrypt the message by using its own corresponding private-key T B = g SZ mod p computes (g SZ mod p) SA = g SZSA mod p uses for messages to Alice (g SA mod p) SZ = g SASZ mod p uses for messages to Bob (g SB mod p) SZ = g SBSZ mod p computes (g SZ mod p) SB = g SZSB mod p, D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Public-Key, v., D.I. Manfred Lindner Page -, D.I. Manfred Lindner Page -