MISS-1103 System and Network Security - File-03 - Digital Signature & Cryptographic Hash Function - KMA
MISS-1103 System and Network Security - File-03 - Digital Signature & Cryptographic Hash Function - KMA
MISS-1103:
System and Network Security
for
MISS Program- Batch 2022
Lecture File: 03
Digital Signature and Cryptographic Hash Function
Prepared by:
K M Akkas Ali
[email protected], [email protected]
Professor
Institute of Information Technology (IIT)
Jahangirnagar University, Dhaka-1342
File-03: Digital Signature & Hash Function
Topic to be Discussed
To be familiar with the general idea behind digital
Slide-2
What is Digital Signature?
Digital signature is a digital code that can be attached
to an electronically transmitted message that uniquely
identifies the sender and provides the integrity of the
message.
3. Sender encrypts the message digest with his/her private key for
authentication. This encrypted message digest is called digital
signature.
4. Sender attaches the digital signature to the end of the message that is
to be sent. The message attached with digital signature is known as
digitally signed message.
5. The sender encrypts the digitally signed message with the recipient’s
public key and sends it to the recipient.
6. After receiving, the recipient decrypts the entire message with his/her
private key.
7. The recipient detaches the message and digital signature.
8. He/she creates a “digest” of the received message using the same
Receiver Site
Slide-4 The processes are illustrated in the figure on the next slide..
Digital Signature Process
Slide-6
Digital Signature Vs. Conventional Signature
Key-point Conventional Digital Signature
Signature
Relationship For a conventional For a digital signature, there is a
signature, there is one-to-one relationship between a
normally a one-to- signature and a message.
Slide-7
Services Provided by Digital Signature
Slide-8
Services Provided by Digital Signature
Message Authentication:
A digital signature’s main function is to verify that a message or document,
in fact, comes from the claimed sender. That is, to provide authentication
is the main function of digital signature.
Non-repudiation:
Attaching a digital signature with message prevents repudiation. This
ensures that the sender should not be able to later deny that he/she sent a
message. Non-repudiation prevents sender and vendor in a transaction or
communication activity from later falsely denying that the transaction
occurred.
N.B. As contrast to encryption scheme, digital signature does not provides the
confidentiality of the message.
Slide-9
Digital Signature Vs. Cryptosystem
A digital signature needs a asymmetric-key
cryptosystem. The signer signs the message with her
private key; the verifier verifies it with the signer’s
public key.
Slide-10
What is Hashing?
Hashing is the transformation of a string of characters into a
usually shorter fixed-length value or key that represents the
original string.
Hashing is a cryptographic technique that produces hash values
Slide-12
What is Hashing (cont…)
Hashing also refers to a search technique or a method of accessing data records,
where search time is independent of the number of the elements in the
collection.
Hashing is used to index and retrieve items in a database because it is faster to
find the item using the shorter hashed key than to find it using the original value.
Slide-14
Hash Function
A hash function is a formula or an algorithm that-
takes large data sets of variable length as input, and
returns smaller data sets of fixed length as output.
Slide-15
Cryptographic Hash Function
In cryptographic hash function, even a small changes in the input
would cause a large change in the output.
Figure below shows how the slight changes input (here in the word
"over") drastically change the resulting output.
Slide-17
Use of Hash Function
Cryptographic hash functions have many information security
applications, such as in-
digital signatures
message authentication codes (MACs)
Slide-18
Hash Functions Used in Cryptography
The two commonly used hash functions are MD5 and SHA-1.
MD5:
MD stands for Message Digest.
Slide-21
Application of Hash Function in Cryptography
Slide-21
Application of Hash Function in Cryptography
Verifying password for secure login:
A related application of hash function is password verification.
Storing all user passwords as plaintext character can result in a massive
security breach if the password file is compromised.
One way to reduce this danger is to only store the hash digest of each
Slide-22
Application of Hash Function in Cryptography
File or data identifier:
A message digest can also serve as a means of reliably identifying
a file;
One of the main applications of a hash function is to allow the fast
Authentication:
Authentication is the assurance that the communicating entity is
the one that it claims to be.
Cryptographic hash function can be used for provide
authentication.
Slide-23
Application of Hash Function in Cryptography
Digital Signature:
Digital signature, first proposed in 1976 by Whitfield Diffie of
Stanford University, is a digital code (encrypted message digest)
that can be attached to an electronically transmitted message that
Slide-24
Properties of Cryptographic Hash Function
A desirable cryptographic hash function should have the following
properties:
A hash function produces a fixed length value from a variable length source.
It is easy to compute the hash value for any given message.
Secure- Non-reversible function/ One-way function:
Slide-25
Properties of Cryptographic Hash Function
Collision resistance: It should be difficult to find two different messages m 1
and m2 with the same hash h. Such a pair is called a cryptographic hash
collision.
This property is sometimes referred to as strong collision
resistance. It requires a hash value at least twice as long as that
Division-remainder method:
Using this method, choose a number m that is larger than
the number n of keys in K (K is a set of keys). Generally,
the number m is chosen to be a prime number. The hash
function H is defined as:
H(k)= k (mod m) or, H(k)= k (mod m)+1
Here k (mod m) denotes the remainder when k is divided by
m.
The second formula is used when we want the hash
Slide-27
addresses to range from 1 to m rather than from 0 to m-1.
Simple Hash Function
Example: Division-remainder method:
Suppose a company with 68 employees assigned a 4-digit employee number
to each employee which is used as the primary key. Apply the division
method of hash function to each of the following employee number:
Slide-28
Simple Hash Function
Mid-square method:
Using this method, the key k is squared. Then the hash
function H is defined by:
Observe that the 4th and 5th digits counting from right are chosen for
Slide-29 the hash address.
Simple Hash Function
Folding method:
Using this method, the key k is portioned into a number of parts, k 1, k2,
k3, …..kr, where each part, except possibly the last, has the same number
of digits as the required address. Then the parts are added together,
ignoring the last carry if any. That is:
Solution:
Chop the key into two parts and then add them.
K 3205 7148 2345
H(k)=K1+k2 32+05=37 71+48=119 23+45=77
H(k) 37 19 77
Observed that the leading digit from the 2nd function is ignored.
Alternatively, reverse folding method may be used as:
Slide-28
Message Authentication Code (MAC) Vs. Hash Code
If we assume that only the receiver and the sender know the identity
of the secret key, and if the received code matches the calculated
code, then
Slide-29
Message Authentication Code (MAC) Vs. Hash Code
An alternative to the message authentication code is the one-way
hash function.
A hash function accepts a variable-size message M as input and
produces a fixed-size message digest H(M) as output. The purpose of
a hash function is to produce a “fingerprint” of a file, message, or
other block of data.
Typically, the message is padded out to an integer multiple of some
fixed length (e.g., 1024 bits) and the padding includes the value of the
length of the original message in bits.
Unlike the MAC, a hash function does not take a secret key as
input. To authenticate a message, the message digest is sent with the
message in such a way that the message digest is authentic.
Slide-30
Message Authentication Code (MAC) Vs. Hash Code
Figure below illustrates three ways in
which the message can be
authenticated using a hash code.
The message digest can be encrypted
using symmetric key encryption (part a); if
it is assumed that only the sender and
receiver share the encryption key, then
authenticity is assured.
The message digest can also be encrypted
using public-key encryption (part b);
Part c illustrate a technique, known as a
keyed hash MAC where authentication is
done without using encryption. It assumes
that two communicating parties, say A and
B, share a common secret key K which is
incorporated into the process of generating
a hash code.
When A has a message to send to B, it calculates the hash function over the
concatenation of the secret key and the message: MDM = H(KMK). It then sends
[ MMDM] to B. Because B possesses K, it can recompute H(KMK) and verify MDM.
Because the secret key itself is not sent, it should not be possible for an attacker
to modify an intercepted message. As long as the secret key remains secret, it
should not be possible for an attacker to generate a false message.
Slide-31
Discussion Points
Slide-36
Slide-37
Thank you…
Have a question?