0% found this document useful (0 votes)
17 views

Lecture 5-Hash Function

Uploaded by

r.arshadr12
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Lecture 5-Hash Function

Uploaded by

r.arshadr12
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 49

Lecture -5 Cryptographic Hash

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)

● Usually assume hash function is public.

● Used to detect changes to message.

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*:

● Computationally infeasible to find data mapping to specific hash


(one-way property).

● Computationally infeasible to find two data to same hash


(collision-free property).

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:

#1: The message plus concatenated hash code is encrypted


using symmetric encryption. Because only A and B share the secret
key, the message must have come from A and has not been altered.
The hash code provides the structure or redundancy required to achieve
authentication. Because encryption is applied to the entire message
plus hash code, confidentiality is also provided.
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
6
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
7
#2: Only the hash code is encrypted, using symmetric
encryption. This reduces the processing burden for those applications
that do not require confidentiality.

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.

● Typically, MACs are used between two parties that share a


secret key to authenticate information exchanged between those
parties.

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.

● Note that the combination of hashing and encryption results


in an overall function that is, in fact, a MAC (Figure 11.3b)

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.

● In the case of the digital signature, the hash value of a message


is encrypted with a user’s private key.

● 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

● For intrusion detection and virus detection


○ Keep and check hash of files on system

● Construct a pseudorandom function (PRF) or a pseudorandom


number generator (PRNG).
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
14
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
15
Source: William Stallings, Cryptography and Network Security: Principles and Practice, 7th Edition, published by Pearson Education, Inc., publishing as Prentice
Hall, 2017.
16
Secure Hash Algorithm (SHA)
● Watch “SHA: Secure Hashing Algorithm - Computerphile”,
https://www.youtube.com/watch?v=DMtFhACPnTY

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

● Designed for compatibility with increased security provided by AES


cipher.

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)

● Must process small blocks (512/1024 bits)

● Security → close to theoretical maximum for hash size


● Efficient → time and memory
● Characteristics → flexibility and simplicity

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, 23
2017.
● In situations where there is not complete trust between sender and
receiver, something more than simple authentication is needed.
The most attractive solution to this problem is 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.
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.*

● It must be relatively easy to produce 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.
25
● It must be relatively easy to recognize and verify the digital signature.

● It must be computationally infeasible to forge a digital signature, either by


constructing a new message for an existing digital signature or by
constructing a fraudulent digital signature for a given message.

● It must be practical to retain a copy of the digital signature in storage.

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.

● If a sender later wishes to deny sending a particular message, the


sender can claim that the private key was lost or stolen and that
someone else forged his/her signature.

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.

● A digital signature scheme only. It cannot be used for encryption or


key exchange.

● Security depends on difficulty of computing discrete logarithms.

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).

● The result is a signature consisting of two components, labeled s and


r.

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.

● The verification function also depends on the global public key as


well as the sender’s public key (PUa), which is paired with 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.
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.

● PKI systems are based on public-key


cryptosystems.
Source: Whitman, M. E., & Mattord, H. J. (2018). Principles of information security (7th ed.). Cengage Learning.
35
PKI systems protect information assets in several
ways:
● Authentication →
● Privacy →
● Authorisation →
● Non-repudiation →

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.

● The certificate is signed and placed in the


directory by the CA for retrieval and verification by
the user.
Source: Whitman, M. E., & Mattord, H. J. (2018). Principles of information security (7th ed.). Cengage Learning.
44
● The X.509 v3 standard’s recommendation does
not specify an encryption algorithm, although RSA,
with its hashed digital signature, is typically used.

● Except in digital certificates, asymmetric key


encryption in its pure form is not widely used.*

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. 46
Hybrid Cryptography Systems* → A hybrid
cryptosystem that facilitates exchanging private
keys using public-key encryption.

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.

Recall: symmetric encryption is more efficient than


asymmetric encryption.
Source: Whitman, M. E., & Mattord, H. J. (2018). Principles of information security (7th ed.). Cengage Learning.
48
Source: Whitman, M. E., &
Mattord, H. J. (2018). Principles of
information security (7th ed.).
Cengage Learning.

49

You might also like