SlideShare a Scribd company logo
CNIT 141
Cryptography for Computer Networks
1. Encryption
Topics
• The Basics
• Classical Ciphers
• How Ciphers Work
• Perfect Encryption: The One-Time Pad
• Encryption Security
• Asymmetric Encryption
• When Ciphers Do More Than Encryption
• How Things Can Go Wrong
The Basics
• P: Plaintext
• K: Key
• C: Cleartext
• E: Encryption via cipher
• D: Decryption via cipher
Classical Ciphers
Caesar Cipher
Caesar Cipher in Python
Brute Force Attack in Python
Brute
Force
Attack in
Python
Vigenere Cipher
• Shift varies with a repeated keyword
• Combine several Caesar ciphers together
Breaking the Vigenere
Cipher
• Find repeating ciphertext to deduce key length
• Use frequency analysis
Frequency Analysis
• From Wikipedia
Modified Caesar Program
• Converts to
uppercase
• Preserves
spaces
Encrypt a Paragraph
Frequency Counter
CNIT 141: 1. Encryption
How Ciphers Work
Two Components
• Permutation
• Transforms one letter to another letter
• In Caesar cipher, shift letter three places
• Mode of Operation
• Algorithm to handle messages of arbitrary
size
• In Caesar cipher, process each letter
independently
Permutation Security
• Permutation should be determined by
the key
• If key is secret, attacker can’t easily
decrypt
• Different keys should result in different
permutations
• Permutation should look random
• No pattern in ciphertext
Mode of Operation
• Caesar cipher encrypts letters one at a time
• Double letters remain doubled
• HELLO -> KHOOR
• Patterns in plaintext are preserved in ciphertext
• Insecure (now called “Electronic Code Book”
mode)
• More secure modes encrypt repeated text
differently each time
Perfect Encryption:
The One-Time Pad
XOR
• XOR combines two bits
• 0 ^ 0 = 0
• 0 ^ 1 = 1
• 1 ^ 0 = 1
• 1 ^ 1 = 0
Encrypting a Stream of
Bits
• Plain: ABC = 0100 0001 0100 0010 0100 0011
• Key: 0110 0110 0110 0101 1010 1110
• Cipher: 0010 0111 0010 0111 1110 1101
•Key must be random and never re-used
•Key must be longer than all the plaintexts you
want to send
Unbreakable
• If an attacker uses a brute-force attack
• Trying all possible keys
• They get all possible letter sequences
• No way to identify the correct decryption
CNIT 141: 1. Encryption
Encryption Security
Attack Models
• Set requirements for cryptographers who
design ciphers
• So they know what attacks to prevent
• Give guidelines to users
• Whether a cipher is safe in their environment
• Provide clues for cryptanalysts who attempt to
break ciphers
• Is an attack doable in the model considered?
Attack Models
Kerckhoff’s Principle
• The key is secret
• The cipher is not secret
Black-Box Models
No knowledge of cipher operation
• Ciphertext-Only Attack (COA)
• Attacker sees only C
• Known-Plaintext Attack (KPA)
• Attacker knows P and C
• Chosen-Plaintext Attack (CPA)
• Attacker can perform encryption for any P
• Chosen-Ciphertext Attack (CCA)
• Attacker can perform encryption and decryption
Gray-Box Models
• Attacker has access to the implementation
• Can tamper with the system’s internals
• Side-channel attack
• Attacker measures something else about the
cipher’s operation
• Such as timing or power consumption
• Noninvasive — does not alter integrity of
system
Gray-Box Models
• Invasive attacks
• Modify system
• Examples
• Using acid to dissolve parts of a microchip
• Injecting faults with lasers
Security Goals
• Indistinguishability
• Ciphertext should be indistinguishable from
a random string
• Non-malleability
• Ciphertext cannot be altered and produce
meaningful plaintext
Security Notions
• IND-CPA
• Indistinguishability against a Chosen-
Plaintext Attack
• Also called semantic security
• Two identical plaintext strings must result in
different ciphertexts
• Accomplished by adding “random” bits each
time you encrypt
Asymmetric Encryption
• Uses two keys
• Also called Public-Key encryption
• Public key freely published to everyone
• Private key held secret
• Will be in later chapters—everything in this
chapter is about symmetric encryption
When Ciphers Do More
Than Encryption
Authenticated Encryption
• Returns an authentication
tag with the ciphertext
• Tag ensures integrity of the
message and also
authenticates the author
• Authenticated Encryption
with Associated Data
(AWAD)
• Another variant
Format-Preserving Encryption
• Normally encryption takes inputs as bits and
returns outputs as bits
• Could be written as hex, base64, etc.
• Format-Preserving Encryption returns
ciphertext in the same format as the plaintext
• Zip code -> Zip code
• IP address -> IP address
Fully Homomorphic
Encryption
• Allows modification of encrypted data without
decrypting it
• The first FHE scheme was created in 2009
• Very slow
Searchable Encryption
• Searches encrypted data without decrypting it
• Using an encrypted search string
• Protects privacy of search engine users
• Experimental at present
Tweakable Encryption
• Adds a “tweak” parameter to normal
encryption
• Such as a unique customer number
• Main application is disk encryption
How Things Can Go
Wrong
Weak Cipher
• 2G phone networks used the A5/1 cipher
• Vulnerable to a time-memory trade-off attack
• Using large lookup tables to speed up an
attack
Wrong Model
• Padding Oracle attack
• If a user submitted data that decrypted to a
valid string, that was taken as authentication
• Even if the string contained nonsense
• Server provided error messages for incorrect
padding
• Those erroirs can be used to find valid
ciohertext without knowing the key
CNIT 141: 1. Encryption

More Related Content

PDF
CNIT 141: 1. Encryption
PDF
CNIT 141: 1. Encryption
PDF
CNIT 141: 4. Block Ciphers
PDF
CNIT 141: 1. Encryption
PDF
CNIT 141 7. Keyed Hashing
PDF
CNIT 141: 6. Hash Functions
PDF
CNIT 141 8. Authenticated Encryption
PDF
CNIT 141: 8. Authenticated Encryption
CNIT 141: 1. Encryption
CNIT 141: 1. Encryption
CNIT 141: 4. Block Ciphers
CNIT 141: 1. Encryption
CNIT 141 7. Keyed Hashing
CNIT 141: 6. Hash Functions
CNIT 141 8. Authenticated Encryption
CNIT 141: 8. Authenticated Encryption

What's hot (20)

PDF
CNIT 1417. Keyed Hashing
PDF
CNIT 141: 3. Cryptographic Security
PDF
CNIT 141: 4. Block Ciphers
PDF
CNIT 141: 7. Keyed Hashing
PPTX
CISSP Certification Security Engineering-Part2
PDF
CNIT 141 11. Diffie-Hellman
PDF
CNIT 141: 4. Block Ciphers
PDF
CNIT 141 6. Hash Functions
PPTX
«Applied cryptanalysis stream ciphers» by Vladimir Garbuz
PDF
CNIT 141: 14. Quantum and Post-Quantum
PDF
CNIT 141 12. Elliptic Curves
PPT
Cryptography
PDF
Applied cryptanalysis - stream ciphers
PDF
CNIT 141: 11. Diffie-Hellman
PDF
SunshinePHP 2017: Tales From The Crypt - A Cryptography Primer
PDF
Applied cryptanalysis - everything else
ODP
Introduction to ethereum_public
PPTX
Reinventing anon email
PDF
CNIT 141: 13. TLS
PPTX
Laverna vs etherpad
CNIT 1417. Keyed Hashing
CNIT 141: 3. Cryptographic Security
CNIT 141: 4. Block Ciphers
CNIT 141: 7. Keyed Hashing
CISSP Certification Security Engineering-Part2
CNIT 141 11. Diffie-Hellman
CNIT 141: 4. Block Ciphers
CNIT 141 6. Hash Functions
«Applied cryptanalysis stream ciphers» by Vladimir Garbuz
CNIT 141: 14. Quantum and Post-Quantum
CNIT 141 12. Elliptic Curves
Cryptography
Applied cryptanalysis - stream ciphers
CNIT 141: 11. Diffie-Hellman
SunshinePHP 2017: Tales From The Crypt - A Cryptography Primer
Applied cryptanalysis - everything else
Introduction to ethereum_public
Reinventing anon email
CNIT 141: 13. TLS
Laverna vs etherpad
Ad

Similar to CNIT 141: 1. Encryption (20)

PPTX
IEDA 3302 e-commerce_secure-communications.pptx
PDF
CNIT 125 Ch 4. Security Engineering (Part 2)
PPT
CISSP EXAM PREPARATION FOR A PASSED SCORE
PPT
symet.crypto.hill.cipher.2023.ppt
PDF
CISSP Prep: Ch 4. Security Engineering (Part 2)
PPTX
Cryptography Introduction
PDF
3 Basics of Cryptography Basics of Cryptography
PPTX
Cryptography, Cryptology, Encryption and types
PPT
crypto slide for students, check out the good article
PDF
Security fundamentals
PDF
Security Fundamentals
PDF
Classic Cryptography
PPT
Day5
PDF
Cryptography (under)engineering
PPT
Ch08-CryptoConcepts.ppt
PPTX
CISSP - Chapter 3 - Cryptography
PPT
overview of cryptographic techniques
PPT
Computer systems security 7-cryptography.ppt
PPT
Stallings Kurose and Ross
PDF
4. Block Ciphers
IEDA 3302 e-commerce_secure-communications.pptx
CNIT 125 Ch 4. Security Engineering (Part 2)
CISSP EXAM PREPARATION FOR A PASSED SCORE
symet.crypto.hill.cipher.2023.ppt
CISSP Prep: Ch 4. Security Engineering (Part 2)
Cryptography Introduction
3 Basics of Cryptography Basics of Cryptography
Cryptography, Cryptology, Encryption and types
crypto slide for students, check out the good article
Security fundamentals
Security Fundamentals
Classic Cryptography
Day5
Cryptography (under)engineering
Ch08-CryptoConcepts.ppt
CISSP - Chapter 3 - Cryptography
overview of cryptographic techniques
Computer systems security 7-cryptography.ppt
Stallings Kurose and Ross
4. Block Ciphers
Ad

More from Sam Bowne (20)

PDF
Introduction to the Class & CISSP Certification
PDF
Cyberwar
PDF
3: DNS vulnerabilities
PDF
8. Software Development Security
PDF
4 Mapping the Application
PDF
3. Attacking iOS Applications (Part 2)
PDF
12 Elliptic Curves
PDF
11. Diffie-Hellman
PDF
2a Analyzing iOS Apps Part 1
PDF
9 Writing Secure Android Applications
PDF
12 Investigating Windows Systems (Part 2 of 3)
PDF
10 RSA
PDF
12 Investigating Windows Systems (Part 1 of 3
PDF
9. Hard Problems
PDF
8 Android Implementation Issues (Part 1)
PDF
11 Analysis Methodology
PDF
8. Authenticated Encryption
PDF
7. Attacking Android Applications (Part 2)
PDF
7. Attacking Android Applications (Part 1)
PDF
5. Stream Ciphers
Introduction to the Class & CISSP Certification
Cyberwar
3: DNS vulnerabilities
8. Software Development Security
4 Mapping the Application
3. Attacking iOS Applications (Part 2)
12 Elliptic Curves
11. Diffie-Hellman
2a Analyzing iOS Apps Part 1
9 Writing Secure Android Applications
12 Investigating Windows Systems (Part 2 of 3)
10 RSA
12 Investigating Windows Systems (Part 1 of 3
9. Hard Problems
8 Android Implementation Issues (Part 1)
11 Analysis Methodology
8. Authenticated Encryption
7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 1)
5. Stream Ciphers

Recently uploaded (20)

PDF
Insiders guide to clinical Medicine.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
Institutional Correction lecture only . . .
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Pharma ospi slides which help in ospi learning
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Pre independence Education in Inndia.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Insiders guide to clinical Medicine.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Sports Quiz easy sports quiz sports quiz
Institutional Correction lecture only . . .
O7-L3 Supply Chain Operations - ICLT Program
Microbial disease of the cardiovascular and lymphatic systems
Pharmacology of Heart Failure /Pharmacotherapy of CHF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Pharma ospi slides which help in ospi learning
FourierSeries-QuestionsWithAnswers(Part-A).pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Pre independence Education in Inndia.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
VCE English Exam - Section C Student Revision Booklet
Supply Chain Operations Speaking Notes -ICLT Program
Microbial diseases, their pathogenesis and prophylaxis
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf

CNIT 141: 1. Encryption

  • 1. CNIT 141 Cryptography for Computer Networks 1. Encryption
  • 2. Topics • The Basics • Classical Ciphers • How Ciphers Work • Perfect Encryption: The One-Time Pad • Encryption Security • Asymmetric Encryption • When Ciphers Do More Than Encryption • How Things Can Go Wrong
  • 3. The Basics • P: Plaintext • K: Key • C: Cleartext • E: Encryption via cipher • D: Decryption via cipher
  • 7. Brute Force Attack in Python
  • 9. Vigenere Cipher • Shift varies with a repeated keyword • Combine several Caesar ciphers together
  • 10. Breaking the Vigenere Cipher • Find repeating ciphertext to deduce key length • Use frequency analysis
  • 12. Modified Caesar Program • Converts to uppercase • Preserves spaces
  • 17. Two Components • Permutation • Transforms one letter to another letter • In Caesar cipher, shift letter three places • Mode of Operation • Algorithm to handle messages of arbitrary size • In Caesar cipher, process each letter independently
  • 18. Permutation Security • Permutation should be determined by the key • If key is secret, attacker can’t easily decrypt • Different keys should result in different permutations • Permutation should look random • No pattern in ciphertext
  • 19. Mode of Operation • Caesar cipher encrypts letters one at a time • Double letters remain doubled • HELLO -> KHOOR • Patterns in plaintext are preserved in ciphertext • Insecure (now called “Electronic Code Book” mode) • More secure modes encrypt repeated text differently each time
  • 21. XOR • XOR combines two bits • 0 ^ 0 = 0 • 0 ^ 1 = 1 • 1 ^ 0 = 1 • 1 ^ 1 = 0
  • 22. Encrypting a Stream of Bits • Plain: ABC = 0100 0001 0100 0010 0100 0011 • Key: 0110 0110 0110 0101 1010 1110 • Cipher: 0010 0111 0010 0111 1110 1101 •Key must be random and never re-used •Key must be longer than all the plaintexts you want to send
  • 23. Unbreakable • If an attacker uses a brute-force attack • Trying all possible keys • They get all possible letter sequences • No way to identify the correct decryption
  • 26. Attack Models • Set requirements for cryptographers who design ciphers • So they know what attacks to prevent • Give guidelines to users • Whether a cipher is safe in their environment • Provide clues for cryptanalysts who attempt to break ciphers • Is an attack doable in the model considered?
  • 28. Kerckhoff’s Principle • The key is secret • The cipher is not secret
  • 29. Black-Box Models No knowledge of cipher operation • Ciphertext-Only Attack (COA) • Attacker sees only C • Known-Plaintext Attack (KPA) • Attacker knows P and C • Chosen-Plaintext Attack (CPA) • Attacker can perform encryption for any P • Chosen-Ciphertext Attack (CCA) • Attacker can perform encryption and decryption
  • 30. Gray-Box Models • Attacker has access to the implementation • Can tamper with the system’s internals • Side-channel attack • Attacker measures something else about the cipher’s operation • Such as timing or power consumption • Noninvasive — does not alter integrity of system
  • 31. Gray-Box Models • Invasive attacks • Modify system • Examples • Using acid to dissolve parts of a microchip • Injecting faults with lasers
  • 32. Security Goals • Indistinguishability • Ciphertext should be indistinguishable from a random string • Non-malleability • Ciphertext cannot be altered and produce meaningful plaintext
  • 33. Security Notions • IND-CPA • Indistinguishability against a Chosen- Plaintext Attack • Also called semantic security • Two identical plaintext strings must result in different ciphertexts • Accomplished by adding “random” bits each time you encrypt
  • 34. Asymmetric Encryption • Uses two keys • Also called Public-Key encryption • Public key freely published to everyone • Private key held secret • Will be in later chapters—everything in this chapter is about symmetric encryption
  • 35. When Ciphers Do More Than Encryption
  • 36. Authenticated Encryption • Returns an authentication tag with the ciphertext • Tag ensures integrity of the message and also authenticates the author • Authenticated Encryption with Associated Data (AWAD) • Another variant
  • 37. Format-Preserving Encryption • Normally encryption takes inputs as bits and returns outputs as bits • Could be written as hex, base64, etc. • Format-Preserving Encryption returns ciphertext in the same format as the plaintext • Zip code -> Zip code • IP address -> IP address
  • 38. Fully Homomorphic Encryption • Allows modification of encrypted data without decrypting it • The first FHE scheme was created in 2009 • Very slow
  • 39. Searchable Encryption • Searches encrypted data without decrypting it • Using an encrypted search string • Protects privacy of search engine users • Experimental at present
  • 40. Tweakable Encryption • Adds a “tweak” parameter to normal encryption • Such as a unique customer number • Main application is disk encryption
  • 41. How Things Can Go Wrong
  • 42. Weak Cipher • 2G phone networks used the A5/1 cipher • Vulnerable to a time-memory trade-off attack • Using large lookup tables to speed up an attack
  • 43. Wrong Model • Padding Oracle attack • If a user submitted data that decrypted to a valid string, that was taken as authentication • Even if the string contained nonsense • Server provided error messages for incorrect padding • Those erroirs can be used to find valid ciohertext without knowing the key