Memra

The five ingredients of symmetric encryption

◈ 7 cards

Plaintext, encryption algorithm, secret key, ciphertext, decryption algorithm — plus the two requirements for secure use and the three dimensions every cipher is classified on.

Five ingredients, and only one of them is secret

A symmetric encryption scheme has exactly five parts, and an exam answer that names four of them is an answer that has lost a mark:

  1. Plaintext — the readable message or data fed in.
  2. Encryption algorithm — the component that performs the substitutions and transformations that turn the plaintext into something unintelligible.
  3. Secret key — a value supplied to the algorithm, independent of the plaintext, that selects which substitutions and transformations get performed.
  4. Ciphertext — the scrambled output. Which ciphertext you get depends on the plaintext and the key.
  5. Decryption algorithm — the encryption algorithm run in reverse, taking the ciphertext and the same secret key and producing the original plaintext.

The scheme goes by four interchangeable names, and the paper uses all of them: symmetric, conventional, single-key and secret-key encryption. They all mean the same arrangement — one key, shared by both ends, used to encrypt and to decrypt.

The two requirements for secure use

Two conditions, and neither is about hiding the algorithm.

First, the encryption algorithm must be strong: an opponent who knows the algorithm completely and holds a stack of ciphertext — even ciphertext for which they also hold the matching plaintext — must still be unable to recover the key or read new messages. Notice the bar. We do not merely assume the opponent knows the algorithm; we publish it. A published algorithm gets analysed by everyone, and an algorithm nobody can break after years of public attack is the only kind worth trusting.

Second, sender and receiver must have obtained copies of the secret key in a secure fashion and must keep the key secure. This is the requirement that turns out to be hard in practice, and the whole of key distribution (lesson 7) exists to serve it. If the key leaks, every message ever sent under it — past and future — is readable.

Worked example — one message, labelled twice

Take an eight-character message and a toy cipher of our own. The plaintext is DOCKSIDE. The secret key is the eight shift amounts . The encryption algorithm shifts the letter in position forward by places through the alphabet, wrapping at Z.

D O C K S I D E     plaintext
4 1 9 2 7 3 8 5     key
H P L M Z L L J     ciphertext

Check the third column by hand: C is letter 2, and , which is L. The ciphertext is HPLMZLLJ.

Now run the same five ingredients in the other direction. The input is now the ciphertext HPLMZLLJ; the decryption algorithm shifts backwards by the same amounts; the secret key is unchanged; the output is the plaintext DOCKSIDE. Same key, same algorithm, reversed — that is what symmetric means, and it is the whole reason a single leaked key is catastrophic in both directions.

Why the key is the secret and the algorithm is not

Keep the plaintext and the algorithm fixed and change only the key to :

D O C K S I D E     same plaintext
1 1 1 1 1 1 1 1     different key
E P D L T J E F     different ciphertext

One plaintext, one algorithm, two keys, two unrelated-looking ciphertexts. The variability that defeats the opponent lives in the key, which is exactly why the key — and nothing else — has to be protected.

The three classification dimensions

Every cipher is placed on three independent axes:

  • Type of operation. A substitution cipher replaces each element of the plaintext with another element. A transposition cipher reorders the elements without replacing any. A product system stacks both, in stages. Underneath all of it sits one non-negotiable rule: no information may be lost, so every operation must be reversible. A cipher you cannot undo is a hash, not a cipher.
  • Number of keys. One shared key is symmetric; different keys at the two ends is asymmetric (public-key).
  • Processing mode. A block cipher consumes one fixed-size block of plaintext at a time and emits one ciphertext block of the same size. A stream cipher consumes the input continuously, typically one byte at a time.

Our DOCKSIDE cipher classifies as substitution / symmetric / stream — it replaces letters, uses one key at both ends, and processes one character at a time. AES classifies as substitution-and-permutation (a product system) / symmetric / block. A columnar transposition classifies as transposition / symmetric / block, since it cannot emit anything until a whole grid has arrived.

XY = E(K, X)insecure channelX = D(K, Y)PlaintextDOCKSIDEEncryptalgorithm + KCiphertextHPLMZLLJDecryptalgorithm + KPlaintextDOCKSIDEOne key, used atboth ends. Onlythe key is secret.
The same secret key sits under both algorithm boxes. Everything on the middle arrow is assumed visible to the opponent, along with a full description of the algorithm itself.
NORMAL ~/memra/learn/comp-400/the-five-ingredients-of-symmetric-encryption utf-8 LF