Crypto
Crypto
CRYPTOGRAPHY
Dr. Sriram Sankaran, Amrita University
Lecture Outline
Introduction
Encryption
Hash functions
Message Authentication codes
Digital Signatures
Session key establishment protocols
Pseudo-random number generators
Advanced authentication techniques
Introduction to Cryptography
Cryptography focuses on the prevention of attacks
Not a panacea for security problems
Attacks can be classified into Passive and Active
Passive
Attempts to learn or make use of the system but does not affect
system resources
Examples: eavesdropping, traffic analysis
Hard to detect
Active
Attempts to alter or affect system operation
Examples: Spoofing, reply, modification, DoS
Difficult to prevent
Security Mechanisms
Encryption
Symmetric, Asymmetric key protocols
Digital Signatures
Access Control Schemes
Access Control Lists, Capabilities, Security labels
Data Integrity Mechanisms
Message Authentication Codes, Sequence numbering,
Timestamping, Cryptographic chaining
Authentication protocols
Passwords, Cryptographic challenge-response protocols,
biometrics
Traffic padding, route control
Classical Model of Encryption
Kerckhoff’s principle
We must assume that the adversary knows all details of E and D
Security of the system should be based on the protection of the
decryption key
Adversary Models
Ciphertext-only attack
the adversary can only observe ciphertexts produced by the same encryption
key
Known-plaintext attack
the adversary can obtain corresponding plaintext-ciphertext pairs produced
with the same encryption key
Related-key attack
the adversary can obtain ciphertexts, or plaintext-ciphertext pairs that are
produced with different encryption keys that are related in a known way to a
specific encryption key
Security of Encryption Schemes
An encryption scheme is secure in a given adversary
model if it is computationally infeasible for the
adversary to determine the target decryption key
under the assumptions of the given model
For many encryption schemes used in practice, no
proof of security exists
These schemes are used, nevertheless, because they are
efficient and they resist all known attacks
Some encryption schemes are provably secure,
however these schemes are often inefficient
Classification of Encryption Schemes
Symmetric-key encryption
it is easy to compute K’ from K (and vice versa)
usually K’ = K
two main types:
◼ stream ciphers – operate on individual characters of the
plaintext
◼ block ciphers – process the plaintext in larger blocks of
characters
Asymmetric-key encryption
it is hard (computationally infeasible) to compute K’
from K
K can be made public (→ public-key cryptography)
Popular Encryption Ciphers
Stream Cipher
One-Time-Pad
RC4
Block Cipher
DES/AES
RC5
Stream Ciphers
Processes the message bit by bit (as a stream)
Typically has a (pseudo) random stream key
Combined (XORed) with plaintext bit by bit
Randomness of stream key completely destroys any
statistical properties in the message
Ci = Mi XOR StreamKeyi
Stream key should not be reused
Vernam Cipher and One-time pad
Vernam cipher
ci = pi ki for i = 1, 2, …
where pi are the plaintext digits, ki are the key stream digits, ci
are the ciphertext digits, and is the bitwise XOR operation
One-time pad
a Vernam cipher where the key stream digits are generated
independently and uniformly at random
the one-time pad is unconditionally secure [Shannon, 1949]
◼ I(P; C) = H(P) - H(P|C) = 0
a necessary condition for a symmetric key cipher to be
unconditionally secure is that H(K) H(P) [Shannon, 1949]
◼ practically, the key must have as many bits as the compressed
plaintext
◼ impractical because of key management problems
Block Ciphers
Asymmetric-key encryption
it is hard (computationally infeasible) to compute K’ from K
K can be made public (public-key cryptography)
no need for key setup before communication
Public-keys are not confidential but they must be authentic !
Security of asymmetric-key encryption schemes is usually based on some
well-known or widely believed hard problems
Hardness of Asymmetric Cryptography
30/80
HMAC
Need for Salting
let us assume that the adversary observes a ciphertext
c = EK(m)
let the set of possible plaintexts be M
if M is small, then the adversary can try to encrypt every
message in M with the publicly known key K until she finds
the message m that maps into c
the usual way to prevent this attack is to randomize the
encryption
some random bytes are added to the plaintext message before
encryption through the application of the PKCS #1 formatting
rules
when the message is decrypted, the recipient can recognize and
discard these random bytes
El-Gamal Encryption Scheme
Key generation
generate a large random prime p and choose generator g of the multiplicative
group Zp* = {1, 2, …, p-1}
select a random integer a, 1 a p-2, and compute A = ga mod p
the public key is (p, g, A)
the private key is a
Encryption
represent the message as an integer m in [0, p-1]
select a random integer r, 1 r p-2, and compute R = gr mod p
compute C = mAr mod p
the ciphertext is the pair (R, C)
Decryption
compute m = CRp-1-a mod p
Proof of decryption
CRp-1-a mArRp-1-a mgargr(p-1-a) m(gp-1)r m (mod p)
Relation to hard problem
Security of the ElGamal scheme is said to be based
on the discrete logarithm problem in Zp*, although
equivalence has not been proven yet