CPSC 467: Cryptography and Computer Security

Similar documents
CPSC 467b: Cryptography and Computer Security

Lecture 1: Introduction to Public key cryptography

CPSC 467b: Cryptography and Computer Security

Lecture Notes, Week 6

Chapter 8 Public-key Cryptography and Digital Signatures

CPSC 467b: Cryptography and Computer Security

2. Cryptography 2.5. ElGamal cryptosystems and Discrete logarithms

Introduction to Modern Cryptography. Benny Chor

MATH 158 FINAL EXAM 20 DECEMBER 2016

Public-Key Cryptosystems CHAPTER 4

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

Lecture V : Public Key Cryptography

Question: Total Points: Score:

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

Introduction to Modern Cryptography. Benny Chor

SIGNATURE SCHEMES & CRYPTOGRAPHIC HASH FUNCTIONS. CIS 400/628 Spring 2005 Introduction to Cryptography

ECS 189A Final Cryptography Spring 2011

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

Asymmetric Encryption

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

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).

Lecture 19: Public-key Cryptography (Diffie-Hellman Key Exchange & ElGamal Encryption) Public-key Cryptography

CPSC 467: Cryptography and Computer Security

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

CPSC 467b: Cryptography and Computer Security

Public-Key Encryption: ElGamal, RSA, Rabin

1 Number Theory Basics

Introduction to Cryptography. Lecture 8

Lecture 28: Public-key Cryptography. Public-key Cryptography

YALE UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE

CPSC 467: Cryptography and Computer Security

Security Issues in Cloud Computing Modern Cryptography II Asymmetric Cryptography

CPSC 467b: Cryptography and Computer Security

CPSC 467b: Cryptography and Computer Security

CPSC 467: Cryptography and Computer Security

Chapter 7: Signature Schemes. COMP Lih-Yuan Deng

Cryptography IV: Asymmetric Ciphers

RSA RSA public key cryptosystem

CRYPTOGRAPHY AND NUMBER THEORY

CPSC 467: Cryptography and Computer Security

Public Key Cryptography

Cryptography and Security Final Exam

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

On the Big Gap Between p and q in DSA

5199/IOC5063 Theory of Cryptology, 2014 Fall

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

Lecture 7: ElGamal and Discrete Logarithms

Lecture 11: Key Agreement

TECHNISCHE UNIVERSITEIT EINDHOVEN Faculty of Mathematics and Computer Science Exam Cryptology, Tuesday 30 October 2018

Digital Signatures. p1.

CIS 551 / TCOM 401 Computer and Network Security

CPSC 467: Cryptography and Computer Security

Leftovers from Lecture 3

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

Chapter 4 Asymmetric Cryptography

Asymmetric Cryptography

Public Key Cryptography

Discrete Logarithm Problem

Other Public-Key Cryptosystems

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

Algorithmic Number Theory and Public-key Cryptography

Exam Security January 19, :30 11:30

CPSC 467b: Cryptography and Computer Security

b = 10 a, is the logarithm of b to the base 10. Changing the base to e we obtain natural logarithms, so a = ln b means that b = e a.

Cryptography. Course 1: Remainder: RSA. Jean-Sébastien Coron. September 21, Université du Luxembourg

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

Notes for Lecture 17

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

Lecture 17 - Diffie-Hellman key exchange, pairing, Identity-Based Encryption and Forward Security

Intro to Public Key Cryptography Diffie & Hellman Key Exchange

CODING AND CRYPTOLOGY III CRYPTOLOGY EXERCISES. The questions with a * are extension questions, and will not be included in the assignment.

CPSC 467: Cryptography and Computer Security

CPSC 467: Cryptography and Computer Security

Introduction to Elliptic Curve Cryptography

CPSC 467b: Cryptography and Computer Security

RSA. Ramki Thurimella

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

Digital Signatures. Adam O Neill based on

Foundations of Network and Computer Security

Tutorial on Quantum Computing. Vwani P. Roychowdhury. Lecture 1: Introduction

Winter 2008 Introduction to Modern Cryptography Benny Chor and Rani Hod. Assignment #2

Elliptic Curves. Giulia Mauri. Politecnico di Milano website:

Public Key Algorithms

Other Public-Key Cryptosystems

CPSC 467: Cryptography and Computer Security

9 Knapsack Cryptography

1 What are Physical Attacks. 2 Physical Attacks on RSA. Today:

CPSC 467b: Cryptography and Computer Security

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

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

10 Public Key Cryptography : RSA

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

CPSC 467b: Cryptography and Computer Security

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

Lecture 22: RSA Encryption. RSA Encryption

Final Exam Math 105: Topics in Mathematics Cryptology, the Science of Secret Writing Rhodes College Tuesday, 30 April :30 11:00 a.m.

Public Key Encryption

Solution to Midterm Examination

Mathematics of Public Key Cryptography

Outline. Available public-key technologies. Diffie-Hellman protocol Digital Signature. Elliptic curves and the discrete logarithm problem

Transcription:

CPSC 467: Cryptography and Computer Security Michael J. Fischer Lecture 11 October 7, 2015 CPSC 467, Lecture 11 1/37

Digital Signature Algorithms Signatures from commutative cryptosystems Signatures from non-commutative cryptosystems Security of Digital Signatures Forgery Adding redundancy Signing message digests Using Digital Signatures Signed encrypted messages Practical Signature Algorithms ElGamal digital signature scheme Digital signature algorithm (DSA) CPSC 467, Lecture 11 2/37

Digital Signature Algorithms CPSC 467, Lecture 11 3/37

Signatures from commutative cryptosystems RSA digital signature scheme Let n be an RSA modulus and (e, d) an RSA key pair. e is public and d is private as usual. Signing function: S d (m) = D d (m) Verification predicate: V e (m, s) m = E e (s). Must verify that V e (m, S d (m)) holds for all messages m, i.e., that m = E e (D d (m)) holds. This is the reverse of the requirement for RSA to be a valid cryptosystem, viz. m = D d (E e (m)) for all m Z m. RSA satisfies both conditions since m D d (E e (m)) (m e ) d (m d ) e E e (D d (m)) (mod n). CPSC 467, Lecture 11 4/37

Signatures from commutative cryptosystems Commutative cryptosystems A cryptosystem with this property that D d E e = E e D d is said to be commutative, where denotes functional composition. Indeed, any commutative public key cryptosystem can be used for digital signatures in exactly this same way as we did for RSA. CPSC 467, Lecture 11 5/37

Signatures from non-commutative cryptosystems Signatures from non-commutative cryptosystems What if E e and D d do not commute? One could define: Signing function: S e (m) = E e (m) Verification predicate: V d (m, s) m = D d (s). Every validly-signed message (m, S e (m)) would verify since D d (E e (m)) = m is the basic property of a cryptosystem. Now, Alice has to keep e private and make d public, which she can do. However, the resulting system might not be secure, since even though it may be hard for Eve to find d from e and n, it does not follow that it is hard to find e from d and n. CPSC 467, Lecture 11 6/37

Signatures from non-commutative cryptosystems Interchanging public and private keys For RSA, it is just as hard to find e from d as it is to find d from e. That s because RSA is completely symmetric in e and d. Not all cryptosystems enjoy this symmetry property. CPSC 467, Lecture 11 7/37

Signatures from non-commutative cryptosystems ElGamal cryptosystem is not symmetric The ElGamal scheme discussed in lecture 10 is based on the equation b = g y (mod p), where y is private and b public. Finding y from b, g, p is the discrete log problem believed to be hard. Finding b from y, g, p, is straightforward, so the roles of public and private key cannot be interchanged while preserving security. ElGamal found a different way to use the ideas of discrete logarithm to build a signature scheme, which we discuss later. CPSC 467, Lecture 11 8/37

Security of Digital Signatures CPSC 467, Lecture 11 9/37

Forgery Desired security properties of digital signatures Digital signatures must be difficult to forge. Some increasingly stringent notions of forgery-resistance: Resistance to forging valid signature for particular message m. Above, but where adversary knows a set of valid signed messages (m 1, s 1 ),..., (m k, s k ), and m {m 1,..., m k }. Above, but where adversary can choose a set of valid signed messages, specifying either the messages (corresponding to a chosen plaintext attack) or the signatures (corresponding to chosen ciphertext attack). Any of the above, but where one wishes to protect against generating any valid signed message (m, s ) different from those already seen, not just for a particular predetermined m. This is called existential forgery. CPSC 467, Lecture 11 10/37

Forgery Forging random RSA signed messages RSA signatures are indeed vulnerable to existential forgery. An attacker simply chooses s at random and computes m = E e (s ). The signed message (m, s ) is trivially valid since the verification predicate is simply m = E e (s ). CPSC 467, Lecture 11 11/37

Forgery Importance of random signed messages One often wants to sign random strings. For example, in the Diffie-Hellman key exchange protocol discussed in lecture 10, Alice and Bob exchange random-looking numbers a = g x mod p and b = g y mod p. In order to discourage man-in-the-middle attacks, they may wish to sign these strings (assuming they already have each other s public verification keys). With RSA signatures, Mallory could feed bogus signed values to Alice and Bob. The signatures would check, and both would think they had successfully established a shared key k when in fact they had not. CPSC 467, Lecture 11 12/37

Adding redundancy Adding redundancy Redundancy can be used to prevent existential forgery. For example, we can prefix a fixed string σ to the front of each message before signing. This gives rise to a variant signature scheme (S σ d, V σ e ). Signing function: S σ d (m) = D d(σm) Verification predicate: V σ e (m, s) σm = E e (s). CPSC 467, Lecture 11 13/37

Adding redundancy Security of signatures with fixed redundancy The security of this scheme depends on the mixing properties of the encryption and decryption functions, that is, that each output bit depends on most of the input bits. Not all cryptosystems have this mixing property. For example, a block cipher used in ECB mode (see lecture 5 and lecture 8) encrypts a block at a time, so each block of output bits depends only on the corresponding block of input bits. CPSC 467, Lecture 11 14/37

Adding redundancy Forging signatures with fixed redundancy Suppose it happens that S σ d (m) = D d(σm) = D d (σ) D d (m). Then Mallory can forge random messages assuming he knows just one valid signed message (m 0, s 0 ). Here s how. He knows that s 0 = D d (σ) D d (m), so from s 0 he extracts the prefix s 00 = D d (σ). He now chooses a random s 01 and computes m = E e (s 01 ) and s = s 00 s 01. The signed message (m, s ) is valid since E e (s ) = E e (s 00 s 01 ) = E e(s 00 ) E e (s 01 ) = σm. CPSC 467, Lecture 11 15/37

Signing message digests Signing message digests A better way to prevent forgery is to sign a message digest of the message rather than sign m itself. A message digest function h, also called a cryptographic one-way hash function or a fingerprint function, maps long strings to short random-looking strings. To sign a message m, Alice computes S d (m) = D d (h(m)). To verify the signature s, Bob checks that h(m) = E e (s). CPSC 467, Lecture 11 16/37

Signing message digests Forging signed message digests For Mallory to generate a forged signed message (m, s ) he must somehow come up with m and s satisfying h(m ) = E e (s ) (1) That is, he must find m and s that both map to the same string, where m is mapped by h and s by E e. Two natural approaches for attempting to satisfying (1): 1. Pick m at random and solve for s. 2. Pick s at random and solve for m. CPSC 467, Lecture 11 17/37

Signing message digests Solving for s Approach 1: To solve for s given m requires computing h(m ) = E e (s ) (1) E 1 e (h(m )) = D d (h(m )) = s. Alice can compute D d, which is what enables her to sign messages. But Mallory presumably cannot compute D d without knowing d, for if he could, he could also break the underlying cryptosystem. CPSC 467, Lecture 11 18/37

Signing message digests Solving for m Approach 2: h(m ) = E e (s ) (1) To solve for m given s requires inverting h. Since h is many-one, a value y = E e (s ) can have many inverses or preimages. To successfully forge a signed message, Mallory needs to find only one value m such that h(m ) = E e (s ). However, the defining property of a cryptographic hash function is that, given y, it should be hard to find any x h 1 (y). Hence, Mallory cannot feasibly find m satisfying 1. CPSC 467, Lecture 11 19/37

Signing message digests Other attempts Of course, these are not the only two approaches that Mallory might take. Perhaps there are ways of generating valid signed messages (m, s ) where m and s are generated together. I do not know of such a method, but this doesn t say one doesn t exist. CPSC 467, Lecture 11 20/37

Signing message digests More advantages of signing message digests Another advantage of signing message digests rather than signing messages directly: the signatures are shorter. An RSA signature of m is roughly the same length as m. An RSA signature of h(m) is a fixed length, regardless of how long m is. For both reasons of security and efficiency, signed message digests are what is used in practice. We ll talk more about message digests later on. CPSC 467, Lecture 11 21/37

Using Digital Signatures CPSC 467, Lecture 11 22/37

Signed encrypted messages Signed encrypted messages One often wants to encrypt messages for privacy and sign them for integrity and authenticity. Let Alice have cryptosystem (E, D) and signature system (S, V ). Some possibilities for encrypting and signing a message m: 1. Alice separately encrypts and signs the message and sends the pair E(m) S(m). 2. Alice signs the encrypted message and sends the pair E(m) S(E(m)). 3. Alice encrypts the signed message and sends the result E(m S(m)). Here we assume a standard way of representing the ordered pair (x, y) as a string, which we denote by x y. CPSC 467, Lecture 11 23/37

Signed encrypted messages Weakness of encrypt-and-sign Method 1, sending the pair E(m) S(m), is quite problematic since signature functions make no guarantee of privacy. We can construct a signature scheme (S, V ) in which the plaintext message is part of the signature itself. If (S, V ) is used as the signature scheme in method 1, there is no privacy, for the plaintext message can be read directly from the signature. CPSC 467, Lecture 11 24/37

Signed encrypted messages A forgery-resistant signature scheme with no privacy We construct a contrived but valid signature scheme in order to prove that not all signature schemes hide the message. Let (S, V ) be an RSA signature scheme. Define Facts S (m) = m S(m) ; V (m, s) = t(s = m t V (m, t)). (S, V ) is at least as secure as (S, V ). S leaks m. Why? Suppose a forger produces a valid signed message (m, s) in (S, V ), so s = m t for some t and V (m, t) holds.. Then (m, t) is a valid signed message in (S, V ). CPSC 467, Lecture 11 25/37

Signed encrypted messages Encrypt first Recall method 2 (encrypt first): (E(m), S(E(m))). This allows Eve to verify that the signed message was sent by Alice, even though Eve cannot read it. Whether or not this property is desirable is application-dependent. More importantly, if a signature scheme such as RSA is used that allows forging valid signed random messages, then Mallory could forge a ciphertext c with Alice s valid signature s. Bob, believing c is valid, might proceed to decrypt c and act on the resulting message m. CPSC 467, Lecture 11 26/37

Signed encrypted messages Sign first Recall method 3 (sign first): E(m S(m)). This forces Bob to decrypt a bogus message before discovering that it wasn t sent by Alice. This method also fails if Mallory can forge a valid signed random message (m, s), for Mallory can proceed to encrypt m s (using Bob s public encryption key) and the result looks like it was produced by Alice. CPSC 467, Lecture 11 27/37

Signed encrypted messages Combining protocols Subtleties emerge when cryptographic protocols are combined, even in a simple case like this where it is only desired to combine privacy with authenticity. Think about the pros and cons of other possibilities, such as sign-encrypt-sign, i.e., (E(m S(m)), S(E(m S(m)))). Does it also fail with forged random signed messages? CPSC 467, Lecture 11 28/37

Practical Signature Algorithms CPSC 467, Lecture 11 29/37

ElGamal digital signature scheme ElGamal signature scheme The private signing key consists of a primitive root g of a prime p and a random exponent x. The public verification key consists of g, p, and a, where a = g x mod p. To sign m: 1. Choose random y Z φ(p). 2. Compute b = g y mod p. 3. Compute c = (m xb)y 1 mod φ(p). 4. Signature s = (b, c). To verify (m, s), where s = (b, c): 1. Check that a b b c g m (mod p). CPSC 467, Lecture 11 30/37

ElGamal digital signature scheme Why do ElGamal signatures work? We have a = g x mod p b = g y mod p c = (m xb)y 1 mod φ(p). Want that a b b c g m (mod p). Substituting, we get a b b c (g x ) b (g y ) c g xb+yc g m (mod p) since xb + yc m (mod φ(p)). 1 1 Note the use of the identity from lecture 10 u v (mod φ(p)) g u g v (mod p). CPSC 467, Lecture 11 31/37

Digital signature algorithm (DSA) Digital signature standard The commonly-used Digital Signature Algorithm (DSA) is a variant of ElGamal signatures. Also called the Digital Signature Standard (DSS), it is described in U.S. Federal Information Processing Standard FIPS 186 4. It uses two primes: p, which is 1024 bits long, 2 and q, which is 160 bits long and satisfies q (p 1). Here s how to find them: Choose q first, then search for z such that zq + 1 is prime and of the right length. Choose p = zq + 1 for such a z. 2 The original standard specified that the length L of p should be a multiple of 64 lying between 512 and 1024, and the length N of q should be 160. Revision 2, Change Notice 1 increased L to 1024. Revision 3 allows four (L, N) pairs: (1024, 160), (2048, 224), (2048, 256), (3072, 256). CPSC 467, Lecture 11 32/37

Digital signature algorithm (DSA) DSA key generation Given primes p and q of the right lengths such that q (p 1), here s how to generate a DSA key. Let g = h (p 1)/q mod p for any h Z p for which g > 1. This ensures that g Z p is a non-trivial q th root of unity modulo p. Let x Z q. Let a = g x mod p. Private signing key: (p, q, g, x). Public verification key: (p, q, g, a). CPSC 467, Lecture 11 33/37

Digital signature algorithm (DSA) DSA signing and verification Here s how signing and verification work: To sign m: 1. Choose random y Z q. 2. Compute b = (g y mod p) mod q. 3. Compute c = (m + xb)y 1 mod q. 4. Output signature s = (b, c). To verify (m, s), where s = (b, c): 1. Verify that b, c Z q; reject if not. 2. Compute u 1 = mc 1 mod q. 3. Compute u 2 = bc 1 mod q. 4. Compute v = (g u 1 a u 2 mod p) mod q. 5. Check v = b. CPSC 467, Lecture 11 34/37

Digital signature algorithm (DSA) Why DSA works To see why this works, note that since g q 1 (mod p), then r s (mod q) implies g r g s (mod p). This follows from the fact that g is a q th root of unity modulo p, so g r+uq g r (g q ) u g r (mod p) for any u. Hence, g u 1 a u 2 g mc 1 +xbc 1 g y (mod p). (2) g u 1 a u 2 mod p = g y mod p (3) v = (g u 1 a u 2 mod p) mod q = (g y mod p) mod q = b as desired. (Notice the shift between equivalence modulo p in equation 2 and equality of remainders modulo p in equation 3.) CPSC 467, Lecture 11 35/37

Digital signature algorithm (DSA) Double remaindering DSA uses the technique of computing a number modulo p and then modulo q. Call this function f p,q (n) = (n mod p) mod q. f p,q (n) is not the same as n mod r for any modulus r, nor is it the same as f q,p (n) = (n mod q) mod p. CPSC 467, Lecture 11 36/37

Digital signature algorithm (DSA) Example mod 29 mod 7 To understand better what s going on, let s look at an example. Take p = 29 and q = 7. Then 7 (29 1), so this is a valid DSA prime pair. The table below lists the first 29 values of y = f 29,7 (n): n 0 1 2 3 4 5 6 7 8 9 10 11 12 13 y 0 1 2 3 4 5 6 0 1 2 3 4 5 6 n 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 y 0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 The sequence of function values repeats after this point with a period of length 29. Note that it both begins and ends with 0, so there is a double 0 every 29 values. That behavior cannot occur modulo any number r. That behavior is also different from f 7,29 (n), which is equal to n mod 7 and has period 7. (Why?) CPSC 467, Lecture 11 37/37