Lec2 - Cryptographic Tools
Lec2 - Cryptographic Tools
Cryptographic
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Types of Encryption
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Symmetric Encryption
§ The universal technique for providing confidentiality for transmitted or stored data
§ Also referred to as conventional encryption or single-key encryption
§ Two requirements for secure use:
§ Need a strong encryption algorithm
§ Sender and receiver must have obtained copies of the secret key in a secure fashion and must
keep the key secure
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Attacking Symmetric Encryption
Strength concerns:
Concerns about the algorithm itself
DES is the most studied encryption algorithm in existence
Concerns about the use of a 56-bit key
The speed of commercial off-the-shelf processors makes this key length
woefully inadequate
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Number of Time Required
Key size Alternative Time Required at 109 at 1013
(bits) Cipher Keys decryptions/s decryptions/s
56 DES 256 ≈ 7.2 × 1016 255 ns = 1.125 years 1 hour
AES 2127 ns = 5.3 × 1021
128 2128 ≈ 3.4 × 1038 years 5.3 × 1017 years
192 AES 2192 ≈ 6.3 × 1057 2191 ns = 9.8 × 1040 9.8 × 1036 years
years
256 AES 2256 ≈ 1.2 × 1077 2255 ns = 1.8 × 1060 1.8 × 1056 years
years
• Repeats basic DES algorithm three times using either two or three unique keys
• First standardized for use in financial applications in ANSI standard X9.17 in 1985
• Attractions:
• 168-bit key length overcomes the vulnerability to brute-force attack of DES
• Underlying encryption algorithm is the same as in DES
• Drawbacks:
• Algorithm is sluggish in software
• Uses a 64-bit block size
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Advanced Encryption Standard (AES)
Significantly improved
efficiency Published as
3DES was not reasonable
for long term use FIPS 197
Symmetric block cipher
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Practical Security Issues
• Typically symmetric encryption is applied to a unit of data larger than a single 64-bit or 128-
bit block
• Modes of operation
• Alternative techniques developed to increase the security of symmetric block encryption for large
sequences
• Overcomes the weaknesses of ECB
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Block Cipher vs Stream Cipher
Block Cipher
Stream Cipher
• Processes the input elements continuously
• Produces output one element at a time
• Primary advantage is that they are almost always faster and use far
less code
• Encrypts plaintext one byte at a time
• Pseudorandom stream is one that is unpredictable without
knowledge of the input key
Block Cipher vs Stream Cipher
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Block Cipher vs Stream Cipher
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Secure H
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Message Authentication
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Message Authentication Without Confidentiality
• Message encryption by itself does not provide a secure form of authentication
• It is possible to combine authentication and confidentiality in a single algorithm by encrypting
a message plus its authentication tag
• Typically message authentication is provided as a separate function from message encryption
• Situations in which message authentication without confidentiality may be preferable include:
• There are a number of applications in which the same message is broadcast to a number of destinations
• An exchange in which one side has a heavy load and cannot afford the time to decrypt all incoming messages
• Authentication of a computer program in plaintext is an attractive service
• Thus, there is a place for both authentication and encryption in meeting security
requirements
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
MD5 or SHA1 or SHA256
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
To be useful for message authentication, a hash
function H must have the following properties:
Can be applied to a block of data of any size
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Security of Hash Functions
Cryptanalysis Passwords
• Exploit logical weaknesses • Hash of a password is
in the algorithm stored by an operating
system
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Public-Key Encryption Structure
Asymmetric
• Uses two
separate keys
Publicly Some form of
Based on • Public key and
proposed by protocol is
mathematical private key
Diffie and needed for
functions • Public key is
Hellman in 1976 made public for distribution
others to use
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Public-key encryption
l
l
l
l
l
l
l
l
l
l
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Public-key encryption
Applications for Public-Key Cryptosystems
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Requirements for Public-Key Cryptosystems
Computationally easy
to create key pairs
Computationally easy
Useful if either key for sender knowing
can be used for each public key to encrypt
role messages
Computationally
Computationally easy
infeasible for
for receiver knowing
opponent to
private key to decrypt
otherwise recover
ciphertext
original message
Computationally
infeasible for opponent
to determine private
key from public key
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Asymmetric Encryption Algorithms
RSA (Rivest, Most widely accepted and
Block cipher in which the
plaintext and ciphertext
Shamir, Developed in 1977 implemented approach to
public-key encryption
are integers between 0
Adleman) and n-1 for some n.
Elliptic curve
Security like RSA, but with
cryptography much smaller keys
(ECC)
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Digital Signatures
• NIST FIPS PUB 186-4 defines a digital signature as:
• FIPS 186-4 specifies the use of one of three digital signature algorithms:
• Digital Signature Algorithm (DSA)
• RSA Digital Signature Algorithm
• Elliptic Curve Digital Signature Algorithm (ECDSA)
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Random Numbers
ü Session key
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Summary
• Confidentiality with symmetric • Public-key encryption
encryption § Structure
§ Symmetric encryption § Applications for public-key cryptosystems
§ Symmetric block encryption algorithms § Requirements for public-key cryptography
§ Stream ciphers § Asymmetric encryption algorithms
Caesar Cipher
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
46
Classical Substitution Ciphers
• letters of plaintext are replaced by other letters or by numbers or symbols
• or if plaintext is viewed as a sequence of bits, then substitution involves replacing plaintext bit
patterns with ciphertext bit patterns
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Caesar Cipher
earliest known substitution cipher
by Julius Caesar
first attested use in military affairs
replaces each letter by 3rd letter on example:
Any cipher using a simple letter shift, is a Caesar cipher, not just those
with shift 3.
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
48
Caesar Cipher
can define transformation as:
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
mathematically give each letter a number
•E=?
•T=?
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
50
Caesar Cipher meet me after the toga party
PHHW PH DIWHU WKH WRJD SDUWB
• What about “MTBID”? encrypted using key f (ie a shift of 5) is.... howdy
(7,14,22,3,24) encrypted using key f(5)
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
51
Caesar Cipher
Using this encryption, the message
TREATY IMPOSSIBLE
wuhdwb lpsrvvleoh
¡with shift 3
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
52
Cryptanalysis of the Caesar Cipher
TREATY IMPOSSIBLE
wuhdwb lpsrvvleoh
From the ciphertext, we can get many clues. For example:
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Cryptanalysis of the Caesar Cipher
¡ Spaces between words allow us to determine small words: am, is, to, be,
he, we, and, are, and so on..
¡ Substitute known short words at appropriate place
¡ Once the small words fall into place, try substituting for matching characters
at other places in the ciphertext
¡ r is repeated in wrr can be mapped to see, too, add, odd, off
¡ wr also appear in the ciphertext, so we can compare and guess its use with
wrr can be to/too, of/off vs. (se/see, ad/add,od/odd)
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
54
Cryptanalysis of Caesar Cipher
Øonly have 26 possible ciphers
lA maps to A/B/.../Z
Øcould simply try each in turn, using a brute force search
Ø given ciphertext, just try all shifts of letters
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
55
Classic Ciphers
Monoalphabetic Cipher
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
56
Monoalphabetic Cipher
rather than just shifting the alphabet, 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
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
57
Monoalphabetic Cipher Security
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
58
Language Redundancy and Cryptanalysis
Ø human languages are redundant , we do not need all the letters to
understand written English text.
Ø Eg: “ndrstnd wrttn nglsh txt"
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
59
English Letter Frequencies
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
60
Use in Cryptanalysis
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
61
Use in Cryptanalysis
In caesar cipher look for common peaks (frequent)/ troughs (less
frequent)
¡peaks at: A-E-I triple, N-O pair, R-S-T triple
¡troughs at: J-K, X-Z
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
62
Example Cryptanalysis
given ciphertext:
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ
VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSXEPYEPOPD
ZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
63
Example Cryptanalysis
given ciphertext:
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ
VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX
EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
65
Classic Ciphers
Playfair Cipher
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
66
Playfair Cipher
Ønot even the large number of keys in a monoalphabetic cipher provides
security
Øinvented by Charles Wheatstone in 1854, but named after his friend Baron
Playfair
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
67
Playfair Key Matrix
Ø a 5X5 matrix of letters based on a keyword
Ø fill in letters of keyword (sans duplicates)
Ø fill rest of matrix with other letters (from A to Z)
Øeg. using the keyword MONARCHY
Ø L to R, top to bottom, first with keyword after duplicate letters have been
removed, and then with the remaining letters, with I/J used as a single
letter
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
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
68
Encrypting and Decrypting 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
2. if both letters fall in the same row, replace each with letter to the
right (wrapping back to start from end)
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
69
Encrypting and Decrypting M O N A R
C H Y B D
E F G I/J K
L P Q S T
plaintext is encrypted with two letters at a time U V W X Z
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
70
Example
Note that in this case two nulls must be added. There are no 'J's to
worry about.
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
71
Suppose that we choose PLAYFAIR for the keyword
and suppose that we use the following keysquare :
P L A Y F
I R S T U
V W X Z B
C D E G H
K M N O Q
ad va nc er ig ht fl an kt ob un ke rh
il lt he nt ak eu px po si ti on sr ea
dy fo ra tx ta ck
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
72
P L A Y F
ad va nc er ig ht fl
an kt ob un ke rh il I R S T U
lt he nt ak eu px po V W X Z B :
si ti on sr ea dy fo C D E G H
ra tx ta ck
K M N O Q
73
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
P L A Y F
ad va nc er ig ht fl
an kt ob un ke rh il I R S T U
lt he nt ak eu px po V W X Z B :
si ti on sr ea dy fo C D E G H
ra tx ta ck
K M N O Q
74
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
LE XP KE DS TC GU PA SA kt ob un ke rh il
lt he nt ak eu px po si ti on sr ea dy fo
ra tx ta ck
LE XP KE DS TC GU PA SA OI QZ SQ NC UD
RP YR CG OS PN HS AV YK TR UR QO TS NS
GL YQ SL SZ SY KP
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
75
With the same key, try this:
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
76
With the same key, try this:
HI DE TH EG OL DI NT HE TR EX ES TU MP
P L A Y F
I R S T U
V W X Z B
C D E G H
K M N O Q
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
77
Classic Ciphers
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
78
Double Transposition Cipher
(a.k.a. double columnar transposition)
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Double Transposition Cipher
(a.k.a. double columnar transposition)
Exercise:
One of the major challenges in the realm of security threats is malicious software.
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
One of the major challenges in the realm of security threats is
malicious software
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
Security of Playfair Cipher
Øsecurity much improved over monoalphabetic
Øsince have 26 x 26 = 676 digrams
Team
TTTN 6224 : COMPUTER SECURITY & DEFENSE Modellers
82