Chapter1 Introduction 1.1.1 WhatisCryptography?
The study of principles and techniques by which information can be concealed in ciphers and later revealed by legitimate users employing a secret key (i.e., a piece of information known only to them), but in which it is either impossible or computationally infeasible for an unauthorized person to do so. (Encyclopedia Britannica)
The word comes from Greek kryptos hidden, and graphein to write.
A more inclusive term is cryptology, from Greek kryptos and logos word.
The science of secure (generally secret) communications. (Encyclopedia Britannica)
Apart from Cryptography, the term Cryptology includes Cryptanalysis: From Greek
kryptos and anal ein to loosen, to untie.
The science (and art) of recovering information from ciphers without knowledge of the key. (Encyclopedia Britannica)
1.1.2 Thedi erencebetweenciphersandcodes
Cipher: From French chi re and Arabic sifr (nothing also related to zero).
1. Any system of secret writing that uses a prearranged scheme or key. 2. A message
in cipher, also, its key. (Funk & Wagnalls Standard Desk Dictionary).
Code: From Latin codex writing tablet.
A set of signals, characters, or symbols used in communication. (Funk & Wagnalls)
The main topic of this course will be ciphers rather than codes. Some examples of codes: Morse code
ASCII (American Standard Code for Information Interchange) The pigpen cipher (really a code)
Sherlock Holmes Dancing Men
1.1.3 Aboutthiscourse
The main purpose of this course:
To give the mathematical foundations of modern cryptography and of the most important
cryptosystems.
To give means to judge the security of a cryptosystem.
1.1 Generalities
1.2 More Terminology, Classification
What this course does not cover (or only in passing):
Implementations, protocols, etc.
Related to this: Network security, e-commerce, etc.
Political and social issues (escrow systems, the CLIPPER chip, etc.)
Ethical and human-rights issues
Steganography (covert secret writing; from Greek steganos covered)
1.2 MoreTerminology,Classification 1.2.1 Terminology
Cryptosystem (or cryptographic system: A more technical term for cipher.
Plaintext: An English (French, German, . . . ) text, numerical data, other information; may
already have been encoded (for instance, in ASCII).
Encryption: Performed by the sender; intended to render the message unintelligible to any
eavesdropper.
Ciphertext: The result of an encryption; usually a string of symbols, digits, bits, . . .
Decryption: Performed by the intended receiver; the recovering of plaintext from cipher-
text.
1.2.2 Kerckho sprinciple
It is assumed that the cryptosystem in use, and the workings of this system, are public knowledge, or at least known to the potential eavesdropper.
(Auguste Kerckho s, 1883)
Reasons:
It is unreasonable to depend on the secrecy of the cryptosystem.
Adherence to this principle makes standardization of algorithms and large-scale commu-
nication easier.
Thus, the only secret is the key. Therefore, key distribution and key management are fundamental issues in cryptography.
1.2.3 Classification
Cryptosystems can be (roughly) classified according to three di erent criteria:
1. The types of operations used for encryption:
Substitution: Each element in the plaintext (bit, letter, group of bits or letters) is mapped
to another element.
Transposition: Elements in the plaintext are rearranged.
2
1.3 Basic Concepts of Cryptanalysis
Most cryptosystems employ multiple stages of substitutions and transpositions (product sys- tems).
2. The number of keys used:
Symmetric (or single-key, secret-key, conventional) encryption:
Both sender and receiver use the same key.
Asymmetric (or two-key, or public key) encryption:
Sender and receiver each uses a di erent key.
3. The way in which the plaintext is processed:
Block cipher: Input is processed one block of elements at a time, producing an output
block for each input block.
Stream cipher: Input elements are processed continuously, producing an output of one
element at a time, as it goes along.
1.2.4 Modelofconventionalcryptosystems
The basic communications scenario can be depicted as follows:
There are two parties, usually called Alice and Bob (for A and B) who wish to communicate securely over an insecure channel. We assume that a third party has access to the insecure channel and thus to the ciphertext and, in certain scenarios, will also have access to the corre- sponding plaintext and might even be able to alter the ciphertext and/or impersonate Alice or Bob. In accordance with Kerckho s principle, we also assume that this party will know which cryptosystem is used and will know its inner workings. This party is often called Oscar (for opponent or observer), or Eve (for eavesdropper).
3
1.3 BasicConceptsofCryptanalysis
Cryptanalysis is as much an art as it is a science. Although some ciphers may be compu- tationally intractable, human ingenuity and intuition may help to crack them. (There are many examples of this throughout history).
1.3.1 Meansofcryptographicattacks
1. Mathematical:
Statistics (frequency distributions, etc.). Number theory.
Group theory.
Combinatorics and graph theory, etc.
2. Side information:
Linguistic (human language is full of redundancy). Formatting (such as Dear Dr. Dilcher).
Subject.
Known words or phrases (such as military ranks).
3. Cloak & Dagger methods:
Theft, bribery, blackmail, sex, violence.
1.3.2 Typesofcryptographicattacks
1. Ciphertext only:
The cryptanalyst has only the ciphertext to work with. Easiest type to defend against.
Example of this type of attack: exhaustive search.
2. Known plaintext:
Often the cryptanalyst has one or more plaintext messages along with corresponding
encryptions.
Closely related: Probable word attack.
3. Chosen ciphertext:
The cryptanalyst can cause a ciphertext of his choice to be decoded.
Both ciphertext and corresponding plaintext segments are then known. Similar: Chosen plaintext attack.
4
1.3 Basic Concepts of Cryptanalysis
1.4 SomeHistory
This is a selective list of some key dates (pun intended) and events in the history of cryptography.
Ancient Egyptians, Hebrews, Babylonians, Assyrians used protocryptographic systems.
ca. 400 BC: Spartans used the scytale for communications between military commanders.
First transposition cipher.
4th century BC: Chapter on cryptography in a book by Aeneas. Earliest treatise on the
subject.
Same time: Polybios encoded letters into pairs of symbols. First biliteral substitution.
ca. 50 BC: Caesar cipher: simple shift cipher.
Arab culture: First clear understanding of the principles of cryptology. 1412: Treatment
of several cryptosystems in an encyclopedia by al-Kalkashandi. First use of frequency
analysis.
1379: First European manual on cryptography, by Gabriele de Lavinde of Parma.
1470: First cipher disk, by Leon Battista Alberti.
1586: Blaise de Vigenere The Vigenere table.
17th 19th centuries: Rapid development of techniques.
1920s: Electromechanical devices used by most powers.
Both world wars: Cryptanalytical successes of greatest importance to (mostly) the Allied
forces.
1950s on: Use of electronic computers.
1976: Public key cryptography described by Di e and Hellman.
1977: Data Encryption Standard (DES) adopted.
1978: RSA (Rivest, Shamir, Adleman).
1980s: Elliptic curve cryptosystems.
2000/2001: Replacement of DES by the Rijndael algorithm as new Advanced Encryption
Standard (AES).
5
1.4 Some History
Chapter2 ClassicalCryptography
In this chapter we are going to study some basic principles of cryptography, along with several historical and insecure cryptosystems as examples. We will also consider modern block ciphers and stream ciphers, and two sections contain mathematical background that will be required in this chapter and throughout the course.
2.1 Cryptosystems 2.1.1 Basics
Definition 2.1.
A cryptosystem is a 5-tuple (P, C, K, E, D) with the following properties:
1. P is a set, called the plaintext space. Its elements are called plaintexts.
2. C is a set, called the ciphertext space. Its elements are called ciphertexts.
3. K is a set, called the key space. Its elements are called keys.
4. E = {Ek : k 2 K } is a family of functions Ek : P ! C. Its elements are called
encryption functions.
5. D = {Dk : k 2 K } is a family of functions Dk : C ! P. Its elements are called
decryption functions.
6. Foreache2K thereisad2K suchthat Dd(Ee(p))=p forallp2P.
|
Example 1. Shift ciphers.
LetP=C=K ={A,B,C,,Z}.Weidentifythissetwith={0,1,2,,25}according
to the table
Notation: Zm is the set {0,1,2,,m 1} along with the two operations + and which are carried out as in N, except that we reduce modulo 26. (More about this in the next section).
For e 2 Z26 we define the encryption function Ee by
Ee :!, x7!(x+e) (mod26).
For d 2 Z26 the decryption function Dd is defined by
Dd :!, x7!(x d) (mod26).
The decryption key belonging to the encryption key e is d = e.
Example: Apply the shift cipher with key e = 5 to the word cryptography. We get
HWDUYTLWFUMD.
A
B
C
Z
0
1
2
25
2.2 Mathematical Background I
Remarks:
1. When the key is e = 3, this is called the Caesar cipher.
2. The key space has only 26 elements. To cryptanalyze, we need only try all keys on a
segment of the ciphertext, until it makes sense.
3. Shift ciphers can be modified as follows: Let P and C be the set of all sequences
w = (w1,w2,,wn), with wi 2 , 1 i n. Again K = Z26. Now the function Ee replaces each wi with wi + e (mod 26), 1 i n.
4. The symbol is the capital Greek letter Sigma, and is pronounced this way.
5. Obviously, all this can be done with Zm, for any m 2.
6. Recall that d = e. We can use this as an alternative definition of a symmetric, resp. an
asymmetric cryptosystem: A cryptosystem is called
symmetric if d = e,
asymmetric if d , e, and the computation of d from e is not feasible.
2.1.2 Requirementsforagoodcryptosystem
A. Classical requirements (Claude Shannon, 1940): A good cryptosystem should
1. be highly secure against its designer, that is, the designer of the system should not have
any advantage in decryption;
2. use short, easily-changed key;
3. require only simple encryption/decryption;
4. not introduce error propagation;
5. not entail message expansion.
Remark: Requirements 2 5 reflect the fact that encryption/decryption used to be done manually by error-prone cipher clerks. They are less important with the use of computers.
B. Modern requirements:
1. As before.
2. As before keys must be small (but small is a relative term; keys can be many digits
long).
3. As before operations must be relatively simple (what computers do best), but we can do
many of them.
4. Some error propagation may even be desirable.
5. Moderate message expansion is now acceptable.
7
2.2 MathematicalBackgroundI 2.2.1 Congruences
Modular arithmetic and the basics of (abstract) algebra are of fundamental importance for cryptographic algorithms.
Definition 2.2.
Givena,b2Z,wesaythataiscongruenttobmodulom(writtenab (modm))ifm divides b a (written m | b a).
Examples: 2 19 (mod 21), 10 0 (mod 2).
2.2 Mathematical Background I
Remark: Congruence modulo m is an equivalence relation, that is, it satisfies the following relations:
1. a a (mod m) (reflexivity),
2. a b (mod m) implies b a (mod m) (symmetry);
3. a b (mod m) and b c (mod m) implies a c (mod m)
The following characterization is also useful.
Lemma 2.1.
The following statements are equivalent:
1. a b (mod m).
2. Thereisak2Zwitha=b+km.
3. When divided by m, both a and b leave the same remainder.
(transitivity).
|
We are now ready to define a basic concept in modular arithmetic:
Definition 2.3.
~
|
The equivalence class of a 2 Z is the set of all integers obtained from a by adding integer multiples of m, that is,
{b2Z|ba (modm)}=a+mZ. This is called the residue class of a (mod m).
Examples:1.Theresidueclassof1 (mod4)is{1,14,124,}={1, 3,5, 7,9,}. 2. The residue class of 0 (mod 2) is the set of all even integers; the residue class of 1
(mod 2) is the set of all odd integers.
3.Theresidueclasses (mod4)are0+4Z,1+4Z,2+4Z,3+4Z.
Notation: The set of residue classes (mod m) is denoted by Z/mZ. It has m elements since 0, 1, 2, . . . , m 1 are all the possible remainders upon division by m.
A set of representatives is a set of integers that contains exactly one element of each residue class (mod m).
8
2.2 Mathematical Background I
Examples: 1. {0, 1, 2}, {3, 2, 5}, and {9, 16, 14} are di erent sets of representatives of Z/3Z.
2. Foranym2N,theset{0,1,2,,m 1}isasetofrepresentatives (modm),called
the least nonnegative residues (mod m), denoted by Zm.
3. {1, 2, . . . , m} is a set of representatives, the least positive residues
Proposition 2.1.
Supposethatab (modm)andcd (modm).Then (a) a b (mod m),
(b) a+cb+d (modm),
(c) ac bd (mod m).
(mod m).
Proof (a) Since m divides a b, it also divides a + b, and therefore a b (mod m).
(b), (c): exercise.
Example: The integer F = 22n + 1 is called a Fermat number. Pierre de Fermat (16011665) n
observed that F0 = 3, F1 = 5, F2 = 17, F3 = 257, and F4 = 65 537 are all prime. He conjectured that all Fn are prime.
However, Leonhard Euler (17071786) showed that 641 | F5.
Proof Itisclearthat641=640+1=527+1,so527 1(mod641).ByProposition2.1(c)
we get by multiplying both sides of this congruence with itself 4-times over,
54 228 1 (mod 641). (2.1)
Ontheotherhand,641=625+16=54 +24,so
54 24 (mod 641).
Substituting this into (2.1), we get