Cryptosystems
• The fundamentalobjective of cryptography is to enable two people
to communicate over an insecure channel in such a way that an
opponent cannot understand what is being send.
• The one who is communicating with each other should know the
encrypted key so that they can decrypt the key and gain the original
text.
• Symmetric encryption, also referred to as conventional encryption or
single-key encryption, was the only type of encryption in use prior to the
development of public-key encryption in the 1970s.
• It remains by far the most widely used of the two types of encryption.
• All traditional schemes are symmetric / single key / private-key
encryption algorithms, with a single key, used for both encryption and
decryption. Since both sender and receiver are equivalent, either can
encrypt or decrypt messages using that common key.
3.
Basic Terminology inSymmetric encryption
⮚ plaintext - original message
⮚ ciphertext - coded message
⮚ cipher - algorithm for transforming plaintext to ciphertext
⮚ key - info used in cipher known only to sender/receiver
⮚ encipher (encrypt) - converting plaintext to ciphertext
⮚ decipher (decrypt) - recovering ciphertext from plaintext
⮚ cryptography - study of encryption principles/methods
⮚ cryptanalysis (code breaking) - study of principles/ methods
of deciphering ciphertext without knowing key
⮚ cryptology - field of both cryptography and cryptanalysis
Requirements
• Two requirementsfor secure use of symmetric
encryption:
• a strong encryption algorithm
• a secret key known only to sender / receiver
• Mathematically have:
CT = EK(PT)
PT= DK(CT)
6.
Cryptography
• Cryptographic systemscan be characterized along these three
independent dimensions:
• Type of encryption operations used
• substitution / transposition / product
• Number of keys used
• single-key or private / two-key or public
• Way in which plaintext is processed
• block / stream
7.
Cryptanalysis
• Typically objectiveis to recover the key in use rather then simply to
recover the plaintext of a single ciphertext.
• There are two general approaches:
• Cryptanalytic attacks: rely on the nature of the algorithm plus
perhaps some knowledge of the general characteristics of the
plaintext or even some sample plaintext-ciphertext pairs.
• Brute-force attacks: try every possible key on a piece of
ciphertext until an intelligible translation into plaintext is
obtained. On average, half of all possible keys must be tried to
achieve success.
8.
Cryptanalytic Attacks
• ciphertextonly
• only know algorithm & ciphertext, is statistical, know or can identify
plaintext
• known plaintext
• know/suspect plaintext & ciphertext
• chosen plaintext
• select plaintext and obtain ciphertext
• chosen ciphertext
• select ciphertext and obtain plaintext
• chosen text
• select plaintext or ciphertext to en/decrypt
9.
Brute Force Search
•A brute-force attack involves trying every possible key until an
intelligible translation of the ciphertext into plaintext is obtained.
• On average, half of all possible keys must be tried to achieve success
Key Size
(bits)
Number of
Alternative Keys
Time required at 1
decryption/µs
Time required at 106
decryptions/µs
32
232
= 4.3 × 109
231
µs = 35.8 minutes 2.15 milliseconds
56 DES
256
= 7.2 × 1016
255
µs = 1142 years 10.01 hours
128 AES
2128
= 3.4 × 1038
2127
µs = 5.4 × 1024
years 5.4 × 1018
years
168
Triple-DES
2168
= 3.7 × 1050
2167
µs = 5.9 × 1036
years 5.9 × 1030
years
26 characters
(permutation
)
26! = 4 × 1026
2 × 1026
µs = 6.4 × 1012
years
6.4 × 106
years
Classical Substitution Ciphers
•Where letters of plaintext are replaced by other letters or by
numbers or symbols
• If plaintext is viewed as a sequence of bits, then substitution
involves replacing plaintext bit patterns with ciphertext bit
patterns
• Substitution ciphers form the first of the fundamental building
blocks. The core idea is to replace one basic unit (letter/byte) with
another
13.
Shift Cipher (CaesarCipher when k=3)
• Shift Cipher is one of the earliest and simplest cryptosystems.
• It is a substitution cipher.
• Originally, it was used by Julius Caesar for sending encrypted
messages to his troops to hide messages from his enemies.
• A given plaintext is encrypted into a ciphertext by shifting each
letter of the given plaintext by k positions.
• If k= 3 it is called Caesar Cipher .
• The key k is the number by which we shift the alphabet,
14.
Shift Cipher (CaesarCipher when k=3)
• For Encryption the formula is
CT or E(PT)= (PT + K) mod m
Where CT = CipherText
PT = PlainText
K = Key
m = Total number to alphabets i.e. 26
• For Decryption the Formula is
PT or D(CT) = (CT – K) mod m
15.
Shift Cipher ENCRYPTIONEXAMPLE
• Mathematically give each letter a number
a b c d e f g h i j k l m n o p q r s t u v w x y z
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
• Lets encrypt plaintext “LOCKDOWN” with key=7
• Formula CT =(PT + K) mod m
Plaintext L O C K D O W N
No.
values
11 14 2 10 3 14 22 13
+ with K 7 7 7 7 7 7 7 7
Sum 18 21 9 17 10 21 29 20
Mod 26 18 21 9 17 10 21 3 20
Ciphertex S V J R K V D U
16.
Shift Cipher DECRYPTIONEXAMPLE
• Mathematically give each letter a number
a b c d e f g h i j k l m n o p q r s t u v w x y z
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
• Lets decrypt ciphertext “SVJRKVEU” with key=7
• Formula PT = (CT – K) mod m
Ciphertext S V J R K V D U
No. values 18 21 9 17 10 21 3 20
- With K 7 7 7 7 7 7 7 7
Diff 11 14 2 10 3 14 -4
(if –ve add
26)
13
Mod 26 11 14 2 10 3 14 22 13
Plaintext L O C K D O W N
17.
Cryptanalysis of CaesarCipher
• only have 26 possible ciphers
• A maps to A,B,..Z
• could simply try each in turn
• a brute force search
• given ciphertext, just try all shifts of letters
• do need to recognize when have plaintext
• eg. break ciphertext "GCUA VQ DTGCM"
18.
Questions to Solve
•Encrypt your name with key=3
• Attack at dawn ,key=5
• Top secret, key=4
• Meet me in the garden, key=3
19.
Monoalphabetic Cipher
• ratherthan just shifting the alphabet
• could shuffle (jumble) the letters arbitrarily
• each plaintext letter maps to a different random ciphertext letter
• hence key is 26 letters long
Plain: abcdefghijklmnopqrstuvwxyz
Cipher: DKVQFIBJWPESCXHTMYAUOLRGZN
Plaintext: ifwewishtoreplaceletters
Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA
20.
Encrypt text
"What foolsthese mortals be" with
Key Puck USING Vigenère Cipher
plaintext: WHA T F O O L S T H E S E M O R T A L S B E
key: P U C K P U C K P U C K P U C K P U C K P U C
ciphertex
t:
L B C D U I Q V H N J O H Y O Y G N C V H V G
22.
Decrypt text
" LBCDUIQVHN JOHYO YGNCV HVG“ with
Key Puck USING Vigenère Cipher
ke
y:
P U C K P U C K P U C K P U C K P U C K P U C
cip
he
rte
xt:
L B C D U I Q V H N J O H Y O Y G N C V H V G
pl
ai
nt W H A T F O O L S T H E S E M O R T A L S B E
One Time Pad(Vernam Cipher)
— Invented in 1917 by Gilbert Vernam and Joseph Mauborgne. Usually
implemented as a stream cipher using the XOR function.
— Key is used once and discarded by both sender and receiver. Length of the
Key character stream is equal to the message length.
— Not practical for large amounts of data (MB / GB).
— Pad is theoretically unbreakable by exhaustive brute force.
— The implementation uses a Key that consists of a set of random non-
repeating characters.
— Each Key letter and Plaintext is added modulo 26 to each other and then
converted back into a letter.
— The random pads (keys) are the same length as the message unbreakable
by exhaustive search.
— Relies on the physical security of the pads.
— Pads can only be used once.
26.
One Time Pad(Vernam Cipher)
The ciphertext is created by applying the logical XOR operation (exclusive-or) to the individual
bits of plaintext and the key stream.
The advantage of using the XOR operation for this, is that it can be reverted, simply by carrying
out the same operation again.
In other words:
plaintext + key = ciphertext ⇒ ciphertext + key = plaintext
#5 We assume that it is impractical to decrypt a message on the basis of the cipher- text plus knowledge of the encryption/decryption algorithm, and do not need to keep the algorithm secret; rather we only need to keep the key secret. This feature of symmetric encryption is what makes it feasible for widespread use. It allows easy distribution of s/w and h/w implementations.
Can take a closer look at the essential elements of a symmetric encryption scheme: mathematically it can be considered a pair of functions with: plaintext X, ciphertext Y, key K, encryption algorithm EK, decryption algorithm DK.
#6 Cryptographic systems can be characterized along these three independent dimensions.
#7 Typically objective is to recover the key in use rather then simply to recover the plaintext of a single ciphertext.
There are two general approaches:
Cryptanalytic attacks rely on the nature of the algorithm plus perhaps some knowledge of the general characteristics of the plaintext or even some sample plaintext-ciphertext pairs.
Brute-force attacks try every possible key on a piece of ciphertext until an intelligible translation into plaintext is obtained. On average,half of all possible keys must be tried to achieve success.
#8 Stallings Table 2.1 summarizes the various types of cryptanalytic attacks, based on the amount of information known to the cryptanalyst, from least to most. The most difficult problem is presented when all that is available is the ciphertext only. In some cases, not even the encryption algorithm is known, but in general we can assume that the opponent does know the algorithm used for encryption. Then with increasing information have the other attacks. Generally, an encryption algorithm is designed to withstand a known-plaintext attack.
#9 A brute-force attack involves trying every possible key until an intelligible translation of the ciphertext into plaintext is obtained. On average, half of all possible keys must be tried to achieve success. Stallings Table 2.2 shows how much time is required to conduct a brute-force attack, for various common key sizes (DES is 56, AES is 128, Triple-DES is 168, plus general mono-alphabetic cipher), where either a single system or a million parallel systems, are used.
#12 In this section and the next, we examine a sampling of what might be called classical encryption techniques. A study of these techniques enables us to illustrate the basic approaches to symmetric encryption used today and the types of cryptanalytic attacks that must be anticipated. The two basic building blocks of all encryption technique are substitution and transposition. We examine these in the next two sections. Finally, we discuss a system that combine both substitution and transposition.
#13 Substitution ciphers form the first of the fundamental building blocks. The core idea is to replace one basic unit (letter/byte) with another. Whilst the early Greeks described several substitution ciphers, the first attested use in military affairs of one was by Julius Caesar, described by him in Gallic Wars (cf. Kahn pp83-84). Still call any cipher using a simple letter shift a caesar cipher, not just those with shift 3.
#14 Substitution ciphers form the first of the fundamental building blocks. The core idea is to replace one basic unit (letter/byte) with another. Whilst the early Greeks described several substitution ciphers, the first attested use in military affairs of one was by Julius Caesar, described by him in Gallic Wars (cf. Kahn pp83-84). Still call any cipher using a simple letter shift a caesar cipher, not just those with shift 3.
#15 Substitution ciphers form the first of the fundamental building blocks. The core idea is to replace one basic unit (letter/byte) with another. Whilst the early Greeks described several substitution ciphers, the first attested use in military affairs of one was by Julius Caesar, described by him in Gallic Wars (cf. Kahn pp83-84). Still call any cipher using a simple letter shift a caesar cipher, not just those with shift 3.
#16 Substitution ciphers form the first of the fundamental building blocks. The core idea is to replace one basic unit (letter/byte) with another. Whilst the early Greeks described several substitution ciphers, the first attested use in military affairs of one was by Julius Caesar, described by him in Gallic Wars (cf. Kahn pp83-84). Still call any cipher using a simple letter shift a caesar cipher, not just those with shift 3.
#17 With a caesar cipher, there are only 26 possible keys, of which only 25 are of any use, since mapping A to A etc doesn't really obscure the message! Note this basic rule of cryptanalysis "check to ensure the cipher operator hasn't goofed and sent a plaintext message by mistake"!
Can try each of the keys (shifts) in turn, until can recognise the original message. See Stallings Fig 2.3 for example of search.
Note: as mentioned before, do need to be able to recognise when have an original message (ie is it English or whatever). Usually easy for humans, hard for computers. Though if using say compressed data could be much harder.
Example "GCUA VQ DTGCM" when broken gives "easy to break", with a shift of 2 (key C).
#19 With only 25 possible keys, the Caesar cipher is far from secure. A dramatic increase in the key space can be achieved by allowing an arbitrary substitution, where the translation alphabet can be any permutation of the 26 alphabetic characters.
See example translation alphabet, and an encrypted message using it.