1 / 54

Network Security Essentials Chapter 3

Network Security Essentials Chapter 3. Fourth Edition by William Stallings (Based on Lecture slides by Lawrie Brown). Public Key Cryptography and RSA.

yaholo
Download Presentation

Network Security Essentials Chapter 3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Network Security EssentialsChapter 3 Fourth Edition by William Stallings (Based on Lecture slides by Lawrie Brown)

  2. Public Key Cryptography and RSA Every Egyptian received two names, which were known respectively as the true name and the good name, or the great name and the little name; and while the good or little name was made public, the true or great name appears to have been carefully concealed. —The Golden Bough, Sir James George Frazer

  3. Outline • Message authentication (Ref. Chap.12) • Secure hash functions (Ref. Chap.11) • Message authentication codes (Ref. Chap.12) • Public-key cryptography (Ref. Chap.9) • Digital signatures (Ref. Chap.13)

  4. Message Authentication • To protect against passive attacks • Encryption • To protect against active attacks • Message authentication

  5. Message Authentication • Message authentication is concerned with: • Protecting the integrity of a message • Validating identity of originator • Non-repudiation of origin (dispute resolution) • The three alternative functions used: • Message encryption • Hash function • Message authentication code (MAC)

  6. Authentication using conventional encryption • Not suitable, e.g. block reordering in ECB mode • Authentication without encryption • Broadcast • Heavy loads • Authentication of a program in plaintext

  7. Message Authentication Code

  8. MACM=F(KAB, M) • Message not altered • The alleged sender confirmed • The proper sequence of messages assured • Similar to encryption • NIST recommends the use of DES • One difference: authentication algorithm need not be reversible, less vulnerable

  9. Hash Functions • Condenses arbitrary message to fixed size h = H(M) • No secret key needed • Usually assume hash function is public • Hash used to detect changes to message • We want a cryptographic hash function • Computationally infeasible to find data mapping to specific hash (one-way property) • Computationally infeasible to find two data to the same hash (collision-free property)

  10. Message authentication using a one-way hash function • Using conventional encryption (Fig.3.2a) • Using public-key encryption (Fig.3.2b) • Using secret value (Fig.3.2c) • MDM=H(SAB||M), then send [M||MDM] • E.g. HMAC adopted for IP security • Reasons for avoiding encryption • Encryption software quite slow • Encryption hardware costs nonnegligible • Encryption hardware optimized for large data sizes • Encryption algorithm protected by a patent

  11. Two Simple Insecure Hash Functions • Consider two simple insecure hash functions • Bit-by-bit exclusive-OR (XOR) of every block • Ci = bi1 xor bi2 xor . . . xor bim • A longitudinal redundancy check • Reasonably effective as data integrity check • One-bit circular shift on hash value • For each successive n-bit block • Rotate current hash value to left by 1bit and XOR block • Good for data integrity but useless for security

  12. Simple Hash Function Using Bitwise XOR

  13. Hash Function Requirements

  14. Attacks on Hash Functions • Have brute-force attacks and cryptanalysis • A preimage or second preimage attack • Find ys.t.H(y) equals a given hash value • Collision resistance • Find two messages x & ywith the same hash H(x) = H(y) • Protection against birthday attack • Hence value 2m/2 determines strength of hash code against brute-force attacks • 128-bits inadequate, 160-bits suspect

  15. Secure Hash Algorithm • SHA originally designed by NIST & NSA in 1993 • Was revised in 1995 as SHA-1 • US standard for use with DSA signature scheme • Standard is FIPS 180-1 1995, also Internet RFC3174 • nb. the algorithm is SHA, the standard is SHS • Based on design of MD4 with key differences • Produces 160-bit hash values • Recent 2005 results on security of SHA-1 have raised concerns on its use in future applications

  16. Revised Secure Hash Standard • NIST issued revision FIPS 180-2 in 2002 • Adds 3 additional versions of SHA: SHA-256, SHA-384, SHA-512 • Designed for compatibility with increased security provided by the AES cipher • Structure & detail is similar to SHA-1 • Hence analysis should be similar, but security levels are rather higher • NIST FIPS 180-3 (in 2008) adds SHA-224 • RFC 4634 details SHA-224, -256, -384, -512

  17. SHA Versions

  18. SHA-512 Overview

  19. SHA-512 Compression Function • Heart of the algorithm • Processing message in 1024-bit blocks • Consists of 80 rounds • Updating a 512-bit buffer • Using a 64-bit value Wt derived from the current message block • And a round constant Kt based on cube roots of the first 80 prime numbers

  20. Keyed Hash Functions as MACs • Want a MAC based on a hash function • Because hash functions are generally faster • Crypto hash function code is widely available • Hash includes a key along with message • Original proposal: KeyedHash = Hash(Key|Message) • Some weaknesses were found with this • Eventually led to development of HMAC

  21. HMAC Design Objectives • Use, without modifications, hash functions • Allow for easy replaceability of embedded hash function • Preserve original performance of hash function without significant degradation • Use and handle keys in a simple way • Have well understood cryptographic analysis of authentication mechanism strength

  22. HMAC • Specified as Internet standard RFC2104 • Uses hash function on the message: HMACK(M)= Hash[(K+ XOR opad) || Hash[(K+ XOR ipad) || M)] ] • where K+is the key padded out to size • opad, ipadare specified padding constants • Overhead is just 3 more hash calculations than the message needs alone • Any hash function can be used • E.g. MD5, SHA-1, RIPEMD-160, Whirlpool

  23. HMAC Overview

  24. HMAC Security • Proved security of HMAC relates to that of the underlying hash algorithm • Attacking HMAC requires either: • Brute force attack on key used • Birthday attack (but since keyed would need to observe a very large number of messages) • Choose hash function used based on speed verses security constraints • MD5 vs. SHA-1

  25. MACs based on Block Ciphers CMAC CCM

  26. CMAC • Previously saw the DAA (CBC-MAC) • Widely used in govt & industry • But has message size limitation • Can overcome using 2 keys & padding • Thus forming the Cipher-based Message Authentication Code (CMAC) • Adopted by NIST SP800-38B

  27. CMAC Overview

  28. Authenticated Encryption • Simultaneously protect confidentiality and authenticity of communications • Often required but usually separate • Approaches • Hash-then-encrypt: E(K, (M || H(M)) • MAC-then-encrypt: E(K2, (M || MAC(K1, M)) • Encrypt-then-MAC: C=E(K2, M), T=MAC(K1, C) • Encrypt-and-MAC: C=E(K2, M), T=MAC(K1, M) • Decryption /verification straightforward • But security vulnerabilities with all these • E.g. HtE used in WEP (Wired Equivalent Privacy)

  29. Counter with Cipher Block Chaining-Message Authentication Code (CCM) • NIST standard SP 800-38C for WiFi • Variation of encrypt-and-MAC approach • Algorithmic ingredients • AES encryption algorithm • CTR mode of operation • CMAC authentication algorithm • Single key used for both encryption & MAC

  30. CCM Operation

  31. Private-Key Cryptography • Traditional private/secret/single key cryptography uses one key • Shared by both sender and receiver • If this key is disclosed communications are compromised • Also is symmetric, parties are equal • Hence does not protect sender from receiver forging a message & claiming is sent by sender

  32. Public-Key Cryptography • Probably the most significant advance in the 3000 year history of cryptography • Uses two keys – a public & a private key • Asymmetric since parties are not equal • Uses clever application of number theoretic concepts to function • Complements rather than replaces private key cryptography

  33. Why Public-Key Cryptography? • Developed to address two key issues: • Key distribution – how to have secure communications in general without having to trust a KDC with your key • Digital signatures – how to verify a message comes intact from the claimed sender • Public invention due to Whitfield Diffie & Martin Hellman at Stanford Univ. in 1976 • Known earlier in classified community

  34. Public-Key Cryptography • Public-key/two-key/asymmetric cryptography involves the use of two keys: • A public-key, which may be known by anybody, and can be used to encrypt messages, and verify signatures • A related private-key, known only to the recipient, used to decrypt messages, and sign (create) signatures • Infeasible to determine private key from public • Is asymmetric because • Those who encrypt messages or verify signatures cannot decrypt messages or create signatures

  35. Public-Key Cryptography

  36. Symmetric vs Public-Key

  37. RSA • By Rivest, Shamir & Adleman of MIT in 1977 • Best known & widely used public-key scheme • Based on exponentiation in a finite (Galois) field over integers modulo a prime • nb. exponentiation takes O((log n)3) operations (easy) • Uses large integers (eg. 1024 bits) • Security due to cost of factoring large numbers • nb. factorization takes O(e log n log log n) operations (hard)

  38. RSA En/decryption • To encrypt a message M the sender: • Obtains public key of recipient PU={e,n} • Computes: C = Me mod n, where 0≤M<n • To decrypt the ciphertext C the owner: • Uses their private key PR={d,n} • Computes: M = Cd mod n • Note that the message M must be smaller than the modulus n (block if needed)

  39. RSA Key Setup • Each user generates a public/private key pair by: • Selecting two large primes at random: p, q • Computing their system modulus n=p.q • note ø(n)=(p-1)(q-1) • Selecting at random the encryption key e • where 1<e<ø(n), gcd(e,ø(n))=1 • Solve following equation to find decryption key d • e.d=1 mod ø(n) and 0≤d≤n • Publish their public encryption key: PU={e,n} • Keep secret private decryption key: PR={d,n}

  40. Why RSA Works • Because of Euler's Theorem: • aø(n)mod n = 1 where gcd(a,n)=1 • In RSA have: • n=p.q • ø(n)=(p-1)(q-1) • Carefully chose e & d to be inverses mod ø(n) • Hence e.d=1+k.ø(n) for some k • Hence :Cd = Me.d = M1+k.ø(n) = M1.(Mø(n))k = M1.(1)k = M1 = M mod n

  41. RSA Example - Key Setup • Select primes: p=17 & q=11 • Calculate n = pq =17 x 11=187 • Calculate ø(n)=(p–1)(q-1)=16x10=160 • Select e:gcd(e,160)=1; choose e=7 • Determine d:de=1 mod 160 and d < 160 Value is d=23 since 23x7=161= 10x160+1 • Publish public key PU={7,187} • Keep secret private key PR={23,187}

  42. RSA Example - En/Decryption • Sample RSA encryption/decryption is: • Given message M = 88 (nb.88<187) • Encryption: C = 887 mod 187 = 11 • Decryption: M = 1123 mod 187 = 88

  43. Diffie-Hellman Key Exchange • First public-key type scheme proposed • By Diffie & Hellman in 1976 along with the exposition of public key concepts • Note: now know that Williamson (UK CESG) secretly proposed the concept in 1970 • Is a practical method for public exchange of a secret key • Used in a number of commercial products

  44. Diffie-Hellman Key Exchange • A public-key distribution scheme • Cannot be used to exchange an arbitrary message • Rather it can establish a common key • Known only to the two participants • Value of key depends on the participants (and their private and public key information) • Based on exponentiation in a finite (Galois) field (modulo a prime or a polynomial) - easy • Security relies on the difficulty of computing discrete logarithms (similar to factoring) – hard

  45. Discrete Logarithm • Ordinary logarithm: • ax=b • x=loga(b) • Discrete logarithm: • b=ai mod p (0  i  p-1) • a: primitive root of prime number p • Can generate all integers from 1 to p-1 • i.e. a1 mod p, a2 mod p, ap-1 mod p are distinct • i=dloga,p(b)

  46. Diffie-Hellman Setup • All users agree on global parameters: • Large prime integer or polynomial q • a being a primitive root mod q • Each user (eg. A) generates their key • Chooses a secret key (number): xA < q • Compute their public key: yA = axA mod q • Each user makes public that key yA

  47. Diffie-Hellman Key Exchange • Shared session key for users A & B is KAB: KAB = axA.xB mod q = yAxB mod q (which B can compute) = yBxA mod q (which A can compute) • KAB is used as session key in private-key encryption scheme between Alice and Bob • If Alice and Bob subsequently communicate, they will have the same key as before, unless they choose new public-keys • Attacker needs an x, must solve discrete log from the corresponding y

  48. Diffie-Hellman Example • Users Alice & Bob who wish to swap keys: • Agree on prime q=353 and a=3 • Select random secret keys: • A chooses xA=97, B chooses xB=233 • Compute respective public keys: • yA=397 mod 353 = 40 (Alice) • yB=3233 mod 353 = 248 (Bob) • Compute shared session key as: • KAB= yBxA mod 353 = 24897= 160 (Alice) • KAB= yAxB mod 353 = 40233 = 160 (Bob)

  49. Key Exchange Protocols • Users could create random private/public D-H keys each time they communicate • (Fig. 3.13) • Users could create a known private/public D-H key and publish in a directory, then consulted and used to securely communicate with them • Both of these are vulnerable to a meet-in-the-Middle Attack • Authentication of the keys is needed

More Related