1
Computer Security: Principles and Practice
Fourth Edition
Chapter 2
Cryptographic Tools
Copyright © 2018, 2015, 2012 Pearson Education, Inc. All Rights Reserved
2
Encryption for Confidentiality
Encryption Methods
Encryption: The universal technique for providing confidentiality for transmitted or stored data
Two main types of encryptions:
Symmetric (aka Private Key, or single-key Encryption)
Asymmetric (aka Public Key, or two-key Encryption)
3
4
Symmetric Encryption
Symmetric Encryption
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
5
Simplified Model of Symmetric Encryption
6
7
Attacking Symmetric Encryption
Cryptanalytic Attacks Brute-Force Attacks
• Rely on: • Try all possible keys on some
ciphertext until an intelligible
– Nature of the algorithm
translation into plaintext is obtained
– Some knowledge of the general
– On average half of all possible
characteristics of the plaintext
keys must be tried to achieve
– Some sample plaintext-ciphertext pairs success
• If successful, all future and past messages
encrypted with that key are compromised
Comparison of 3 Popular Symmetric EncryptionAlgorithms
Blank
DES Triple DES AES
Plaintext block size (bits) 64 (8B) 64 (8B) 128
Ciphertext block size (bits) 64 (8B) 64 (8B) 128
Key size (bits) 56 (7B) 112 (14B) or 168 (21B) 128, 192, or 256
DES = Data Encryption Standard
AES = Advanced Encryption Standard
8
Data Encryption Standard (DES)
In the past, it was the most widely used encryption scheme
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 (relatively short)
The speed of commercial off-the-shelf processors makes this key length woefully
inadequate
9
Average Time Required for Exhaustive Key Search
Key Size (bits) Cipher Number of Alternative Keys Time Required at Time Required at
109 decryptions / s
10 to the ninth power decryptions per microseconds 10 to the 13 power decryptions per microseconds
1013 decryptions / s
56 DES 256 7.2 1016
2 to the 56 power approximately equals 7.2 times 10 to the 16 power
255 s 1.125 years 2 to the 55 power microseconds = 1.125 years
1 hour
128 AES 2128 3.4 1038
2 to the 128 power approximately equals 3.4 times 10 to the 38 power
2127 s 5.3 1021 years
2 to the 127 power microseconds = 5.3 times 10 to the 21 power years
5.3 1017 years5.3 times 10 to the 17 power years
168 Triple DES 2168 3.7 1050
2 to the 168 power approximately equals 3.7 times 10 to the 50 power
2167 s 5.8 1033 years
2 to the 167 power microseconds = 5.8 times 10 to the 33 power years
5.8 1029 years5.8 times 10 to the 29 power years
192 AES 2192 6.3 1057
2 to the 192 power approximately equals 6.3 times 10 to the 57 power
2191 s 9.8 10 40 years
2 to the 191 power microseconds = 9.8 times 10 to the 40 power years
9.8 1036 years9.8 times 10 to the 36 power years
256 AES 2256 1.2 1077
2 to the 256 power approximately equals 1.2 times 10 to the 77 power
2255 s 1.8 1060 years
2 to the 255 power microseconds = 1.8 times 10 to the 60 power years 1.8 1056 years1.8 times 10 to the 56 power years
10
Triple DES (3DES)
Repeats basic DES algorithm 3 times using either two or three unique keys
DESk3(DESk2(DESk1(Plaintext))) or DESk1(DESk2(DESk1(Plaintext)))
Attractions:
168-bit key (3x56bit) length overcomes the vulnerability to brute-force attack of DES
Underlying encryption algorithm is still D ES
Drawbacks:
Algorithm is slow in software
Uses a 64-bit block size for plaintext
11
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
12
Block Cipher – Encryption of large data
13
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
14
ECB Problem
15
Alternative Mode : CBC
16
Block & Stream Ciphers
Block Cipher
Processes the input one block at a time
Produces an output block for each input block
Can reuse keys
More common
Stream Cipher
Processes the input elements continuously
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
unless you know the input key
17
18
Message Authentication
Message Authentication
Protects against active attacks to Integrity
Verifies received message is authentic
1. Contents have not been altered
2. From authentic source
3. Timely and in correct sequence
Can use conventional encryption
Only sender and receiver share a key
19
Message Authentication Without Confidentiality
Message encryption does not provide authentication
It is possible to combine authentication and confidentiality in a single algorithm by encrypting a
message plus its authentication tag
Typically authentication is provided as a separate function from encryption
Examples of situations authentication without confidentiality:
Broadcasting same message to many destinations
Authentication of a software in plaintext is an attractive service
20
21
Hash Functions
Secure Hash Function Properties
Can be applied to a block of data of any size
Produces a fixed-length output
Hash(plaintext) is relatively easy to compute for any given x
Must be One-way Function
If h = H(x), given h, computationally must be infeasible to find x
Collision resistant or strong collision resistance
Computationally infeasible to find any pair (x, y) such that
y x such that H( y ) H( x )
22
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 (SHA2 and SHA3 newer versions)
Application Examples of hash functions:
Passwords
Hash of a password is stored by an operating system
Intrusion detection
Store Hash(File) for each file on a system and secure the hash values
23
24
Integrity and Authentication
Authentication by Message Authentication Code (M AC)
25
Message Authentication Using a One-Way Hash Function
26
27
Public-Key Encryption
(aka Asymmetric)
Public-Key Encryption Structure
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 and not confidential
Private Key private and secret
Some form of protocol is needed for distribution of the key
28
Public-Key Cryptography (1 of 2)
Plaintext
Readable message or data that
is fed into the algorithm as
input
Encryption algorithm (e.g., RSA)
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
29
Public-Key Cryptography (2 of 2)
Sender encrypts data using his/her own private key
Receiver decrypts data using sender’s public key
30
Applications for Public-Key Cryptosystems
Symmetric Key Encryption of Secret
Algorithm Digital Signature Distribution Keys
RSA Yes Yes Yes
Diffie–Hellman No Yes No
DSS Yes No No
Elliptic Curve Yes Yes Yes
31
Requirements for Public-Key Cryptosystems
Useful if either key Computationally easy to create key
can be used for pairs
each role
Computationally easy
encrypt knowing
Computationally public key
infeasible to
recover original Computationally easy
message decrypt knowing
private key
Computationally infeasible to
find private key from public key
32
Asymmetric Encryption Algorithms
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
Digital Signature Standard (DSS)
Provides only a digital signature function with S HA-1
Cannot be used for encryption or key exchange
Elliptic curve cryptography (ECC)
Security like RSA, but with much smaller keys
33
34
Digital Signatures
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)
35
Digital Signature Process
36
37
Digital Certificates
Public-Key Certificate Use
38
Digital Envelopes
39
40
Random Number Generators
Random Numbers
Usage Examples:
Keys for public-key algorithms
Stream key for symmetric stream cipher
Symmetric key for use as a temporary session key
Creating a digital envelope
Handshaking to prevent replay attacks
41
Random Number Requirements
Randomness Criteria:
Unpredictability
Frequency of occurrence of the numbers statistically should be approximately the same
Independence
No one value in the sequence can be inferred from the others
42
Random Vs. Pseudorandom
Pseudorandom numbers are:
Generated by use of algorithmic techniques
Algorithms are deterministic so generated numbers are not statistically random
Likely to be predictable
True random number generator (TRNG):
Use of a non-deterministic source to produce randomness
Most operate by measuring unpredictable natural processes
e.g., radiation, gas discharge, leaky capacitors
Increasingly provided on modern processors
43
Practical Application: Encryption of Stored Data
Encryption common to transmitted data, 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 (BitLocker on Windows)
Central Back-end Storage appliance
Library based tape encryption
Background laptop/PC data encryption
44
Summary (1 of 2)
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
45
Summary (2 of 2)
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
46