Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Techniques
Lecture-2
Last lecture recap
• What is a security?
• CIA triad
• OSI security architecture
- Security attacks
- Security services
- Security mechanism
• Security model
Basic Terminology
• Plaintext - the original message
• Ciphertext - the coded/scrambled message
• Cipher - algorithm for transforming plaintext/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 (codebreaking) - the study of principles/ methods of
deciphering ciphertext without knowing key
• Cryptology - the field of both cryptography and cryptanalysis
Symmetric Cipher Model
Systematic encryption
• Plaintext: The original intelligible message or data (input )
• Encryption algorithm: The encryption algorithm ( substitutions , transformations)
• Secret key: The secret key is also input to the encryption algorithm. ( key value
independent of the plaintext and algorithm.)
• Ciphertext: The scrambled message (output)
• Decryption algorithm: This is essentially the encryption algorithm run in reverse,
(produces the original plaintext)
Symmetric Cipher Model
Symmetric Cipher Model
Two requirements for secure use of conventional encryption
1. A Strong a strong encryption algorithm (keeping key secret )
- Opponent should be unable to decrypt ciphertext or discover the key, even if
s/he is in possession of a number of ciphertext with plaintext
• A secret key known only to sender / receiver
Y = E(K, X)
X = D(K,Y)
2. Sender and receiver must have obtained copies of the secret key in
a secure fashion and must keep the key secure.
Model of Symmetric Cryptosystem
• Generated key must be delivered to the destination through a
security channel.
Cryptography
Cryptographic systems categorization
1. Type of encryption operations used for transforming plaintext to ciphertext. ( substitution /
transposition / product systems)
2. Number of keys used:
- symmetric: single-key, secrete-key, conventional encryption; Sender and receiver use the same key
- asymmetric: double-keys, public key; Sender and receiver use different keys
Computational security
- 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
- If such criteria is/are met – computationally secure
Classical Ciphers
Examine a sampling of what might be called classical encryption
techniques.
The two basic building blocks of all encryption techniques :
- Substitution : Letter of plaintext replaced by other letters, numbers
or symbols
- Transposition: involves replacing plaintext bit patterns with
ciphertext bit patterns. ( a sequence of bits)
• Illustrate the basic approaches to symmetric encryption and the types
of cryptanalytic attacks that must be anticipated.
Substitution techniques
Caesar Cipher
The earliest known and simplest
Used by Julius Caesar
E.g. Replacing each letter by a letter three places down the alphabet
• example:
Plain: meet me after the toga party
Cipher PHHW PH DIWHU WKH WRJD SDUWB
Substitution techniques
Example:
Plain Cipher: (p = plain text letter, C= cipher letter)
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
D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
C = E(p,3) = (p+3) mod 26
Caesar Cipher
Assign each letter with a number
Caesar Cipher
Caesar cipher algorithm
• Encryption algorithm
C = E(k,p) = (p+K) mod 26 ( where 1<= k <=25)
• Decryption Algorithm
P = D(k,C) = (C-K) mod 26 ( where 1<= k <=25)
Cryptanalysis of Caesar Cipher
Problem
• Only have 26 possible keys ( only 25 keys to try )
Could shift K = 0, 1, 2, …, 25 slots
• Could simply try each in turn
• Language of the plaintext is known and easily recognised
• Brute force search
- given ciphertext, just try all shifts of letters
- do need to recognize when have plaintext
• Now we have
.
Monoalphabetic Ciphers
• Monoalphabetic ciphers are easy to break because they
reflect the frequency data of the original alphabet
• not even the large number of keys in a monoalphabetic cipher provides
security
• One approach to improving security was to encrypt multiple letters
- A countermeasure is to provide multiple substitutes, known as
homophones, for a single letter.
- For example, the letter e could be assigned a number of different cipher
symbols, such as 16, 74, 35, and 21, with
each homophone assigned to a letter in rotation or randomly.
Monoalphabetic Ciphers
Playfair Cipher
• A multiple-letter encryption cipher.
• Treats digrams in the plaintext as single units and translates these
units into ciphertext digrams
• Playfair algorithm is based on the use of a 5 × 5 matrix of letters
constructed using a keyword.
Playfair Key Matrix
• 5X5 matrix of letters based on a keyword
• The matrix is constructed by filling in the letters of the keyword
(minus duplicates)
• Left to right and from top to bottom,
• fill rest of matrix with other letters
Playfair Key Matrix
• 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
Playfair- Encrypting and Decrypting
Plaintext is encrypted two letters at a time, based on the following rules:
1. Repeating plaintext letters that are in the same pair are separated with
a filler letter, such as x.
- e.g. balloon would be treated as ba lx lo on.
2. Two plaintext letters that fall in the same row of the matrix are each
replaced by the letter to the right, with the first element of the row
circularly following the last.
- e.g. ar is encrypted as RM.
Playfair -Encrypting and
Decrypting
3. Two plaintext letters that fall in the same column are each replaced
by the letter beneath, with the top element of the column circularly
following the last.
- e.g. mu is encrypted as CM.
4. Otherwise, each plaintext letter in a pair is replaced by the letter that
lies in its own row and the column occupied by the other plaintext
letter.
- Thus hs becomes BP and ea becomes IM (or JM, as the encipherer
wishes).
Security of the Playfair Cipher
• security much improved over monoalphabetic
• since have 26 x 26 = 676 digrams
• would need a 676-entry frequency table to analyse (verses 26 for a
monoalphabetic)
• was widely used for many years (eg. US & British military in WW1)
• Despite this level of confidence in its security, the Playfair cipher is
relatively easy to break, because it still leaves much of the structure of
the plaintext language intact.
Polyalphabetic Ciphers
• Plaintext : …………..
• Key : …………..
• Cipher text : …………..
• Computation
= E(K,P)= E( …,),( …, )
= ( ) mod 26, ( ) mode26, ......, ( ) mod 26,
( ) mod 26, ( ) mod 26, ....., ( ) mod 26
Polyalphabetic Ciphers
• VIGENÈRE CIPHER
General equations:
=( + ) mod 26 (Encryption)
=( - ) mod 26 (Decryption
Vigenere Cipher
• The first letter of the key is added to the first letter of the plaintext,
mod 26.
• The second letters are added, and so on through the first letters of the
plaintext.
• For the next letters of the plaintext, the key letters are repeated.
Example
key: deceptivedeceptivedeceptive
plaintext: wearediscoveredsaveyourself
ciphertext: ZICVTWQNGRZGVTWAVZHCQYGLMGJ
Vigenere Cipher
Example: Expressed numerically
Key 3 4 2 4 15 19 8 21 4 3 4 2 4 15
plainText 22 4 0 17 4 3 8 18 2 14 21 4 17 4
Ciphertext 25 8 2 21 19 22 16 13 6 17 25 6 21 19
Key 19 8 21 4 3 4 2 4 15 19 8 21 4
plainText 3 18 0 21 4 24 14 20 17 18 4 11 5
Ciphertext 22 0 21 25 7 2 16 24 6 11 1 6 9
2
Vigenère cipher
• Autokey system.
A keyword is concatenated with the plaintext itself to provide a
running key.
Key : deceptivewearediscoveredsav
plaintext: wearediscoveredsaveyourself
ciphertext: ZICVTWQNGKZEIIGASXSTSLVVWLA
One-Time Pad
• One-Time Pad
• a random key that is as long as the message
• the key is to be 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.
• It produces random output that bears no statistical relationship to the
plaintext.
One-Time Pad
E.g Consider the ciphertext
ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS
We now show two different decryptions using two different keys:
• ciphertext: ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS
• key: pxlmvmsydofuyrvzwc tnlebnecvgdupahfzzlmnyih
• plaintext: mr mustard with the candlestick in the hall
• ciphertext: ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS
• key: pftgpmiydgaxgoufhklllmhsqdqogtewbqfgyovuhwt
• plaintext: miss scarlet with the knife in the library
One-Time Pad
• one-time pad offers complete security but, in practice, has two
fundamental difficulties:
• 1. 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..
• 2. Key distribution and protection problem.
Transposition Techniques
Rail fence technique
Plaintext is written down as a sequence of diagonals and then read off
as a sequence of row
Plain text : meet me after the toga party
m e m a t r h t g p r y
e t e f e t e o a a t
MEMATRHTGPRYETEFETEOAAT
Transposition Techniques
• Columnar transposition
Steganography
Steganography.
Conceal the existence of the message
Techniques
• Character marking
• Invisible ink
• Pin punctures
• Typewriter correction ribbon
Summary
• Cryptographic systems categorization
• attacks on an encryption algorithm
• Unconditional and Computational security
• Caesar Cipher
• Playfair Cipher
• Polyalphabetic Ciphers
• Vigenere Cipher
Any Question?