0% found this document useful (0 votes)
27 views

P02-Symmetric-key Encryption 3

This document provides an overview of symmetric encryption techniques. It begins with basic terminology like plaintext, ciphertext, encryption, and decryption. It then discusses symmetric encryption models and key families. The document outlines various symmetric encryption techniques like the Caesar cipher, monoalphabetic ciphers, polyalphabetic ciphers like the Vigenere cipher and Autokey cipher. It also discusses cryptanalysis techniques like brute force attacks and the Kasiski test.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

P02-Symmetric-key Encryption 3

This document provides an overview of symmetric encryption techniques. It begins with basic terminology like plaintext, ciphertext, encryption, and decryption. It then discusses symmetric encryption models and key families. The document outlines various symmetric encryption techniques like the Caesar cipher, monoalphabetic ciphers, polyalphabetic ciphers like the Vigenere cipher and Autokey cipher. It also discusses cryptanalysis techniques like brute force attacks and the Kasiski test.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 56

King Fahd University of Petroleum & Minerals

College of Computer Sciences & Engineering

Symmetric-key Encryption

Cryptography and Blockchain Applications

This lecture is based on:


Stallings: Chapter 3, Forouzan: Chapter 3
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
 Remains by far the most widely used of the two
types of encryption
Basic Terminology
• Plaintext
• The original message • Cryptographic system or
cipher
• Ciphertext • Schemes used for
• The coded message encryption
• Enciphering or encryption • Cryptanalysis
• Process of converting from
• Techniques used for
plaintext to ciphertext
deciphering a message
• Deciphering or decryption without any knowledge
• Restoring the plaintext from of the enciphering details
the ciphertext
• Cryptology
• Cryptography • Areas of cryptography
• Study of encryption
and cryptanalysis
Model of Symmetric Encryption
Model of Symmetric Cryptosystem
Meet the family (the main cast)
 Alice and Bob (or Ahmad/Bader in the class)
 Goal: Transfer information in a secure manner
 Carol and David join sometimes in multi-party protocols
 Eve
 Goal: Obtain, modify and attack secure information
 Can eavesdrop, intercept, read and change messages.
 Darth and Trudy can join to deviate in some protocols for
intrusion attacks.
 Tom or Trent
 Goal: Establish trust as a third trusted party
 Peggy and Victor
 Goal: Communicate to prove and verify some claims
 Can deviate from the protocol.
Cryptographic Systems
 Characterized along three independent dimensions:

The type of
operations used for The way in which
The number of keys
transforming the plaintext is
used
plaintext to processed
ciphertext
Symmetric,
single-key,
Substitution secret-key, Block cipher
conventional
encryption

Asymmetric,
two-key, or
Transposition Stream cipher
public-key
encryption
Cryptanalysis and
Brute-Force Attack
Cryptanalysis Brute-force attack
• Attack relies on the • Attacker tries every
nature of the possible key on a
algorithm plus some piece of ciphertext
knowledge of the until an intelligible
general translation into
characteristics of the plaintext is obtained
plaintext • On average, half of
• Attack exploits the
all possible keys
characteristics of the must be tried to
algorithm to attempt achieve success
to deduce a specific
plaintext or to
deduce the key being
used
Cryptanalysis

 Based on Kerckhoff’s principle, one should always assume that the adversary,
Eve, knows the encryption/decryption algorithm. The resistance of the cipher
to attack must be based only on the secrecy of the key. (Kerckhoff 1883)

 “The enemy knows the system” (Shannon 1949)

 Cryptanalysis is the science and art of breaking those codes


Cryptanalysis Attacks
 There are four main type of cryptanalysis attacks
depending on what the attacker knows or has:
Cryptanalysis Attacks
 Ciphertext-Only Attack
Cryptanalysis Attacks
 Known-Plaintext Attack
Cryptanalysis Attacks
 Chosen-Plaintext Attack
Cryptanalysis Attacks
 Chosen-Ciphertext Attack
Table 2.1
Types of Attacks on Encrypted Message

Messages
Encryption Scheme Security

 Unconditionally secure
 No matter how much time an opponent has, it is
impossible for him or her to decrypt the ciphertext simply
because the required information is not there
 Computationally secure
 The cost of breaking the cipher exceeds the value of the
encrypted information.
 The time required to break the cipher exceeds the useful
lifetime of the information.
Substitution Technique

 Is one in which the letters of plaintext are


replaced by other letters or by numbers or
symbols
 Substitution vs. Transposon
 Substitution: replacing the letters
 Transposon: moving the letters
 Substitution Techniques:
 Monoalphabetic
 Polyalphabetic
Caesar Cipher
• Simplest and earliest known use of a substitution
cipher
• Used by Julius Caesar

• Involves replacing each letter of the alphabet with the


letter standing three places further down the alphabet
• Alphabet is wrapped around so that the letter
following Z is A

plain: meet me after the toga party

cipher: PHHW PH DIWHU WKH WRJD SDUWB


Caesar Cipher Algorithm
• Can define transformation as:
abcdefghijklmnopqrstuvwxyz
D EF G H IJK LMN O PQ RSTUVWXYZABC

• Mathematically give each letter a number


abcdefghij 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

• Algorithm can be expressed as:


c = E(3, p) = (p + 3) mod (26)

• A shift may be of any amount, so that the general Caesar algorithm is:

C = E(k , p ) = (p + k ) mod 26
• Where k takes on a value in the range 1 to 25; the decryption
algorithm is simply:

p = D(k , C ) = (C - k ) mod 26
Brute-Force
Cryptanalysis of Caesar
Cipher

(This chart can be found on


page 35 in the textbook)
Monoalphabetic Cipher
 Permutation
 Of a finite set of elements S is an ordered sequence of all the

elements of S , with each element appearing exactly once

 Example of a key:
Monoalphabetic Cipher
 If the “cipher” key can be any permutation of the 26
alphabetic characters, then there are 26! (> 4 x 1026)
possible keys
 This is 10 orders of magnitude greater than the key space
for DES
 Approach is referred to as a monoalphabetic substitution
cipher because a single cipher alphabet is used per message
Monoalphabetic Ciphers

 Easy to break because they reflect the frequency


data of the original alphabet
 Countermeasure is to provide multiple substitutes
(homophones) for a single letter
 Digram
 Two-letter combination
 Most common is th
 Trigram
 Three-letter combination
 Most frequent is the
Continued

Frequency of characters in English

3.25
Polyalphabetic Ciphers

 Polyalphabetic substitution cipher


 Improves on the simple monoalphabetic technique by
using different monoalphabetic substitutions as one
proceeds through the plaintext message
 Classical Examples:
 Playfair, Hill cipher, Vigenère, Autokey, Enigma

All these techniques have the following


features in common:
• A set of related monoalphabetic
substitution rules is used
• A key determines which particular rule is
chosen for a given transformation
Vigenère Cipher

 Best known and one of the simplest polyalphabetic


substitution ciphers
 In this scheme the set of related monoalphabetic
substitution rules consists of the 26 Caesar ciphers
with shifts of 0 through 25
 Each cipher is denoted by a key letter which is the
ciphertext letter that substitutes for the plaintext
letter a
Vigenere Cipher: Example

Example 3.16

We can encrypt the message “She is listening” using the 6-character keyword “PASCAL”.

3.29
Vigenere Cipher: Cryptanalysis

Vigenere cipher can be seen as combinations of m additive ciphers.

Figure 3.14 A Vigenere cipher as a combination of m additive ciphers

3.30
Kasiski Test

Example 3.19

Let us assume we have intercepted the following ciphertext:

The Kasiski test for repetition of three-character segments yields the results shown in Table 3.4.

3.31
Example 3.19 (Continued)

The greatest common divisor of differences is 4, which means that the key length is multiple of 4. First try m = 4.

In this case, the plaintext makes sense.

3.32
Autokey Cipher

Assume that Alice and Bob agreed to use an autokey cipher with initial key value k1 = 12. Now Alice wants to send

Bob the message “Attack is today”. Enciphering is done character by character.

3.33
Autokey System

 A keyword is concatenated with the plaintext itself


to provide a running key
 Example:
key: deceptivewearediscoveredsav
plaintext: wearediscoveredsaveyourself
ciphertext: ZICVTWQNGKZEIIGASXSTSLVVWLA
 Even this scheme is vulnerable to cryptanalysis
 Because the key and the plaintext share the same
frequency distribution of letters, a statistical technique can
be applied
Playfair Cipher

 Invented by British scientist Sir Charles Wheatstone


in 1854
 Used as the standard field system by the British
Army in World War I and the U.S. Army and other
Allied forces during World War II
Playfair Key Matrix

 Fill in letters of keyword (minus duplicates) from


left to right and from top to bottom, then fill in the
remainder of the matrix with the remaining letters
in alphabetic order
 Using the keyword MONARCHY:

M O N A R
C H Y B D
E F G I/J K
L P Q S T
U V W X Z
Example 3.15 (Forouzan)

An example of Playfair cipher

To encrypt the plaintext “hello”  helxlox

3.37
Hill Cipher

Figure 3.15 Key in the Hill cipher

P, C, and K are matrices in modulo 26

C = P  K (mod 26)
-1
P = C  K (mod 26)
3.38
Example

For example, the plaintext “code is ready” can make a 3 × 4 matrix when adding extra bogus character “z” to the

last block and removing the spaces. The ciphertext is “OHKNIHGKLISS”.

Figure 3.16 Example 3.20

3.39
Assume that Eve knows that m = 3. She has intercepted three plaintext/ciphertext pair blocks (not necessarily from

the same message) as shown in Figure 3.17.

Figure 3.17 Example 3.21

3.40
Eve makes matrices P and C from these pairs. Because P is invertible, she inverts the P matrix and multiplies it by

C to get the K matrix as shown in Figure 3.18.

Figure 3.18 Example 3.21

Now she has the key and can break any ciphertext encrypted with that key.

3.41
Hill Cipher

 Developed by the mathematician Lester Hill in 1929


 Strength: It completely hides single-letter
frequencies
 The use of a larger matrix hides more frequency
information
 A 3 x 3 Hill cipher hides not only single-letter but also two-
letter frequency information
 Strong against a ciphertext-only attack but easily
broken with a known plaintext attack
Rotor Cipher

Figure 3.19 A rotor cipher

3.43
Enigma Machine
 A rotor machine developed
in Germany (early 1920s)
 Extensively used by the
German army in WWII
Enigma Machine

Figure 3.20 A schematic of the Enigma machine

3.45
Vernam Cipher
One-Time Pad

 Improvement to Vernam cipher proposed by an Army


Signal Corp officer, Joseph Mauborgne
 Use a random key that is as long as the message so
that the key need not be repeated
 Key is used to encrypt and decrypt a single message
and then is discarded
 Each new message requires a new key of the same
length as the new message
 Scheme is unbreakable
 Produces random output that bears no statistical relationship
to the plaintext
 Because the ciphertext contains no information whatsoever
about the plaintext, there is simply no way to break the code
Perfect Secrecy

 The one-time pad offers complete security but, in


practice, has two fundamental difficulties:
 There is the practical problem of making large quantities of
random keys
 Any heavily used system might require millions of random characters on
a regular basis
 Huge key distribution problem
 For every message to be sent, a key of equal length is needed by both
sender and receiver
 Because of these difficulties, the one-time pad is of
limited utility
 Useful primarily for low-bandwidth channels requiring very
high security
 The one-time pad is the only cryptosystem that
exhibits perfect secrecy (a.k.a. Shannon-Secure)
Keyless Transposition Ciphers

Simple transposition ciphers, which were used in the past, are keyless.

Example 3.22

A good example of a keyless cipher using the first method is the rail fence cipher. The ciphertext is created reading

the pattern row by row. For example, to send the message “Meet me at the park” to Bob, Alice writes

She then creates the ciphertext “MEMATEAKETETHPR”.

3.49
Rail Fence Cipher

 Plaintext is written down as a sequence of


diagonals and then read off as a sequence of rows
 To encipher the message “meet me after the toga
party” with a rail fence of depth 2, we would write:
mematrhtgpry
etefeteoaat
Encrypted message is:
MEMATRHTGPRYETEFETEOAAT
Keyless Transposition Ciphers

Alice and Bob can agree on the number of columns and use the second method. Alice writes the same plaintext,

row by row, in a table of four columns.

She then creates the ciphertext “MMTAEEHREAEKTTP”.

3.51
Keyed Transposition Ciphers

Alice needs to send the message “Enemy attacks tonight” to Bob..

The key used for encryption and decryption is a permutation key, which shows how the character are permuted.

The permutation yields

3.52
Combining Two Approaches

Example 3.26
Figure 3.21

3.53
Double Transposition Ciphers

Figure 3.25 Double transposition cipher

3.54
Steganography
• Character marking
• Selected letters of printed or typewritten text
Classical Techniques: are over-written in pencil
• The marks are ordinarily not visible unless the
paper is held at an angle to bright light
• Invisible ink
• A number of substances can be used for
writing but leave no visible trace until heat or
some chemical is applied to the paper
• Pin punctures
• Small pin punctures on selected letters are
ordinarily not visible unless the paper is held
up in front of a light
• Typewriter correction ribbon
• Used between lines typed with a black ribbon,
the results of typing with the correction tape
are visible only under a strong light
Summary

 Symmetric Cipher  Substitution


Model techniques
 Cryptography  Caesar cipher
 Cryptanalysis and  Monoalphabetic
Brute-Force Attack ciphers
 Transposition  Playfair cipher
techniques  Hill cipher
 Rotor machines
 Polyalphabetic
ciphers
 One-time pad
 Steganography

You might also like