Chapter 1-4
Chapter 1-4
Chapter 1-4
• Computer Security - generic name for the collection of tools designed to protect data and to thwart hackers
• Network Security - measures to protect data during their transmission
• Internet Security - measures to protect data during their transmission over a collection of interconnected
networks
Security Attacks, Services and Mechanisms
• To assess the security needs of an organization effectively, the manager responsible for
security needs some systematic way of defining the requirements for security and characterization
of approaches to satisfy those requirements.
• One approach is to consider three aspects of information security:
• Security attack – Any action that compromises the security of information owned by an
organization.
• Security mechanism – A mechanism that is designed to detect, prevent or recover from a security
attack.
• Security service – A service that enhances the security of the data processing systems and the
information transfers of an organization.
• The services are intended to counter security attacks and they make use of one or more security
mechanisms to provide the service.
Basic Concepts
• Cryptography The art or science encompassing the principles and methods of transforming an intelligible
message into one that is unintelligible, and then retransforming that message back to its original form
• Plaintext The original intelligible message
• Cipher text The transformed message
• Cipher An algorithm for transforming an intelligible message into one that is unintelligible by transposition
and/or substitution methods
• Key Some critical information used by the cipher, known only to the sender& receiver
• Encipher (encode) The process of converting plaintext to cipher text using a cipher and a key
• Decipher (decode) the process of converting cipher text back into plaintext using a cipher and a key
• Cryptanalysis The study of principles and methods of transforming an unintelligible message back into an
intelligible message without knowledge of the key. Also called code breaking
• Cryptology Both cryptography and cryptanalysis
• Code An algorithm for transforming an intelligible message into an unintelligible one using a code-book
Cryptanalysis
• The process of attempting to discover X or K or both is known as cryptanalysis. The strategy used by the
cryptanalysis depends on the nature of the encryption scheme and the information available to the cryptanalyst.
• There are various types of cryptanalytic attacks based on the amount of information known to the
cryptanalyst.
• Cipher text only – A copy of cipher text alone is known to the cryptanalyst.
• Known plaintext – The cryptanalyst has a copy of the cipher text and the corresponding plaintext.
• Chosen plaintext – The cryptanalysts gains temporary access to the encryption machine. They cannot open it
to find the key, however; they can encrypt a large number of suitably chosen plaintexts and try to use the
resulting cipher texts to deduce the key.
• Chosen cipher text – The cryptanalyst obtains temporary access to the decryption machine, uses it to decrypt
several string of symbols, and tries to use the results to deduce the key.
STEGANOGRAPHY
• A plaintext message may be hidden in any one of the two ways. The
methods of steganography conceal the existence of the message, whereas
the methods of cryptography render the message unintelligible to outsiders
by various transformations of the text.
• A simple form of steganography, but one that is time consuming to
construct is one in which an arrangement of words or letters within an
apparently innocuous text spells out the real message.
Eg: - the sequence of first letters of each word of the overall message
spells out the real (Hidden) message.
- Subset of the words of the overall message is used to convey
the hidden message.
SECURITY SERVICES(C-I-A)
• The classification of security services are as follows:
• Confidentiality: Ensures that the information in a computer system and transmitted information
are accessible only for reading by authorized parties.
• E.g. Printing, displaying and other forms of disclosure.
• Authentication: Ensures that the origin of a message or electronic document is correctly
identified, with an assurance that the identity is not false.
• Integrity: Ensures that only authorized parties are able to modify computer system assets and
transmitted information. Modification includes writing, changing status, deleting, creating and
delaying or replaying of transmitted messages.
• Non repudiation: Requires that neither the sender nor the receiver of a message be able to deny
the transmission.
• Access control: Requires that access to information resources may be controlled by or the target
system.
• Availability: Requires that computer system assets be available to authorized parties when needed.
SECURITY MECHANISMS
• One of the most specific security mechanisms in use is cryptographic
techniques.
• Encryption or encryption-like transformations of information are the most
common means of providing security.
• Some of the mechanisms are:-
1. Encipherment
2. Digital Signature
3. Access Control
SECURITY ATTACKS(Passive Vs Active)
• Interruption:- An asset of the system is destroyed or becomes
unavailable or unusable.
• Interception:- An unauthorized party gains access to an asset.
• Modification:- An unauthorized party not only gains access to but
tampers with an asset.
• Fabrication:- An unauthorized party inserts counterfeit objects into
the system.
Cryptographic Attacks
• Passive Attacks
• Passive attacks are in the nature of eavesdropping on, or monitoring of,
transmissions. The goal of the opponent is to obtain information that is being
transmitted. Passive attacks are of two types:
• Release of message contents: A telephone conversation, an e-mail message
and a transferred file may contain sensitive or confidential information. We
would like to prevent the opponent from learning the contents of these
transmissions.
• Traffic analysis: If we had encryption protection in place, an opponent
might still be able to observe the pattern of the message.
Active attacks
• These attacks involve some modification of the data stream or the creation of a
false stream.
• These attacks can be classified in to four categories:
Advantages
1. More Secured
2. Authentication
Disadvantages
1. Relatively Complex
Examples of Asymmetric Key
RSA:
Digital Signature Algorithm:
Diffie-Helman:.
Compare Both?
Model for Network Security
• ..
MODEL FOR NETWORK ACCESS
SECURITY
•-
End of Chapter-1
Q&A
Classical Encryption
Techniques
Chapter 2
Classical encryption techniques
• Encryption :-
• Encryption is something like making a secret letter by changing, swapping or
replacing characters in previously defend order. The format of the message is
not changed.
• Encoding :-
• In coding the format of data is changed. For example we record a voice
sample, the recorder will encode the analog voice signals into digital signals &
store.
25
Basic terminology
• Plaintext: original message to be encrypted
26
Symmetric Cipher Model
27
• Deciphering or decryption: recovering plaintext from
ciphertext
28
• Cipher or cryptographic system : a scheme for
encryption and decryption
29
Ciphers
• Symmetric cipher: same key used for encryption
and decryption
• Block cipher: encrypts a block of plaintext at a time
(typically 64 or 128 bits)
• Stream cipher: encrypts data one bit or one byte at a
time
31
Symmetric Encryption
• Mathematically:
Y = EK(X) or Y = E(K, X)
X = DK(Y) or X = D(K, Y)
• X = plaintext
• Y = ciphertext
• K = secret key
• E = encryption algorithm
• D = decryption algorithm
• Both E and D are known to public
32
Cryptanalysis
• Objective: to recover the plaintext of a ciphertext or, more
typically, to recover the secret key.
33
Language Redundancy and
Cryptanalysis
• Human languages are redundant
• e.g. "th lrd s m shphrd shll nt wnt"
• Letters are not equally commonly used
• In English
• E is by far the most common letter
• Followed by T, R, N, I, O, A, S
• Other letters like Z, J, K, Q, X are fairly rare
• Which set of characters are most commonly used in Chinese?
• Have tables of single, double & triple letter frequencies for various
languages
34
English Letter Frequencies
35
Use in Cryptanalysis
• Key concept
• Monoalphabetic substitution ciphers do not change relative letter
frequencies
• Discovered by Arabian scientists in 9th century
• Calculate letter frequencies for ciphertext
• Compare counts/plots against known values
• Caesar cipher looks for common peaks/troughs
• Peaks at: A-E-I triple, NO pair, RST triple
• Troughs at: JK, X-Z
• Monoalphabetic must identify each letter
• Tables of common double/triple letters help
36
Example Cryptanalysis
• Given ciphertext:
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ
VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX
EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
• Count relative letter frequencies (see text)
• Guess which two individual letters are for e & t (with the highest
frequencies)?
• P&Z
• Guess what “ZW” is for?
• “th” and hence “ZWP” is “the”
• Proceed with trial and error finally get:
it was disclosed yesterday that several informal but direct
contacts have been made with political
representatives of the viet cong in moscow
37
Cryptanalytic Attacks
• May be classified by how much information needed by the attacker:
• Ciphertext-only attack
• Known-plaintext attack
• Chosen-plaintext attack
• Chosen-ciphertext attack
38
Classical Ciphers
• Plaintext is viewed as a sequence of elements (e.g., bits
or characters)
• Substitution cipher: replacing each element of the
plaintext with another element.
• Transposition (or permutation) cipher: rearranging the
order of the elements of the plaintext.
39
Caesar Cipher
• Earliest known substitution cipher
• Invented by Julius Caesar
• Ciphertext is derived from the plaintext alphabet by
shifting each letter a certain number of spaces.
• Each letter is replaced by the letter three positions further
down the alphabet.(+3)
• Plain: 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
Cipher: 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
• Example: Meet me after the tea party phhw ph diwhu
wkh sduwb
40
Caesar Cipher
• Mathematically, map letters to numbers:
a, b, c, ..., x, y, z
0, 1, 2, ..., 23, 24, 25
• Then the general Caesar cipher is:
c = EK(p) = (p + k) mod 26
p = DK(c) = (c – k) mod 26
• Can be generalized with any alphabet.
41
Monoalphabetic Substitution Cipher
• Shuffle the letters and map each plaintext letter to a
different random ciphertext letter:
42
Playfair Cipher
•
• Invented by Charles Wheatstone in 1854, but named after his friend Baron Playfair.
• Simplest substitution cipher with two letters combination.
• Encryption algo takes 5x5 matrix of letters.
• Generate the key table. (drop any duplicate letter).
• Key alphabets are filled in matrix from left to right & top to bottom.
• Rest of the letters are filled in matrix in remaining spaces.
• Letters I & j takes the same place.
43
Playfair Cipher
• Rules:
• If pair letters are same, add an X (uncommon letter) after the first letter.
• Balloon will be (ba lx lo on).
• If the letter appear in same row / column of the table, replace them with the
letter to immediate right respectively.
• If the letters are not on same row or column , replace with letter in the
corners of rectangle.
Playfair Key Matrix
• Use a 5 x 5 matrix.
• Fill in letters of the key (w/o duplicates).
• Fill the rest of matrix with other letters.
• E.g., key = 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
45
Encrypting and Decrypting
Plaintext is encrypted two letters at a time.
1. If a pair is a repeated letter, insert filler like 'X’.
2. If both letters fall in the same row, replace each with the
letter to its right (circularly).
3. If both letters fall in the same column, replace each with
the the letter below it (circularly).
4. Otherwise, each letter is replaced by the letter in the same
row but in the column of the other letter of the pair.
46
Vigenere cipher
• In this scheme, the set of related monoalphabetic substitution rules
consisting of 26 caesar ciphers with shifts of 0 through 25.
• Each cipher is denoted by a key letter. e.g., Caesar cipher with a shift of 3
is denoted by the key value 'd‟(since a=0, b=1, c=2 and so on).
• To aid in understanding the scheme, a matrix known as vigenere table is
Constructed
• Each of the 26 ciphers is laid out horizontally, with the key letter for each
cipher to its left. A normal alphabet for the plaintext runs across the top.
Vigenere …
…
• Given a key letter X and a plaintext letter y, the cipher text is at the intersection of the row labeled
x and the column labeled y; in this case, the ciphertext is V.
• To encrypt a message, a key is needed that is as long as the message. Usually, the key is a
repeating keyword. e.g., key = d e c e p t i v e d e c e p t i v e d e c e p t i v e PT = w e a r e
d i s c o v e r e d s a v e y o u r s e l f CT = ZICVTWQNGRZGVTWAVZHCQYGLMGJ
• Decryption is equally simple. The key letter again identifies the row. The position of the cipher
text letter in that row determines the column, and the plaintext letter is at the top of that column.
54
Vigenère Cipher
• Simplest polyalphabetic substitution cipher
• Consider the set of all Caesar ciphers:
{ Ca, Cb, Cc, ..., Cz }
• Key: e.g. security
• Encrypt each letter using Cs, Ce, Cc, Cu, Cr, Ci, Ct, Cy in turn.
• Repeat from start after Cy.
• Decryption simply works in reverse.
55
Example of Vigenère Cipher
• Keyword: deceptive
key: deceptivedeceptivedeceptive
plaintext: wearediscoveredsaveyourself
ciphertext: ZICVTWQNGRZGVTWAVZHCQYGLMGJ
56
Security of Vigenère Ciphers
• There are multiple (how many?) ciphertext letters corresponding
to each plaintext letter.
• So, letter frequencies are obscured but not totally lost.
• To break Vigenere cipher:
57
Transposition Ciphers
• Also called permutation ciphers.
58
Row Transposition Ciphers
• Plaintext is written row by row in a rectangle.
59
Product Ciphers
• Uses a sequence of substitutions and transpositions
• Harder to break than just substitutions or transpositions
• This is a bridge from classical to modern ciphers.
60
Unconditional & Computational Security
• A cipher is unconditionally secure if it is secure no
matter how much resources (time, space) the
attacker has.
• A cipher is computationally secure if the best
algorithm for breaking it will require so much
resources (e.g., 1000 years) that practically the
cryptosystem is secure.
• All the ciphers we have examined are not
unconditionally secure.
61
An unconditionally Secure Cipher
Plaintext = m1m2m3m4
Ciphertext = c1c2c3c4
where ci mi ki
62
Steganography
• Hide a message in another message.
63
Different Types of Steganography
1. Text Steganography − There is steganography in text files, which entails secretly storing
information. In this method, the hidden data is encoded into the letter of each word.
2. Image Steganography − The second type of steganography is image steganography, which
entails concealing data by using an image of a different object as a cover. Pixel intensities
are the key to data concealment in image steganography.
3. Audio Steganography − It is the science of hiding data in sound. Used digitally, it protects
against unauthorized reproduction. Watermarking is a technique that encrypts one piece of
data (the message) within another (the "carrier"). Its typical uses involve media playback,
primarily audio clips.
4. Video Steganography − Video steganography is a method of secretly embedding data or
other files within a video file on a computer. Video (a collection of still images) can function
as the "carrier" in this scheme. Discrete cosine transform (DCT) is commonly used to insert
values that can be used to hide the data in each image in the video, which is undetectable to
the naked eye. Video steganography typically employs the following file formats: H.264,
MP4, MPEG, and AVI.
5. Network or Protocol Steganography − It involves concealing data by using a network
protocol like TCP, UDP, ICMP, IP, etc., as a cover object. Steganography can be used in the
case of covert channels, which occur in the OSI layer network model.
Steganography Examples Include
• Writing with invisible ink
• Embedding text in a picture (like an artist hiding their initials in a
painting they’ve done)
• Backward masking a message in an audio file (remember those stories of
evil messages recorded backward on rock and roll records?)
• Concealing information in either metadata or within a file header
• Hiding an image in a video, viewable only if the video is played at a
particular frame rate
• Embedding a secret message in either the green, blue, or red channels of
an RRB image
• Watermarking
• Take a 640x480 (=30,7200) pixel image.
• Using only 1 LSB, can hide 115,200 characters
• Using 4 LSBs, can hide 460,800 characters.
66
Steganography vs Cryptography
SCHOOL OF INFORMATICS
Department of Information Technology
Course: Cryptography and N/w Security
Chapter 3 and 4
Outline
Criteria for „Good” Ciphers
Stream and Block Ciphers
Criteria for „Good” Ciphers (1)
Transposition
C scrambles text => hides n-grams for n > 1
Product ciphers
Can do all of the above
c. Block ciphers
C: cbzoiowlppujmksilgqvsofhbowyyj
C as sent (in the right-to-left order):
Example:
YELLOW SUBMAZGTR
R could guess, that the 2nd word should really be:
SUBMARINE
=> R would know that S dropped a char from K after
sending „SUBMA”
=> R could go back 4 chars, drop a char from K
(„recalibrate K with C”), and get „resynchronized” with S
Block Ciphers (1)
Block cipher:
1 block of chars from P 1 block of chars for C
Example of block cipher: columnar transposition
Block size = „o(message length)” (informally)
Block Ciphers (2)
xlwlxroedolh
Sender Receiver
S R
Block Ciphers (3)
C as received (in the right-to-left order): xlwlxroedolh
R knows: K = 3, block size = 12 (=> 4 rows) 123
456
a=10
789 b=11
abc c=12
(‘hello’)
10 chars of C to decode 6th, 7th, and 8th chars of P
(‘hello wor’)
etc.
Block Ciphers (4)
Informally, we might call ciphers like the above example
columnar transposition cipher „weak-block” ciphers
R can get some (even most) but not all chars of P before
entire C is received
R can get one char of P immediately
the 1st-after 1 of C (delay of 1 - 1 = 0)
- Low diffusion
Each char separately encoded => carries over its
frequency info
- Susceptibility to malicious insertion / modification
Adversary can fabricate a new msg from pieces of
of) a block of C
+ Immune to insertion
Impossible to insert a char into a block without easy
For some E can’t decode even the 1st char before whole k
chars of a block are received
C1 D1
LSH LSH
PC-2 K16
Overview of DES (4) -
Problems with DES
Diffie, Hellman 1977 prediction: “In a few years, technology
would allow DES to be broken in days.”
Triple DES:
Is it C = E(k3, E(k2, E(k1, P) ) ?
Not so simple!
Double and Triple DES (3)
Triple DES:
Tricks used:
D not E in the 2nd step, k1 used twice (in steps 1 & 3)
It is:
C = E(k1, D(k2, E(k1, P) )
and
P = D(k1, E(k2, D(k1, C) )
Outline
What is AES?
Overview of Rijndael
Strength of AES
Comparison of DES and AES
What is AES?
• The Advanced Encryption Standard (AES) is a symmetric block cipher chosen by the
U.S. government to protect classified information.
• AES is implemented in software and hardware throughout the world
to encrypt sensitive data. It is essential for government computer security,
cybersecurity and electronic data protection.
• The National Institute of Standards and Technology (NIST) started development of
AES in 1997 when it announced the need for an alternative to the Data Encryption
Standard (DES), which was starting to become vulnerable to brute-force attacks.
• AES was created for the U.S. government with additional voluntary, free use in public
or private, commercial or noncommercial programs that provide encryption services.
• AES works self-encrypting disk drives, database encryption and storage encryption
How AES encryption works?
AES includes three block ciphers:
• AES-128 uses a 128-bit key length to encrypt and decrypt a block of
messages.
• AES-192 uses a 192-bit key length to encrypt and decrypt a block of
messages.
• AES-256 uses a 256-bit key length to encrypt and decrypt a block of
messages.
•
AES Design
Feature of AES?
• Security. Competing algorithms were to be judged on their ability to
resist attack as compared to other submitted ciphers. Security
strength was to be considered the most important factor in the
competition.
• Cost. Intended to be released on a global, nonexclusive and royalty-
free basis, the candidate algorithms were to be evaluated on
computational and memory efficiency.
• Implementation. Factors to be considered included the algorithm's
flexibility, suitability for hardware or software implementation, and
overall simplicity.
Overview of Rijndael/AES
Similar to DES – cyclic type of approach
128-bit blocks of P
# of iterations based on key length
128-bit key => 9 “rounds” (called rounds, not cycles)
Weaknesses in AES?
• Eve knows
SA,B = KBkA mod p
• g and p SB,A = KAkB mod p
• KA and KB
• Why can’t Eve compute the secret?
• Given:
• Multiplicative group G
• Element a in G
• Output b
• Find:
• Unique solution to ax = b in G
• x is loga b
• Example: (10) = 4
• 1, 3, 7, 9
• Example: (7) = 6
• 1, 2, 3, 4, 5, 6
• If n is prime, (n) = n-1
RSA keys
• Choose 2 large primes, p and q
• N = pq
• (N) = (p-1)(q-1)
• Choose e < N such that gcd(e, (N))=1
• d such that ed = 1 mod (N)
c = me mod N m = cd mod N
Bob
Alice
Toy example
• p=7, q=11
• N=77
• (N) = (6)(10) = 60
• Bob chooses e=17
• Uses extended Euclidean algorithm to find inverse of e mod 60
• Finds d=53
• No certificates required