Conventional Cryptography
Conventional Cryptography
Security Considerations
– Larger block size results in fewer blocks and increased security
– Larger key size also increases security (recall Shannon)
– More rounds considered to offer better security (?)
– Greater complexity of subkey generation may help security
– Greater complexity of round function may increase security
Design Goals for Block Ciphers
Highly secure – more of everything…
Diffusion
– Good avalanche effect – 1 bit difference in plaintext quickly results
in a large difference in bits, even after few rounds
Performance
– Software implementations were slow
• On IBM Mainframe 32,000 blocks / second
Ki
Pi Ci
A pseudorandom keystream generator
– Keystream depends only on generating key
Other options
– Keystream may change according also to previous encryptions,
block index, etc.
– In synchronous stream ciphers, keystream does not depend on text,
otherwise, it is called self-synchronizing
RC4
Byte-based stream cipher, with variable key size
Uses an S-box, with all possible 8-bit key-entries
– Initialized so that S[i]=i, i=0…255
– S[i]’s are initially permuted, based on the key
• j=0
• for i=0 to 255
– j=(j+S[i]+K[i]) mod 256; // K[i] is original key
– Swap S[i] and S[j]
In each iteration
– Indices i,j are updated
• i=i+1 mod 256; j=(j+S[i]) mod 256
– S[i] and S[j] are swapped for current i,j
– K=S[(S[i]+S[j] mod 256]
– The keystream K is then XORed with the plaintext
General Security 3 2 2 3 3
Implementation of Security 1 1 3 3 2
Software Performance 2 2 3 1 1
Smart Card Performance 1 1 3 3 2
Hardware Performance 1 2 3 3 2
Design Features 2 1 2 1 3
K E K E K E
K1 K2 Kn
P1 P2 Pn
…
C1 C2 Cn
Errors
– A bit of error in the plaintext affects all subsequent blocks but does
not extend the error when decrypted
– A bit of error in the ciphertext affects same bit and next block, after
which CFB self synchronizes
Output Feedback Mode (OFB)
IV
K E K E K E
K1 K2 … Kn
P1 P2 Pn
C1 C2 Cn
Repeatedly encrypt IV
Counter Mode (CTR)
Counter Counter+1 Counter+n-1
K E K E K E
K1 K2 Kn
P1 P2 Pn
…
C1 C2 Cn
Advantages:
– Parallelism
– Random access to specific block
– Requires only the encryption algorithm (advantageous when E and
D have different algorithms, e.g. AES)
Summary
Application of block ciphers to arbitrary-sized
messages
Link encryption
– Typically can use physical
delivery, at least for master
keys
End-to-end encryption
– Physical delivery can be hard to implement
– Peer-to-peer encryption of keys is dangerous (catch one, catch all)
– Can use pre-set key, or a key generated concurrently by a token
– Can also use keys delivered by third party (data keys)
– Later we’ll see use of public key schemes
Session Key Distribution by KDC
Ticket
Grant Granting
Server Server
Req
Req Server
Service Ticket
Client Grant
Server TGS
Req Kerberos
TGS Authentication
Ticket Server (AS)
Review: Key Management Principles
To reduce the risk of eavesdropping
– use different keys for different purposes
– generate new keys from old ones using hash function
To reduce the risk of impersonation
– use mutual authentication when exchanging keys
To reduce the risk of computer/physical break-in
– store most keys encrypted using master key
– save master keys in human memory, smart card, token, etc.
– use tamper-proof hardware to store keys
– destroy media on which keys were stored, even if were encrypted
Other principles:
– Replace keys frequently
– Report compromised keys to KDC with timestamp
– Backup keys shall be broken and spread
Message Authentication
Using Conventional
Cryptography
Technical Requirements
– Verify that the message is authentic
– Verify that source is authentic
• Destination is verified through protocol
Message Authentication Approaches
Conventional encryption
– Relies on the exclusivity and confidentiality of the key
Hash functions
– A public function that maps the message to an
authentication tag (no key!)
HMAC
– Combination of hash and MAC
Message Authentication Code
MAC Properties
Message is authentic
– If the attacker modified the message, the MAC will likely not
match the one calculated by the receiver
Source is authentic
– No one else has the key to generate same MAC
– Hence, also non-repudiation (other party knows source)
Message is in sequence
– Should add timestamp or other nonce to the message before
calculating the MAC
Collision Resistance
– H(M) should be hard to duplicate , i.e., given M it is hard to find
M’ such that H(M)=H(M’)
– Sometimes, we may need strong collision resistance, i.e., hard to
find arbitrary M, M’ such that H(M)=H(M’)
Not very secure, e.g., for English text (ASCII<128) the high-order bit
is always zero
Can be improved by rotating the hash code after each block is XORed
into it
Beware of a man-in-the-middle attack: if the message itself is not
encrypted, it is easy to modify the message and append one block that
would set the hash code as needed
Cryptographic One-Way Hash
Functions
Cryptographic hash functions are typically based on
compression functions (f) that work on blocks (Mi)
This structure (Merkle), resembles a Chained Block Cipher
– Produces a hash value for each fixed-size block based on its
content and based on the hash value for the previous block
M1 M2 Mn
h1 h2 hn-1
IV f f … f h
Recent attacks on SHA-1 (2005) reduce the effective search space for a
colliding message M’ such that H(M)=H(M’)
SHA-2, offered as a response, allows 256/512 bit digests
NIST published a call for a new design (SHA-3) for 2012
Variable Length Hash Codes
Some hash functions have good cryptographic qualities
(confusion and diffusion), but generate short hash codes
– If the message digest is too short, it may be easier for the receiver
to forge another message with same hash code (collision)
– Similarly, easier to find a (message, hashcode) pair that match
• Use the Birthday Paradox to select a “good” message on which the
sender will sign, and a “fraudulent” message that would replace it
K1 and K2 selected to
maximize difference
– K+ =K padded with 0’s
– ipad= 00110110 x b/8
– opad=01011100 x b/8
Main methods:
– Symmetric cryptography
– Message Authentication Codes
– HMACs (using one-way crypto hash functions)
Next Class
Public key Cryptography