Lecture 5-Hash Function
Lecture 5-Hash Function
Functions
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson
Education, Inc., publishing as Prentice Hall, 2017. 1
Hash Functions
● Condenses arbitrary messages to
fixed sizes.
h = H(M)
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
2
Source: William Stallings,
Cryptography and Network
Security: Principles and Practice,
7th Edition, published by Pearson
Education, Inc., publishing as 3
Prentice Hall, 2017.
Source: William Stallings,
Cryptography and Network
Security: Principles and
Practice, 7th Edition, published
by Pearson Education, Inc.,
publishing as Prentice Hall,
2017. 4
A cryptographic hash function*:
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
5
Hash Functions and Message Authentication
Hash functions can be used to provide message authentication in
several ways:
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
8
Message Authentication Code (MAC)
● More commonly, message authentication is achieved using a
message authentication code (MAC), also known as a keyed
hash function.
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
9
● A MAC function takes as input a secret key and a data block and
produces a hash value, referred to as the MAC, which is associated
with the protected message.
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
10
● If the integrity of the message needs to be checked, the MAC
function can be applied to the message and the result compared
with the associated MAC value. An attacker who alters the
message will be unable to alter the associated MAC value
without knowledge of the secret key.
● Note, that the verifying party also knows who the sending party is
because no one else knows the secret key.
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
11
Hash Functions and Digital Signatures
● The operation of the digital signature is similar to that of the MAC.
● Anyone who knows the user’s public key can verify the integrity of
the message that is associated with the digital signature.
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
12
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice 13
Hall, 2017.
Other Hash Function Uses
● To create a one-way password file
○ store hash of a password not the actual password
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
17
Revised Secure Hash Algorithm
● Revised version SHA-2 includes SHA-256, SHA-384, and SHA-512
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
18
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
19
Source: William Stallings, Cryptography
and Network Security: Principles and
Practice, 7th Edition, published by
Pearson Education, Inc., publishing as
Prentice Hall, 2017. 20
SHA-3 Requirements
● A replacement for SHA-2 (use same hash sizes): SHA-3 in 2015
(Keccak)
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
21
Digital Signatures
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson
Education, Inc., publishing as Prentice Hall, 2017. 22
Digital
Signature
Process
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
24
Digital Signature Requirements
● The signature must be a bit pattern that depends on the message
being signed.*
● The signature must use some information only known to the sender
to prevent both forgery and denial.*
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
25
● It must be relatively easy to recognize and verify the digital signature.
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
26
● The validity of the scheme just described depends on the security
of the sender’s private key.
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
27
Solution → use digital certificate and certificate authorities*
● Apart from other administrative controls, require:
○ every signed message to include a timestamp (date and time)
and
○ prompt reporting of compromised keys to a central authority.
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
28
Digital Signature Algorithm (DSA)
● Create a 320-bit signature with 512 - 2,048 bit keys.
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
29
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
30
DSA approach:The hash code is provided as input to a signature function
along with a random number k generated for this particular signature.
● The signature function also depends on the sender’s private key (PRa)
and a set of parameters known to a group of communicating principals.
We can consider this set to constitute a global public key (PUG).
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
31
● At the receiving end, the hash code of the incoming message is
generated. The hash code and the signature are inputs to a
verification function.
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
32
● The output of the verification function is a value that is equal to the
signature component r if the signature is valid.
● The signature function is such that only the sender, with knowledge
of the private key, could have produced the valid signature.
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
33
Public Key Infrastructure
(PKI)
34
● Public Key Infrastructure (PKI)* → integrated
system of software, encryption methodologies,
protocols, legal agreements, and third-party
services enabling users to communicate
securely.
Source: Whitman, M. E., & Mattord, H. J. (2018). Principles of information security (7th ed.). Cengage Learning.
36
● Typical PKI solution protects the transmission and
reception of secure information by integrating:
○ A certificate authority (CA)* → which
issues, manages, authenticates, signs,
and revokes users’ digital certificates.
These certificates typically contain the user
name, public key, and other identifying
information.
Source: Whitman, M. E., & Mattord, H. J. (2018). Principles of information security (7th ed.). Cengage Learning.
37
○ A registration authority (RA)
○ Certificate directories
○ Management protocols
○ Policies and procedures
Source: Whitman, M. E., & Mattord, H. J. (2018). Principles of information security (7th ed.). Cengage Learning.
38
Digital Signatures* → created in response to rising
need to verify information transferred using
electronic systems.
● Based on asymmetric encryption
● Provides non-repudiation - the process that
verifies the message was sent by the sender and
thus cannot be refuted.*
● Digital Signature Standard (DSS)
Source: Whitman, M. E., & Mattord, H. J. (2018). Principles of information security (7th ed.). Cengage Learning.
39
Digital Certificates* → electronic document
containing key value and identifying information
about entity that controls key.
Source: Whitman, M. E., & Mattord, H. J. (2018). Principles of information security (7th ed.). Cengage Learning.
40
41
Different client-
server
applications use
different types of
digital certificates
to accomplish their
assigned
functions /
purpose.
Source: Whitman, M. E., & Mattord, H. J. (2018). Principles of information security (7th ed.). Cengage Learning.
42
Source: Whitman, M. E., & Mattord, H. J. (2018). Principles of information security (7th ed.). Cengage Learning.
43
● These certificates bind a distinguished name
(DN), which uniquely identifies a certificate entity,
to a user’s public key.
Source: Whitman, M. E., & Mattord, H. J. (2018). Principles of information security (7th ed.). Cengage Learning.
45
● However, it is often used
in conjunction with
symmetric key
encryption—in other
words, as part of a
hybrid encryption
system.
Source: Whitman, M. E., & Mattord, H. J. (2018). Principles of information security (7th ed.). Cengage Learning.
47
● Session keys → limited-use symmetric keys for
temporary communications during an online
session.
49