Network Security Essentials: Fourth Edition by William Stallings Lecture Slides by Lawrie Brown
Network Security Essentials: Fourth Edition by William Stallings Lecture Slides by Lawrie Brown
Message Authentication
message authentication is concerned with:
protecting the integrity of a message validating identity of originator non-repudiation of origin (dispute resolution)
Hash Functions
condenses arbitrary message to fixed size
h = H(M)
usually assume hash function is public hash used to detect changes to message want a cryptographic hash function
computationally infeasible to find data mapping to specific hash (one-way property) computationally infeasible to find two data to same hash (collision-free property)
collision resistance
find two messages x & y with same hash so H(x) = H(y)
hence value 2m/2 determines strength of hash code against brute-force attacks
128-bits inadequate, 160-bits suspect
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
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
SHA Versions
SHA-1 SHA-224 SHA-256 SHA-384 SHA-512 224 < 264 512 32 64 256 < 264 512 32 64 384 < 2128 1024 64 80 512 < 2128 1024 64 80
SHA-512 Overview
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, ipad are specified padding constants
overhead is just 3 more hash calculations than the message needs alone any hash function can be used
eg. MD5, SHA-1, RIPEMD-160, Whirlpool
HMAC Overview
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)
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
CMAC Overview
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)
CCM Operation
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
Public-Key Cryptography
probably 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 crypto
public invention due to Whitfield Diffie & Martin Hellman at Stanford Uni in 1976
known earlier in classified community
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
Public-Key Cryptography
Symmetric vs Public-Key
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)
RSA En/decryption
to encrypt a message M the sender:
obtains public key of recipient PU={e,n} computes: C = Me mod n, where 0M<n
note that the message M must be smaller than the modulus n (block if needed)
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 0dn publish their public encryption key: PU={e,n} keep secret private decryption key: PR={d,n}
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
decryption:
M = 1123 mod 187 = 88
is a practical method for public exchange of a secret key used in a number of commercial products
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
Diffie-Hellman Setup
all users agree on global parameters:
large prime integer or polynomial q a being a primitive root mod q
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
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
KAB= yB A mod 353 = 248 = 160 x 233 KAB= yA B mod 353 = 40 = 160
97
(Alice) (Bob)
Man-in-the-Middle Attack
1. Darth prepares by creating two private / public keys 2. Alice transmits her public key to Bob 3. Darth intercepts this and transmits his first public key to Bob. Darth also calculates a shared key with Alice 4. Bob receives the public key and calculates the shared key (with Darth instead of Alice) 5. Bob transmits his public key to Alice 6. Darth intercepts this and transmits his second public key to Alice. Darth calculates a shared key with Bob 7. Alice receives the key and calculates the shared key (with Darth instead of Bob) Darth can then intercept, decrypt, re-encrypt, forward all messages between Alice & Bob
Digital Signatures
have looked at message authentication
but does not address issues of lack of trust