Computer Security:
Principles and
Practice
Fourth Edition, Global 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
Attacking Symmetric
Encryption
Cryptanalytic Attacks Brute-Force Attacks
● Rely on:
● Try all possible keys on some
● Nature of the algorithm ciphertext until an intelligible
● Some knowledge of the translation into plaintext is
general characteristics of the obtained
plaintext ● On average half of all
possible keys must be tried to
● Some sample plaintext- achieve success
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
Table 2.1
Comparison of Three Popular
Symmetric Encryption Algorithms
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
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 NIST called for Selected
replacement for proposals for a Rijndael in
3DES new AES in 1997 November 2001
Should have a
security strength
equal to or better
than 3DES
Significantly
3DES was not improved efficiency
Published as
reasonable for
long term use FIPS 197
Symmetric block
cipher
128 bit data and
128/192/256 bit keys
Practical Security
Issues
● 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
Block & Stream Ciphers
Block Cipher
• Processes the input one block of elements at a time
• Produces an output block for each input block
• Can reuse keys
• More common
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
Message
Authentication
Protects against
active attacks
•Contents have not been
Verifies received altered
message is •From authentic source
•Timely and in correct
authentic sequence
Can use
•Only sender and receiver
conventional share a key
encryption
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
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
SHA most widely used Additional secure hash
approaches to attacking
hash algorithm function applications:
a secure hash function:
Cryptanalysis Passwords
•Exploit logical •Hash of a password is
weaknesses in the stored by an operating
algorithm system
Brute-force attack Intrusion detection
•Strength of hash •Store H(F) for each file
function depends solely on a system and secure
on the length of the hash the hash values
code produced by the
algorithm
Asymmetric
• Uses two separate keys
form of protocol key
• Public is and private key
needed Publicly proposed by Diffi
• Public key is madeBased
public on
for mathematical
others functions
for distribution Hellman in 1976
to use
Public-Key Encryption Structure
● 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
Table 2.3
Applications for Public-Key
Cryptosystems
Requirements for Public-Key
Cryptosystems
Computationally
easy to create key
pairs
Computationally
Useful if either key easy for sender
can be used for knowing public key
each role to encrypt
messages
Computationally Computationally
infeasible for easy for receiver
opponent to knowing private key
otherwise recover to decrypt
original message ciphertext
Computationally
infeasible for
opponent to
determine private
key from public key
Asymmetric Encryption
Algorithms
RSA (Rivest, Shamir, Developed in 1977
Most widely accepted and Block cipher in which the plaintext and
implemented approach to public-key
ciphertext are integers between 0 and
Adleman) encryption n-1 for some n.
Enables two users to securely reach
Diffie-Hellman key agreement about a shared secret that
can be used as a secret key for Limited to the exchange of the keys
exchange algorithm subsequent symmetric
messages
encryption of
Digital Signature Standard
Provides only a digital signatureCannot be used for encryption or key
(DSS) function with SHA-1 exchange
Elliptic curve Security like RSA, but with much
cryptography (ECC) 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)
Random ● Keys for public-key
Numbers algorithms
● Stream key for
symmetric stream
Uses include cipher
generation of: ● Symmetric key for use
as a temporary session
key or in creating a
digital envelope
● Handshaking to prevent
replay attacks
Random Number
Requirements
Randomness Unpredictability
● Criteria:
● Uniform distribution ● Each number is
● Frequency of occurrence statistically independent
of each of the numbers
should be approximately of other numbers in the
the same sequence
● Independence
● No one value in the ● Opponent should not be
sequence can be inferred
from the others
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 Approaches to encrypt stored
Data are archived for
data:
indefinite periods
Use a commercially Background
Library based tape
available encryption Back-end appliance laptop/PC data
encryption
package encryption
Even though erased, until
disk sectors are reused
data are recoverable
Summary
• Confidentiality with
symmetric encryption • Public-key encryption
▪ Symmetric encryption
▪ Structure
▪ Symmetric block encryption ▪ Applications for public-key
algorithms cryptosystems
▪ Stream ciphers ▪ Requirements for public-key
cryptography
• Message authentication ▪ Asymmetric encryption
and hash functions algorithms
▪ Authentication using • Digital signatures and
symmetric encryption
▪ Message authentication without key management
message encryption ▪ Digital signature
▪ Secure hash functions ▪ Public-key certificates
▪ Other applications of hash ▪ Symmetric key exchange using
functions public-key encryption
▪ Digital envelopes
• Random and • Practical Application:
pseudorandom Encryption of Stored
numbers Data
▪ The use of random numbers
▪ Random versus pseudorandom