Terminology
- Cryptography: the study of designing systems
- Cryptoanalysis: the study of breaking systems
- Steganography; the study of concealing information; not covered in this course
Cryptography transforms data based on a secret called the key. It provides confidentiality and authentication:
- Confidentiality: key needed to read the message
- Authentication: key needed to write the message
Cryptosystems:
- A set of plaintexts holding the original message
- A set of ciphertexts holding the encrypted message
- Sometimes called cryptogram
- A set of keys
- A function called the encryption or encipherment which transforms the plaintext into a ciphertext
- An inverse function called the decryption or decipherment which transforms the ciphertext into the plaintext
Symmetric key cipher (secret key cipher):
- Encryption/decryption keys known only to the sender/receiver
- Secure channel required for transmission of keys
Asymmetric key cipher (public key cipher):
- Each participant has a public and private key
- Can be used to both encrypt messages and create digital signatures
Notation for Symmetric Encryption Algorithms
- Encryption function
- Decryption function
- Message/plaintext
- Cryptogram/ciphertext
- Shared secret key
Encryption:
Decryption:
Methods of Cryptanalysis
What resources are available to the adversary? Computational capabilities, inputs/outputs to the systems, etc.
What is the adversary aiming to achieve? Retrieving the whole secret key? Distinguishing between two messages?
Exhaustive Key Search
Adversary tries all possible keys. Impossible to prevent such attacks; can only ensure there are enough keys to make exhaustive search too difficult computationally.
Note that the adversary may find the key without exhaustive search or even break the cryptosystem without finding the key.
Preventing exhaustive key search is a minimum standard.
Attack Classification
Ciphertext only attack: the attacker has access only to intercepted ciphertexts.
A cryptosystem is highly insecure if it can be practically attacked using only intercepted ciphertexts.
Known plaintext attack: the attacker knows a small amount of plaintexts and their corresponding ciphertexts.
Chosen plaintext attack: the attacker can obtain the ciphertext from some plaintext it has selected (attacker has ‘inside encryptor’).
Chosen ciphertext attack: the attacker can obtain the plaintext from some ciphertext it has selected (attacker has ‘inside decryptor’).
A cryptosystem should be secure against chosen plaintext and ciphertext attacks.
Kerckhoff’s Principle
Kerckoff’s Principle states the that the attacker has complete knowledge of the cipher; the decryption key is the only item unknown to the attacker.
Secret, non-standard algorithms are often flawed, providing mainly security through obscurity.
Alphabets
Historical ciphers: define alphabet for the plaintext and ciphertext
Roman alphabet:
- Sometimes it includes spaces, upper/lowercase characters, punctuation
- Sometimes maps the alphabet to numbers:
Statistical attacks depend on using the redundancy of the alphabet:
- Distribution of single letters, digrams, trigrams are used
- Exact statistics vary by sample
Basic Cipher Operations
Transposition: characters in plaintext are mixed up with each other (permutations)
Substitution: each character is replaced by a different character
Transposition Cipher
Permuting characters in a fixed period
The plaintext is seen as a matrix with
Key is
There are
Cryptanalysis
Frequency distribution of ciphertext and plaintext characters are the same.
If
Knowledge of plaintext language digram/trigrams can help to optimize trials.
Simple Substitution Ciphers
Each character in plaintext alphabet replaced by character in ciphertext alphabet using a substitution table.
This is called a monoaphabetic substitution cipher.
Caesar cipher:
-
th letter of the alphabet mapped to the th letter using the key - Encryption:
- Decryption:
- Guess
by finding the most frequent character in the ciphertext and mapping it to the most frequent character in the language (e.g. (space), ‘e’)
Random simple substitution cipher:
- Each character assigned to a random character of the alphabet
- Encryption/decryption done using substitution table
- If the alphabet has
characters, there are keys - One-to-one mapping, so second character can only be assigned to
characters
- One-to-one mapping, so second character can only be assigned to
- Caesar cipher is a special case of the random simple substitution cipher
- Frequency analysis: use the most frequent characters, common di/trigrams such as ‘the’
Polyalphabetic Substitution
Multiple mappings from plaintext to ciphertext: smoothens frequency distribution.
Typically periodic substitution ciphers based on a period
Given
A plaintext message:
it is encrypted to:
If
Key generation:
- Select block length
- Generate
random simple substitution ciphers
Encryption: encrypt the
Decryption: use the same substitution table as encryption.
Vigenère Cipher
Based on shifted alphabets.
The key
Let
e.g. if
Cryptanalysis
Identifying period length:
- Kasiski method
- Cryptool uses autocorrelation to automatically estimate period
Once period identified, the
Autocorrelation
Given ciphertext
English is non-random; there is better correlation between two texts with the same shift size.
Find peaks in the value of
Kasiski Method
If you identify sequences of characters that occur multiple times, find the distance between them; the period is likely to be a multiple of the period.
If you find multiple sequences with different distances, the period is likely to be a common divisor.
Once the period is found, the separate alphabets can be attacked separately; at this point, it is just a Caesar cipher.
Other Ciphers (for use by hand)
Beaufort cipher: like Vigenère, but
Autokey: starts off as the Vigenère cipher, but the plaintext defines the subsequent alphabet. Hence, the cipher is not periodic.
Running key cipher: practically infinite set of alphabets generated from a shared key. This is ofen an extract from a book called the book cipher.
Rotor Machines
Enigma: each character encrypted with a different alphabet with a period of ~17,000; would never repeat in the same message (in practice).
Hill Cipher
Polygram/polygraphic cipher: simple substitution of an extended alphabet consisting of multiple characters.
Has linearity, making known plaintext attacks easy.
Given
Encryption: multiplying the
Decryption: multiplying the matrix
Example
Each plaintext pair written as column vector. If there are insufficient letters, they are filled with uncommon letters (e.g.
Plaintext:
Encryption:
Decryption:
Cryptanalysis
Known plaintext attacks possible given
-
-
-
, so
Then
Comments:
- The plaintext message
may not be invertible - Ciphertext-only attacks follow known plaintext attacks with the extra task of finding probable blocks of matching plaintext-ciphertext
- e.g. if
, the frequency distribution of non-overlapping pairs of ciphertext characters can be compared with the distribution of pairs of plaintext characters
- e.g. if
- Cryptool defaults to an alphabet of
(where is space)