SlideShare a Scribd company logo
1 of 35
Computer Security:
Principles and Practice
Fourth Edition
By: William Stallings and Lawrie Brown
Chapter 2
Cryptographic Tools
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
Plaintext
input
Y = E[K, X] X = D[K, Y]
X
K K
Transmitted
ciphertext
Plaintext
output
Secret key shared by
sender and recipient
Secret key shared by
sender and recipient
Encryption algorithm
(e.g., DES)
Decryption algorithm
(reverse of encryption
algorithm)
Figure 2.1 Simplified Model of Symmetric Encryption
Attacking Symmetric
Encryption
Cryptanalytic Attacks Brute-Force Attacks
 Rely on:
 Nature of the algorithm
 Some knowledge of the general
characteristics of the plaintext
 Some sample plaintext-ciphertext
pairs
 Exploits the characteristics of the
algorithm to attempt to deduce a
specific plaintext or the key being
used
 If successful all future and past
messages encrypted with that
key are compromised
 Try all possible keys on some
ciphertext until an intelligible
translation into plaintext is
obtained
 On average half of all possible
keys must be tried to achieve
success
Table 2.1
Comparison of Three Popular Symmetric
Encryption Algorithms
DES Triple DES AES
Plaintext block size (bits) 64 64 128
Ciphertext block size (bits) 64 64 128
Key size (bits) 56 112 or 168 128, 192, or 256
DES = Data Encryption Standard
AES = Advanced Encryption Standard
Data Encryption Standard
(DES)
• Until recently was the most widely used
encryption scheme
• FIPS PUB 46
• Referred to as the Data Encryption
Algorithm (DEA)
• Uses 64 bit plaintext block and 56 bit key to
produce a 64 bit ciphertext block
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
Table 2.2
Average Time Required for Exhaustive Key Search
Key size
(bits) Cipher
Number of
Alternative
Keys
Time Required at 109
decryptions/s
Time Required
at 1013
decryptions/s
56 DES 256 ≈ 7.2 ´ 1016 255 ns = 1.125 years 1 hour
128
AES
2128 ≈ 3.4 ´ 1038 2127 ns = 5.3 ´ 1021
years
5.3 ´ 1017 years
168
Triple DES
2168 ≈ 3.7 ´ 1050 2167 ns = 5.8 ´ 1033
years
5.8 ´ 1029 years
192 AES 2192 ≈ 6.3 ´ 1057 2191 ns = 9.8 ´ 1040
years
9.8 ´ 1036 years
256 AES 2256 ≈ 1.2 ´ 1077 2255 ns = 1.8 ´ 1060
years
1.8 ´ 1056 years
Triple DES (3DES)
 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
Advanced Encryption
Standard (AES)
Needed a
replacement for
3DES
3DES was not
reasonable for
long term use
NIST called for
proposals for a
new AES in 1997
Should have a security
strength equal to or
better than 3DES
Significantly improved
efficiency
Symmetric block
cipher
128 bit data and
128/192/256 bit keys
Selected
Rijndael in
November 2001
Published as
FIPS 197
 Typically symmetric encryption is applied to a unit of data
larger than a single 64-bit or 128-bit block
 Electronic codebook (ECB) mode is the simplest
approach to multiple-block encryption
 Each block of plaintext is encrypted using the same key
 Cryptanalysts may be able to exploit regularities in the plaintext
 Modes of operation
 Alternative techniques developed to increase the security of
symmetric block encryption for large sequences
 Overcomes the weaknesses of ECB
Encrypt
Encryption
K
Figure 2.2 Types of Symmetric Encryption
b
b
b
b
P1
C1
P2
C2
b
b
Pn
Cn
Encrypt
K Encrypt
K
Decrypt
Decryption K
b
b
b
b
C1
P1
C2
P2
b
b
Cn
Pn
Decrypt
(a) Block cipher encryption (electronic codebook mode)
(b) Stream encryption
K Decrypt
K
Pseudorandom byte
generator
(key stream generator)
Plaintext
byte stream
M
Key
K
Key
K
k k
Plaintext
byte stream
M
Ciphertext
byte stream
C
ENCRYPTION
Pseudorandom byte
generator
(key stream generator)
DECRYPTION
k
Block & Stream Ciphers
• Processes the input one block of elements at a time
• Produces an output block for each input block
• Can reuse keys
• More common
Block 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
Stream Cipher
Message Authentication
Protects against
active attacks
Verifies received
message is
authentic
Can use
conventional
encryption
• Contents have not been
altered
• From authentic source
• Timely and in correct
sequence
• Only sender and receiver
share a key
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
Message
MAC
K
K
Transmit
MAC
algorithm
MAC
algorithm
Compare
Figure 2.3 Message Authentication Using a Message
Authentication Code (MAC).
Figure 2.4 Cryptographic Hash Function; h = H(M
Message
Message
Message
K
E
K
(a) Using symmetric encryption
Compare
D
H
H
H
H
H
Message
Message
Message
PRa
E
PUa
(b) Using public-key encryption
Compare
D
Message
Message
Message
(c) Using secret value
Compare
K
K
K
K
Source A Destination B
Figure 2.5 Message Authentication Using a One-Way Hash Function.
H
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
Produces a fixed-length output
H(x) is relatively easy to compute for any given x
One-way or pre-image resistant
•Computationally infeasible to find x such that H(x) = h
Computationally infeasible to find y ≠ x such that H(y) = H(x)
Collision resistant or strong collision resistance
•Computationally infeasible to find any pair (x,y) such that H(x) = H(y)
Security of Hash Functions
There are two
approaches to
attacking a secure hash
function:
Cryptanalysis
• Exploit logical
weaknesses in the
algorithm
Brute-force attack
• Strength of hash
function depends solely
on the length of the
hash code produced by
the algorithm
SHA most widely used
hash algorithm
Additional secure hash
function applications:
Passwords
• Hash of a password is
stored by an operating
system
Intrusion detection
• Store H(F) for each file
on a system and secure
the hash values
Publicly
proposed by
Diffie and
Hellman in
1976
Based on
mathematical
functions
Asymmetric
•Uses two
separate keys
•Public key
and private
key
•Public key is
made public
for others to
use
Some form of
protocol is
needed for
distribution
 Plaintext
 Readable message or data that is fed into the algorithm as input
 Encryption algorithm
 Performs transformations on the plaintext
 Public and private key
 Pair of keys, one for encryption, one for decryption
 Ciphertext
 Scrambled message produced as output
 Decryption key
 Produces the original plaintext
 User encrypts data using his or her own
private key
 Anyone who knows the corresponding
public key will be able to decrypt the
message
Mike Bob
(a) Encryption with public key
Plaintext
input
Transmitted
ciphertext
Plaintext
output
Encryption algorithm
(e.g., RSA)
Decryption algorithm
Bob's private
key
Bob
Bob's public
key
Alice's
public key
ring
Joy
Ted
(b) Encryption with private key
X
PUb
PRb
Y = E[PRb, X]
X =
D[PUb, Y]
Figure 2.6 Public-Key Cryptography
Alice
Bob Alice
Algorithm Digital Signature Symmetric Key
Distribution
Encryption of
Secret Keys
RSA Yes Yes Yes
Diffie-Hellman No Yes No
DSS Yes No No
Elliptic Curve Yes Yes Yes
Table 2.3
Applications for Public-Key Cryptosystems
Computationally easy
to create key pairs
Computationally
easy for sender
knowing public key
to encrypt messages
Computationally
easy for receiver
knowing private key
to decrypt ciphertext
Computationally
infeasible for
opponent to determine
private key from public
key
Computationally
infeasible for
opponent to
otherwise recover
original message
Useful if either key
can be used for each
role
RSA (Rivest,
Shamir,
Adleman)
Developed in 1977
Most widely accepted and
implemented approach to
public-key encryption
Block cipher in which the
plaintext and ciphertext are
integers between 0 and n-1
for some n.
Diffie-Hellman
key exchange
algorithm
Enables two users to
securely reach agreement
about a shared secret that
can be used as a secret key
for subsequent symmetric
encryption of messages
Limited to the exchange of
the keys
Digital
Signature
Standard (DSS)
Provides only a digital
signature function with
SHA-1
Cannot be used for
encryption or key exchange
Elliptic curve
cryptography
(ECC)
Security like RSA, but with
much smaller keys
Digital Signatures
 NIST FIPS PUB 186-4 defines a digital signature as:
”The result of a cryptographic transformation of data that,
when properly implemented, provides a mechanism for
verifying origin authentication, data integrity and signatory
non-repudiation.”
 Thus, a digital signature is a data-dependent bit pattern, generated
by an agent as a function of a file, message, or other form of data
block
 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)
Figure 2.7 Simplified Depiction of Essential
Elements of Digital Signature Process
Bob Alice
Cryptographic
hash
function
h
Cryptographic
hash
function
h
Bob’s
private
key
Digital
signature
generation
algorithm
Bob’s
signature
for M
(a) Bob signs a message (b) Alice verifies the signature
Bob’s
public
key
Digital
signature
verification
algorithm
Return
signature valid
or not valid
Message M S
Message M
S
Message M
Unsigned certificate:
contains user ID,
user's public key,
as well as information
concerning the CA
Signed certificate
Figure 2.8 Public-Key Certificate Use
Generate hash
code of unsigned
certificate
Generate hash code
of certificate not
including signature
Generate digital signature
using CA's private key
H
H
Bob's ID
information
CA
information
Bob's public key
SG SV
Verify digital signature
using CA's public key
Return signature
valid or not valid
Use certificate to
verify Bob's public key
Create signed
digital certificate
Random
symmetric
key
Receiver's
public
key
Encrypted
symmetric
key
Encrypted
message
Encrypted
message
Digital
envelope
Figure 2.9 Digital Envelopes
(a) Creation of a digital envelope
E
E
Message
Random
symmetric
key
Receiver's
private
key
Encrypted
symmetric
key
(b) Opening a digital envelope
D
D
Digital
envelope
Message
Random
Numbers
 Keys for public-key
algorithms
 Stream key for symmetric
stream cipher
 Symmetric key for use as a
temporary session key or in
creating a digital envelope
 Handshaking to prevent
replay attacks
 Session key
Uses include
generation of:
Random Number
Requirements
Randomness Unpredictability
 Criteria:
 Uniform distribution
 Frequency of occurrence of
each of the numbers should
be approximately the same
 Independence
 No one value in the sequence
can be inferred from the
others
 Each number is statistically
independent of other
numbers in the sequence
 Opponent should not be
able to predict future
elements of the sequence
on the basis of earlier
elements
Random versus
Pseudorandom
Cryptographic applications typically make use of
algorithmic techniques for random number generation
•Algorithms are deterministic and therefore produce sequences of numbers
that are not statistically random
Pseudorandom numbers are:
•Sequences produced that satisfy statistical randomness tests
•Likely to be predictable
True random number generator (TRNG):
•Uses a nondeterministic source to produce randomness
•Most operate by measuring unpredictable natural processes
•e.g. radiation, gas discharge, leaky capacitors
•Increasingly provided on modern processors
Practical Application:
Encryption of Stored Data
Common to encrypt transmitted data
Much less common for stored data
There is often little protection
beyond domain
authentication and operating
system access controls
Data are archived for indefinite
periods
Even though erased, until
disk sectors are reused data
are recoverable
Approaches to encrypt stored data:
Use a commercially
available encryption
package
Back-end appliance
Library based tape
encryption
Background laptop/PC
data encryption
Summary
• Public-key encryption
 Structure
 Applications for public-key
cryptosystems
 Requirements for public-key
cryptography
 Asymmetric encryption algorithms
• Digital signatures and key
management
 Digital signature
 Public-key certificates
 Symmetric key exchange using
public-key encryption
 Digital envelopes
• Practical Application:
Encryption of Stored Data
• Confidentiality with
symmetric encryption
 Symmetric encryption
 Symmetric block encryption
algorithms
 Stream ciphers
• Message authentication
and hash functions
 Authentication using symmetric
encryption
 Message authentication without
message encryption
 Secure hash functions
 Other applications of hash functions
• Random and
pseudorandom numbers
 The use of random numbers
 Random versus pseudorandom

More Related Content

Similar to Computer Security: Principles and Practice Fourth Edition Chapter 2 Cryptographic Tools Symmetric Encryption, Public-Key Cryptography, Hash Functions and Digital Signatures

Cryptography Key Management.pptx
Cryptography Key Management.pptxCryptography Key Management.pptx
Cryptography Key Management.pptxSurendraBasnet6
 
OS ppt Modified.pptx
OS ppt Modified.pptxOS ppt Modified.pptx
OS ppt Modified.pptxStudyvAbhi
 
Unit V network management and security
Unit V network management and securityUnit V network management and security
Unit V network management and securitysangusajjan
 
Securing Text Messages Application Using MED
Securing Text Messages Application Using MEDSecuring Text Messages Application Using MED
Securing Text Messages Application Using MEDZatulNadia
 
Cryptography and Message Authentication NS3
Cryptography and Message Authentication NS3Cryptography and Message Authentication NS3
Cryptography and Message Authentication NS3koolkampus
 
Unit-III_3R-CRYPTO_2021-22_VSM.pptx
Unit-III_3R-CRYPTO_2021-22_VSM.pptxUnit-III_3R-CRYPTO_2021-22_VSM.pptx
Unit-III_3R-CRYPTO_2021-22_VSM.pptxVishwanathMahalle
 
4. Block Ciphers
4. Block Ciphers 4. Block Ciphers
4. Block Ciphers Sam Bowne
 
Triple Data Encryption Standard (t-DES)
Triple Data Encryption Standard (t-DES) Triple Data Encryption Standard (t-DES)
Triple Data Encryption Standard (t-DES) Hardik Manocha
 
Information System Security.pptx
Information System  Security.pptxInformation System  Security.pptx
Information System Security.pptxGIT
 
IS Unit 3_Public Key Cryptography
IS Unit 3_Public Key CryptographyIS Unit 3_Public Key Cryptography
IS Unit 3_Public Key CryptographySarthak Patel
 
“Proposed Model for Network Security Issues Using Elliptical Curve Cryptography”
“Proposed Model for Network Security Issues Using Elliptical Curve Cryptography”“Proposed Model for Network Security Issues Using Elliptical Curve Cryptography”
“Proposed Model for Network Security Issues Using Elliptical Curve Cryptography”IOSR Journals
 
Computer security module 2
Computer security module 2Computer security module 2
Computer security module 2Deepak John
 
CH2 Stallings,_William_Computer_Security_Principles_and_Practice_Pearson [54-...
CH2 Stallings,_William_Computer_Security_Principles_and_Practice_Pearson [54-...CH2 Stallings,_William_Computer_Security_Principles_and_Practice_Pearson [54-...
CH2 Stallings,_William_Computer_Security_Principles_and_Practice_Pearson [54-...ams1ams11
 

Similar to Computer Security: Principles and Practice Fourth Edition Chapter 2 Cryptographic Tools Symmetric Encryption, Public-Key Cryptography, Hash Functions and Digital Signatures (20)

Cryptography Key Management.pptx
Cryptography Key Management.pptxCryptography Key Management.pptx
Cryptography Key Management.pptx
 
Day5
Day5Day5
Day5
 
Ch9
Ch9Ch9
Ch9
 
OS ppt Modified.pptx
OS ppt Modified.pptxOS ppt Modified.pptx
OS ppt Modified.pptx
 
Unit V network management and security
Unit V network management and securityUnit V network management and security
Unit V network management and security
 
Securing Text Messages Application Using MED
Securing Text Messages Application Using MEDSecuring Text Messages Application Using MED
Securing Text Messages Application Using MED
 
Introduction to cryptography
Introduction to cryptographyIntroduction to cryptography
Introduction to cryptography
 
Cryptography and Message Authentication NS3
Cryptography and Message Authentication NS3Cryptography and Message Authentication NS3
Cryptography and Message Authentication NS3
 
Unit-III_3R-CRYPTO_2021-22_VSM.pptx
Unit-III_3R-CRYPTO_2021-22_VSM.pptxUnit-III_3R-CRYPTO_2021-22_VSM.pptx
Unit-III_3R-CRYPTO_2021-22_VSM.pptx
 
Moein
MoeinMoein
Moein
 
4. Block Ciphers
4. Block Ciphers 4. Block Ciphers
4. Block Ciphers
 
Triple Data Encryption Standard (t-DES)
Triple Data Encryption Standard (t-DES) Triple Data Encryption Standard (t-DES)
Triple Data Encryption Standard (t-DES)
 
Cryptography-101
Cryptography-101Cryptography-101
Cryptography-101
 
Cryptography - 101
Cryptography - 101Cryptography - 101
Cryptography - 101
 
Information System Security.pptx
Information System  Security.pptxInformation System  Security.pptx
Information System Security.pptx
 
IS Unit 3_Public Key Cryptography
IS Unit 3_Public Key CryptographyIS Unit 3_Public Key Cryptography
IS Unit 3_Public Key Cryptography
 
“Proposed Model for Network Security Issues Using Elliptical Curve Cryptography”
“Proposed Model for Network Security Issues Using Elliptical Curve Cryptography”“Proposed Model for Network Security Issues Using Elliptical Curve Cryptography”
“Proposed Model for Network Security Issues Using Elliptical Curve Cryptography”
 
Computer security module 2
Computer security module 2Computer security module 2
Computer security module 2
 
CH2 Stallings,_William_Computer_Security_Principles_and_Practice_Pearson [54-...
CH2 Stallings,_William_Computer_Security_Principles_and_Practice_Pearson [54-...CH2 Stallings,_William_Computer_Security_Principles_and_Practice_Pearson [54-...
CH2 Stallings,_William_Computer_Security_Principles_and_Practice_Pearson [54-...
 
encrption.PDF
encrption.PDFencrption.PDF
encrption.PDF
 

Recently uploaded

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 

Recently uploaded (20)

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 

Computer Security: Principles and Practice Fourth Edition Chapter 2 Cryptographic Tools Symmetric Encryption, Public-Key Cryptography, Hash Functions and Digital Signatures

  • 1. Computer Security: Principles and Practice Fourth Edition By: William Stallings and Lawrie Brown
  • 3. 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
  • 4. Plaintext input Y = E[K, X] X = D[K, Y] X K K Transmitted ciphertext Plaintext output Secret key shared by sender and recipient Secret key shared by sender and recipient Encryption algorithm (e.g., DES) Decryption algorithm (reverse of encryption algorithm) Figure 2.1 Simplified Model of Symmetric Encryption
  • 5. Attacking Symmetric Encryption Cryptanalytic Attacks Brute-Force Attacks  Rely on:  Nature of the algorithm  Some knowledge of the general characteristics of the plaintext  Some sample plaintext-ciphertext pairs  Exploits the characteristics of the algorithm to attempt to deduce a specific plaintext or the key being used  If successful all future and past messages encrypted with that key are compromised  Try all possible keys on some ciphertext until an intelligible translation into plaintext is obtained  On average half of all possible keys must be tried to achieve success
  • 6. Table 2.1 Comparison of Three Popular Symmetric Encryption Algorithms DES Triple DES AES Plaintext block size (bits) 64 64 128 Ciphertext block size (bits) 64 64 128 Key size (bits) 56 112 or 168 128, 192, or 256 DES = Data Encryption Standard AES = Advanced Encryption Standard
  • 7. Data Encryption Standard (DES) • Until recently was the most widely used encryption scheme • FIPS PUB 46 • Referred to as the Data Encryption Algorithm (DEA) • Uses 64 bit plaintext block and 56 bit key to produce a 64 bit ciphertext block 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
  • 8. Table 2.2 Average Time Required for Exhaustive Key Search Key size (bits) Cipher Number of Alternative Keys Time Required at 109 decryptions/s Time Required at 1013 decryptions/s 56 DES 256 ≈ 7.2 ´ 1016 255 ns = 1.125 years 1 hour 128 AES 2128 ≈ 3.4 ´ 1038 2127 ns = 5.3 ´ 1021 years 5.3 ´ 1017 years 168 Triple DES 2168 ≈ 3.7 ´ 1050 2167 ns = 5.8 ´ 1033 years 5.8 ´ 1029 years 192 AES 2192 ≈ 6.3 ´ 1057 2191 ns = 9.8 ´ 1040 years 9.8 ´ 1036 years 256 AES 2256 ≈ 1.2 ´ 1077 2255 ns = 1.8 ´ 1060 years 1.8 ´ 1056 years
  • 9. Triple DES (3DES)  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
  • 10. Advanced Encryption Standard (AES) Needed a replacement for 3DES 3DES was not reasonable for long term use NIST called for proposals for a new AES in 1997 Should have a security strength equal to or better than 3DES Significantly improved efficiency Symmetric block cipher 128 bit data and 128/192/256 bit keys Selected Rijndael in November 2001 Published as FIPS 197
  • 11.  Typically symmetric encryption is applied to a unit of data larger than a single 64-bit or 128-bit block  Electronic codebook (ECB) mode is the simplest approach to multiple-block encryption  Each block of plaintext is encrypted using the same key  Cryptanalysts may be able to exploit regularities in the plaintext  Modes of operation  Alternative techniques developed to increase the security of symmetric block encryption for large sequences  Overcomes the weaknesses of ECB
  • 12. Encrypt Encryption K Figure 2.2 Types of Symmetric Encryption b b b b P1 C1 P2 C2 b b Pn Cn Encrypt K Encrypt K Decrypt Decryption K b b b b C1 P1 C2 P2 b b Cn Pn Decrypt (a) Block cipher encryption (electronic codebook mode) (b) Stream encryption K Decrypt K Pseudorandom byte generator (key stream generator) Plaintext byte stream M Key K Key K k k Plaintext byte stream M Ciphertext byte stream C ENCRYPTION Pseudorandom byte generator (key stream generator) DECRYPTION k
  • 13. Block & Stream Ciphers • Processes the input one block of elements at a time • Produces an output block for each input block • Can reuse keys • More common Block 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 Stream Cipher
  • 14. Message Authentication Protects against active attacks Verifies received message is authentic Can use conventional encryption • Contents have not been altered • From authentic source • Timely and in correct sequence • Only sender and receiver share a key
  • 15. 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
  • 16. Message MAC K K Transmit MAC algorithm MAC algorithm Compare Figure 2.3 Message Authentication Using a Message Authentication Code (MAC).
  • 17. Figure 2.4 Cryptographic Hash Function; h = H(M
  • 18. Message Message Message K E K (a) Using symmetric encryption Compare D H H H H H Message Message Message PRa E PUa (b) Using public-key encryption Compare D Message Message Message (c) Using secret value Compare K K K K Source A Destination B Figure 2.5 Message Authentication Using a One-Way Hash Function. H
  • 19. 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 Produces a fixed-length output H(x) is relatively easy to compute for any given x One-way or pre-image resistant •Computationally infeasible to find x such that H(x) = h Computationally infeasible to find y ≠ x such that H(y) = H(x) Collision resistant or strong collision resistance •Computationally infeasible to find any pair (x,y) such that H(x) = H(y)
  • 20. Security of Hash Functions There are two approaches to attacking a secure hash function: Cryptanalysis • Exploit logical weaknesses in the algorithm Brute-force attack • Strength of hash function depends solely on the length of the hash code produced by the algorithm SHA most widely used hash algorithm Additional secure hash function applications: Passwords • Hash of a password is stored by an operating system Intrusion detection • Store H(F) for each file on a system and secure the hash values
  • 21. Publicly proposed by Diffie and Hellman in 1976 Based on mathematical functions Asymmetric •Uses two separate keys •Public key and private key •Public key is made public for others to use Some form of protocol is needed for distribution
  • 22.  Plaintext  Readable message or data that is fed into the algorithm as input  Encryption algorithm  Performs transformations on the plaintext  Public and private key  Pair of keys, one for encryption, one for decryption  Ciphertext  Scrambled message produced as output  Decryption key  Produces the original plaintext
  • 23.  User encrypts data using his or her own private key  Anyone who knows the corresponding public key will be able to decrypt the message Mike Bob (a) Encryption with public key Plaintext input Transmitted ciphertext Plaintext output Encryption algorithm (e.g., RSA) Decryption algorithm Bob's private key Bob Bob's public key Alice's public key ring Joy Ted (b) Encryption with private key X PUb PRb Y = E[PRb, X] X = D[PUb, Y] Figure 2.6 Public-Key Cryptography Alice Bob Alice
  • 24. Algorithm Digital Signature Symmetric Key Distribution Encryption of Secret Keys RSA Yes Yes Yes Diffie-Hellman No Yes No DSS Yes No No Elliptic Curve Yes Yes Yes Table 2.3 Applications for Public-Key Cryptosystems
  • 25. Computationally easy to create key pairs Computationally easy for sender knowing public key to encrypt messages Computationally easy for receiver knowing private key to decrypt ciphertext Computationally infeasible for opponent to determine private key from public key Computationally infeasible for opponent to otherwise recover original message Useful if either key can be used for each role
  • 26. RSA (Rivest, Shamir, Adleman) Developed in 1977 Most widely accepted and implemented approach to public-key encryption Block cipher in which the plaintext and ciphertext are integers between 0 and n-1 for some n. Diffie-Hellman key exchange algorithm Enables two users to securely reach agreement about a shared secret that can be used as a secret key for subsequent symmetric encryption of messages Limited to the exchange of the keys Digital Signature Standard (DSS) Provides only a digital signature function with SHA-1 Cannot be used for encryption or key exchange Elliptic curve cryptography (ECC) Security like RSA, but with much smaller keys
  • 27. Digital Signatures  NIST FIPS PUB 186-4 defines a digital signature as: ”The result of a cryptographic transformation of data that, when properly implemented, provides a mechanism for verifying origin authentication, data integrity and signatory non-repudiation.”  Thus, a digital signature is a data-dependent bit pattern, generated by an agent as a function of a file, message, or other form of data block  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)
  • 28. Figure 2.7 Simplified Depiction of Essential Elements of Digital Signature Process Bob Alice Cryptographic hash function h Cryptographic hash function h Bob’s private key Digital signature generation algorithm Bob’s signature for M (a) Bob signs a message (b) Alice verifies the signature Bob’s public key Digital signature verification algorithm Return signature valid or not valid Message M S Message M S Message M
  • 29. Unsigned certificate: contains user ID, user's public key, as well as information concerning the CA Signed certificate Figure 2.8 Public-Key Certificate Use Generate hash code of unsigned certificate Generate hash code of certificate not including signature Generate digital signature using CA's private key H H Bob's ID information CA information Bob's public key SG SV Verify digital signature using CA's public key Return signature valid or not valid Use certificate to verify Bob's public key Create signed digital certificate
  • 30. Random symmetric key Receiver's public key Encrypted symmetric key Encrypted message Encrypted message Digital envelope Figure 2.9 Digital Envelopes (a) Creation of a digital envelope E E Message Random symmetric key Receiver's private key Encrypted symmetric key (b) Opening a digital envelope D D Digital envelope Message
  • 31. Random Numbers  Keys for public-key algorithms  Stream key for symmetric stream cipher  Symmetric key for use as a temporary session key or in creating a digital envelope  Handshaking to prevent replay attacks  Session key Uses include generation of:
  • 32. Random Number Requirements Randomness Unpredictability  Criteria:  Uniform distribution  Frequency of occurrence of each of the numbers should be approximately the same  Independence  No one value in the sequence can be inferred from the others  Each number is statistically independent of other numbers in the sequence  Opponent should not be able to predict future elements of the sequence on the basis of earlier elements
  • 33. Random versus Pseudorandom Cryptographic applications typically make use of algorithmic techniques for random number generation •Algorithms are deterministic and therefore produce sequences of numbers that are not statistically random Pseudorandom numbers are: •Sequences produced that satisfy statistical randomness tests •Likely to be predictable True random number generator (TRNG): •Uses a nondeterministic source to produce randomness •Most operate by measuring unpredictable natural processes •e.g. radiation, gas discharge, leaky capacitors •Increasingly provided on modern processors
  • 34. Practical Application: Encryption of Stored Data Common to encrypt transmitted data Much less common for stored data There is often little protection beyond domain authentication and operating system access controls Data are archived for indefinite periods Even though erased, until disk sectors are reused data are recoverable Approaches to encrypt stored data: Use a commercially available encryption package Back-end appliance Library based tape encryption Background laptop/PC data encryption
  • 35. Summary • Public-key encryption  Structure  Applications for public-key cryptosystems  Requirements for public-key cryptography  Asymmetric encryption algorithms • Digital signatures and key management  Digital signature  Public-key certificates  Symmetric key exchange using public-key encryption  Digital envelopes • Practical Application: Encryption of Stored Data • Confidentiality with symmetric encryption  Symmetric encryption  Symmetric block encryption algorithms  Stream ciphers • Message authentication and hash functions  Authentication using symmetric encryption  Message authentication without message encryption  Secure hash functions  Other applications of hash functions • Random and pseudorandom numbers  The use of random numbers  Random versus pseudorandom