SlideShare a Scribd company logo
Cryptography and Network Security
Unit - 3
Message Authentication Codes
Topics
Message Authentication Codes:
Authentication Requirements
Authentication Functions
Message Authentication Code
Hash Functions
Birthday Attacks
Security of Hash Functions
Secure Hash Algorithms(SHA)
Digital Signatures:
Digital Signatures
Elgamal Digital Techniques
Digital Signature Standard(DSS)
Proof of Digital Signature Algorithm
Message Authentication Code
A Message Authentication Code (MAC) is a cryptographic technique used to
ensure the integrity and authenticity of a message.
It is a short piece of information used to authenticate a message.
Purpose: Verify message hasn't been tampered with, confirm sender's
identity.
Algorithm: Uses symmetric key cryptography.
Calculation: Computed based on message and secret key.
Symmetric Key: Both sender and receiver share the same key.
Common Algorithms: HMAC, CBC-MAC.
Applications: Used in network security, digital signatures, and data integrity
checks.
MAC:
Message Authentication Code
If the same MAC is found: then
the message is authentic and
integrity checked
Else: something is not right.
MAC
MAC
Algorithm
Key (K)
RECEIVER
MESSAGE
=?
MAC
Algorithm
Key (K)
MESSAGE
MESSAGE
MAC
MAC MAC
SENDER
Message Authentication Code
MAC= C(K,M)
where,
M - Variable Length Message
K - Secret Key Shared only by sender and receiver
C(K,M) - Fixed Length Authenticator
Attack Addressed by Message Authentication
Masquerade Attacks: Authentication systems make sure that only the right
people can send messages. They stop fakers from pretending to be someone
they're not.
1.
Data Modification/Tampering: Attackers may attempt to alter the content of a
message during transmission. Message authentication ensures that any
unauthorized changes to the message are detected.
2.
Timing Change Attacks: Authentication systems make sure that the timing of
messages is not messed with, preventing anyone from playing with when
messages are sent or received.
3.
Replay Attacks: In a replay attack, an attacker intercepts and retransmits a valid
message. Message authentication helps prevent acceptance of duplicate or
previously transmitted messages by ensuring freshness or including
timestamps.
4.
Working of MAC
Let us assume that the sender A wants to send a Message M to a
receiver B, as shown in fig.
Message Authentication Code(MAC)
A and B share a symmetric (secret)key K, which is not known to anyone else.
Sender ‘A’ calculates the MAC H1 by applying key K to the message M.
A then sends the original message M and the MAC H1 to B.
When B receives the message, B also uses K to calculate its own MAC H2 over M.
B now compares H1 with H2. If the two match, B concludes that the message M
has not been changed during transmit. However, if H1 do not match H2, B
rejects the message, realizing that the message was changed during transmit.
HMAC (Hash-based Message Authentication Code)
Introduction: HMAC (Hash-based Message Authentication Code) is a
mandatory security implementation in Internet Protocol (IP) security and
widely used in the Secure Socket Layer (SSL) protocol.
Fundamental Idea: Reuses existing message digest algorithms like MD5 or
SHA-1.
Black Box Treatment: HMAC treats the message digest algorithm as a black
box.
Encryption Process: Uses a shared symmetric key to encrypt the message
digest, resulting in the output MAC.
Conclusion:
HMAC enhances Internet protocol security using shared symmetric keys and
established message digest algorithms. This ensures communication integrity
and authenticity.
Cipher-based Message Authentication Codes (CMAC)
Definition: CMAC uses a block cipher and secret key for
authentication.
1.
Purpose: Verifies message integrity and authenticity.
2.
Processing: Divides message into N blocks (m bits), CMAC size is n bits.
3.
Padding: Last block padded if not m bits.
4.
Encryption Process: First block encrypted with key, XORed with next
block, and re-encrypted for a new m-bit block.
5.
Conclusion:
CMAC ensures secure message authentication through block cipher
encryption and XOR operations with a secret key.
Requirements of MAC
Resistance to Computation: If an opponent observes M and C (K, M) and it must
be computationally impossible for the opponent to make a message M' such
that C (K, M') = C (K, M).
Consistent Distribution: C (K, M) should be consistently distributed in the sense
that for randomly selected message, M and M', the probability that C (K, M) = C
(K, M') is 2n, where n is the number of bits in the MAC.
Transformation Resistance: Let M' be same to some known transformation on M
that is M'=f (M). For instance, f can include inverting one or more definite bits. In
that case, Pr[C(K, M) = C(K, M')] = 2 .
-n
Logical Structure of MD5 Algorithm
Compression function transforms two fixed-length inputs to an output
of the same size.
1.
Starts with a fixed Initialization Vector (IV).
2.
For each message block, combines the current result with the block,
producing an intermediate result.
3.
Last block is zero-padded, and bits representing the message length
are appended.
4.
Result undergoes a finalization function.
5.
Finalization compresses a larger internal state into a smaller output
hash size.
6.
Components of MD5 Algorithm
MD5 Algorithm Components:
Buffer: Utilizes a 32-bit buffer comprising words A, B, C, and D.
1.
Table: Relies on a 64-element table denoted as K.
2.
Auxiliary Functions: Employs four auxiliary functions applying logical
operators AND, OR, NOT, and XOR to input bits.
3.
Blocks Processing: Four buffers (A, B, C, D) mix with input words using
auxiliary functions (F, G, H, I) in four rounds, each consisting of 16 basic
operations.
4.
Algorithmic Steps of MD5 Algorithm
Step 1: Padding: Add padding bits to the original message to achieve a
length equal to 64 bits but less than a multiple of 512.
Fig. Padding Process
Step 2: Append length: Calculate the original message length and append it to
the end of the message.
Fig. Append Length
Step 3: Divide the input into 512-bit blocks : Divide the input message into
blocks, each of 512 bits.
Fig. Data is divided into 512 bits block
Step 4: Initialize chaining variables: Initialize four 32-bit variables (chaining
variables) named A, B, C, and D.
Step 5: Process blocks :
a. Copy chaining variables (A, B, C, D) into corresponding variables (a, b,
c, d).
b. Divide the current 512-bit block into 16 sub-blocks.
c. Execute four rounds, processing all 16 sub-blocks in each round using
variables a, b, c, d, and constants designated as t.
Basic Use of Message Authentication Code(MAC)
Message Authentication: Provides authentication but not confidentiality.
The message is transmitted in the clear, and confidentiality can be
achieved through additional encryption.
1.
2. Message Authentication and Confidentiality (Authentication Tied to Plaintext):
Uses two separate keys shared by sender and receiver. MAC is calculated with
the message, concatenated, and the entire block is encrypted.
3.Message Authentication and Confidentiality (Authentication Tied to Ciphertext):
Encrypts the message, then calculates MAC using the resulting ciphertext. The
MAC is concatenated to the ciphertext for transmission.
Properties of Modular Arithmetic Operation
Objectives of HMAC
Hash Function Compatibility: Use existing hash functions without
modification.
1.
Replaceability: Allow easy substitution of hash functions for improved
security or performance.
2.
Performance Preservation: Maintain the original hash function performance
without significant degradation.
3.
Simplified Key Handling: Handle keys in a straightforward and simple manner.
4.
HMAC Algorithm
HMAC Algorithm Steps:
Append zeros to the left end of the secret key K to create K+ (a b-bit string).
1.
XOR K+ with ipad to produce the b-bit block S.
2.
Append the message M to S.
3.
Apply the embedded hash function H to the stream generated in step 3.
4.
XOR K+ with opad to produce another b-bit block S'.
5.
Append the hash result from step 4 to S'.
6.
Apply H to the stream generated in step 6 and output the final result.
7.
Notation:
K = Secret key
K+ = K padded with zeros on the left to achieve a b-bit length.
ipad = 00110110 repeated b/8 times
opad = 01011100 repeated b/8 times
M = Message input
H = Embedded hash function
Security of HMAC
Dependencies: Security relies on hash function strength, secret key size,
and message digest length.
1.
Probability of Attacks: Success in attacking HMAC equals success in hash
function attacks (e.g., calculating output without IV or finding collisions).
2.
Random Value Substitution: Intruder may substitute a random n-bit
value for the IV.
3.
Collision Determination: Finding two messages producing the same hash
output is necessary for an attack.
4.
MD5 Vulnerabilities: Attacks on MD5 involve selecting messages to
create collisions.
5.
MD5 Acceptability: Despite vulnerabilities, MD5 is deemed acceptable in
HMAC for its speed, requiring observation of 2^64 blocks for a 128-bit
hash code.
6.
Hash Function
Cryptographic hash function transforms input into a fixed-size hash value.
1.
Hash value (h) is generated by H(M) from a variable-length message (M).
h= H(M)
2.
Hash value is appended to the message at the source when the message is
assumed or known to be correct.
3.
Receiver authenticates by recomputing the hash value.
4.
Ideal hash function properties:
5.
a. Easy to calculate hash for any data.
b. Extremely difficult to calculate a text with a given hash.
c. Extremely unlikely for two different messages, even close ones, to
have the same hash.
Working of Secure Hash Algorithm(SHA)
Padding: Add padding to the message, making its length 64 bits short of a
multiple of 512.
1.
Append Length: Calculate the message length without padding and append it
as a 64-bit block.
2.
Divide into 512-bit Blocks: Divide the message into 512-bit blocks.
3.
Initialize Chaining Variables: Initialize five chaining variables (A through E)
for a 160-bit message digest.
4.
Process Blocks: Execute the main algorithm in the process block, handling
each 512-bit block.
5.
Round Function
Round Function Operation: Computes a new value for variable A and shifts
all working variables once per round.
1.
Computation for Variable A: Involves a five-operand addition modulo 2 ,
where operands depend on all input words, the round-dependent constant
K , and the current message word W .
2. 32
t t
Block Diagram of SHA 512
Core Composition: Comprises the SHA1 Engine and the padding
unit.
1.
SHA1 Engine: Applies SHA1 loops on a single 512-bit message block.
2.
Padding Unit: Splits input messages into 512-bit blocks and handles
padding on the last block.
3.
Processing Efficiency: One 512-bit block processed in 82 clock
cycles, achieving a bit-rate of 6.24 Mbps/MHz on the SHA1 core
input.
4.
Characteristic of Secure Hash Function
Applicability to Any Block Size: The hash function should work on blocks
of data of any size.
1.
Fixed-Length Output: The output produced by the hash function should
always have a fixed length.
2.
Ease of Hash Code Generation: Generating the hash code for a given
message or block of data should be relatively easy.
3.
Hash Code Secrecy: It should be nearly impossible to determine the
original message or block of data from a given hash code.
4.
Collision Resistance: It should be computationally infeasible to find
another message generating the same hash code.
5.
Unlikely Hash Code Similarity: No two messages, even if almost identical,
should likely have the same hash code.
6.
Hash Code Message Authentication
Code
Feature
Function Type
Inputs
Usage
Takes variable-length
message, returns fixed code
Takes variable-length
message, returns fixed code
Many inputs (e.g., M1, M2,
M3...)
Indexing and retrieving
items in hashing
Cryptographic checksum using a
session key
Requires message and a secret key
Authentication and verification of
received data
Cryptographic checksum using a
session key
Length
Consistency
Purpose Data integrity and indexing
Primarily for authentication and
data integrity
Hash Code Message Authentication
Code
Feature
Key Usage
Example
Application
Typically no secret key
involved
Hash functions like MD5,
SHA-256
Requires a secret key for
generation and verification
HMAC (Hash-based Message
Authentication Code)
Weak Collision
Resistance
Strong Collision
Resistance
Feature
Property
Definition
Applicability
For a given value h, infeasible
to find y = x with H(y) = H(x).
Bound to a particular input.
Infeasible to find any pair (x, y)
such that H(x) = H(y).
Can be applied to any two
arbitrary inputs.
Brute Force
Attack
Complexity
Takes 2^n attempts to break
weak collision resistance.
Takes 2^(2n) attempts to break
strong collision resistance.
Birthday Attack against Hash Function
A birthday attack against a hash function takes advantage of the birthday
paradox, which states that the probability of two people sharing the same
birthday is surprisingly high in a relatively small group. In the context of hash
functions:
64-bit Hash Code: The hash function produces a 64-bit hash code.
1.
Cryptographic Hash Collision: The attacker aims to find two different
messages (M and M') that produce the same hash code, i.e., H(M) = H(M').
2.
Message Signing: The legitimate sender (A) signs a message by appending the
hash code encrypted with their private key.
3.
Message Variations: The attacker generates 2 variations of a message and
their corresponding fraudulent variations.
4. m/2
5. Collision Search: The attacker compares the hash codes of legitimate and
fraudulent messages to find a collision. Due to the birthday paradox, the
probability of finding a collision is greater than 0.5 with relatively few attempts.
6. Signature Substitution: Once a collision is found, the attacker substitutes the
fraudulent message with the valid one and requests a signature from A. As both
messages produce the same hash code, the signature can be used
interchangeably.
Mathematical Basis of the Attack
Given a hash function H with n possible outputs, the probability of finding
at least one input y such that H(y) equals a specific value H(x) after
applying H to k random inputs is 0.5.
1.
For a single value of y, the probability of H(y) matching H(x) is 1/n.
2.
Conversely, the probability that H(y) does not match H(x) is [1 - (1/n)].
3.
If we generate k random values of y, the probability that none of them
matches H(x) is [1 - (1/n)]^k.
4.
Therefore, the probability of having at least one match among k values is 1
- [1 - (1/n)]^k.
5.
Using the binomial theorem: (1 - a)^k = 1 - ka + (k(k-1)/2!)a^2 - (k(k-1)(k-
2)/3!)a^3 ...
6.
For very small values of a, this can be approximated as (1 - ka). Thus, the
probability of at least one match is approximately 1 - [1-(1/n)^k ~ 1-[1-
(k/n)]= k/n. For a probability of 0.5, we have k = n/2.
7.
Properties of Cryptographic Hash Function
Properties of Cryptographic hash function that impact the security
of password storage are:
Non-reversibility (One-way function): Difficult to reconstruct the original
password from the hash output.
1.
Diffusion (Avalanche Effect): Changing one bit in the input should alter at
least half of the bits in the hash.
2.
Determinism: A consistent hash value is generated for a given password.
3.
Collision Resistance: It should be challenging to find two distinct
passwords producing the same hash.
4.
Non-predictability: The hash value should not be predictable from the
original password.
5.
Feature SHA-1 Algorithm MD5 Algorithm
Message Digest
Size
Speed of
Operation
Vulnerability to
Attacks
Security
Comparison
Endian Scheme
Byte Storage
Scheme
160 bits 128 bits
Little-endian Big-endian
Most significant byte in
address byte position
Least significant byte in low-
address low-byte position
Slower than MD5 Faster than SHA-1
Not vulnerable to
cryptanalytic attack
Vulnerable to
cryptanalytic attack
Considered more secure
than MD5
Considered less secure
than SHA-1
Digital Signature
Definition: Digital signature is a mathematical scheme for verifying the
authenticity of digital messages or documents.
1.
Algorithms Used:
2.
a. Key Generation: Selects a private key randomly from a set, generating
corresponding public key.
b. Signing Algorithm: Produces a signature using the message and private key.
c. Signature Verification Algorithm: Accepts or rejects the authenticity claim
of a message based on the provided signature and public key.
Digital Signature Algorithm(DSA)
Digital Signature Algorithm (DSA): DSA is an asymmetric encryption
algorithm that works on two different key i.e., one public and ono private to
produce digital signature.
Computer network system presentation pdf
Elgamal Digital Signature Techniques
Elgamal Encryption System
Encryption Algorithm (Elgamal Encryption):
Elgamal_encryption (e_{1}, e_{2}, p, P)
{
Select a random integer r in the group G=<{Z_{p}}^{*}, x>
C_{1} ← {e_{1}}^{r}
C_{2} ← (P × e_{0}^{prime})^{r} mod p
return C_{1} and C_{2}
}
Decryption Algorithm (Elgamal Decryption):
Elgamal_decryption (d, p, C_{1}, C_{2})
{
P ← [C_{2}(C_{1}^{d})^{-1} mod p]
return P
}
Signing
Signing algorithm is use to produce signature by using messages private key.
Verifying Verifying algorithm is use to either accept or reject the message
claim to authenticity.
Properties of Digital Signature
Author Verification:
1.
The signature must verify the author's identity.
Timestamp and Date Verification:
2.
It should include a timestamp for date and time verification.
Content Authentication:
3.
Authenticates the contents of the message at the time of the
signature.
Third-Party Verification:
4.
Requires a trusted third party for verification in case of disputes.
Requirements for a Digital Signature
Bit Pattern Form:
1.
The signature must be in the form of a bit pattern relative to the message.
Uniqueness to Sender:
2.
Should contain unique information to prevent forgery and denial.
Ease of Use:
3.
Creation, recognition, and verification must be relatively easy.
Computational Effort:
4.
High computational effort required to forge a digital signature.
Storage Mechanism:
5.
A copy of the digital signature must be retained in storage.
Variants of Digital Signature
Timestamped Signature:
1.
Purpose: Prevents replay attacks with timestamp inclusion.
Blind Signature:
2.
Purpose: Hides message content from the signer.
Context: Used when message authors and signers are different parties.
Implementation: Utilizes public-key schemes like RSA and DSS.
Undeniable Digital Signature:
3.
Characteristics: Non-self-authenticating scheme.
Components:
Signing Algorithm: Signs the message.
Verification Protocol: Limits users who can verify.
Disavowal Protocol: Prevents signer from proving a signature's
validity/invalidity without cooperation.
Proof of Digital Signature Algorithm:
Previous Year Question
2 Marks
10 Marks
What is Birthday attack? (2022-23)
1.
Explain role of compression function in hash function.(2022-23)
2.
What are the requirements of a good hash function? (2021-22)
3.
Find gcd (1970, 1066) (2021-22)
4.
Why Message Authentication is required? Discuss working of MAC with
suitable block diagram. (2022-23)
1.
Explain Hash Function? Discuss SHA- 512 with all required steps, round
function & block diagram. (2022-23)
2.
3. Explain the idea of Digital Signature for the authentication.
Discuss signing & verifying process of Digital Signature Algorithm (DSA) in
detail with suitable steps. (2022-23)
4. Illustrate the working of SHA-1 algorithm with diagram. (2021-22)
5. Discuss the Message Authentication Codes. Also give the use of
Authentication requirements in MAC. (2021-22)
6. Write the Digital Signature Algorithm (DSA) of Digital Signature
Standard. What is the implication if same K (secret per message) is used to
sign two different message using DSA? (2021-22)
THANK YOU
SO MUCH!
LIKE &
SUBSCRIBE

More Related Content

Similar to Computer network system presentation pdf (20)

PPT
Message Authentication
chauhankapil
 
PPTX
unit - III.pptx
sandyBS
 
PPTX
unit4- predicate logic in artificial intelligence
thirugnanasambandham4
 
PDF
Message Authentication and Hash Function.pdf
sunil sharma
 
PPT
Message authentication
CAS
 
DOCX
Cryptography and netwrk securityunit 4
mallikarjun batchanaboina
 
PPT
ch11.ppt
SomuPatil8
 
PPT
Message authentication and hash function
omarShiekh1
 
PPT
Cryptography and Message Authentication NS3
koolkampus
 
PPTX
MACs based on Hash Functions, MACs based on Block Ciphers
Maitree Patel
 
PPTX
MAC-Message Authentication Codes
DarshanPatil82
 
PPT
Network Security Lec5
Federal Urdu University
 
PPTX
Message Authentication Codes in Security.pptx
VivekanandaGN1
 
PPTX
cryptography and network security cns.pptx
gkumar610
 
PPTX
Meessage authentication and hash functions.pptx
JohnLagman3
 
PPT
UNIT3_class (1).ppt CRYPTOGRAPHY NOTES AND NETWORK
jeevasreemurali
 
PPTX
Message auth. code Based on Hash Functions.pptx
aribariaz507
 
PPTX
chapter three 3-part II-1lecture slide.pptx
meharikiros2
 
PPT
NSC_Unit-III_final.ppt
DrVASAVIBANDE
 
Message Authentication
chauhankapil
 
unit - III.pptx
sandyBS
 
unit4- predicate logic in artificial intelligence
thirugnanasambandham4
 
Message Authentication and Hash Function.pdf
sunil sharma
 
Message authentication
CAS
 
Cryptography and netwrk securityunit 4
mallikarjun batchanaboina
 
ch11.ppt
SomuPatil8
 
Message authentication and hash function
omarShiekh1
 
Cryptography and Message Authentication NS3
koolkampus
 
MACs based on Hash Functions, MACs based on Block Ciphers
Maitree Patel
 
MAC-Message Authentication Codes
DarshanPatil82
 
Network Security Lec5
Federal Urdu University
 
Message Authentication Codes in Security.pptx
VivekanandaGN1
 
cryptography and network security cns.pptx
gkumar610
 
Meessage authentication and hash functions.pptx
JohnLagman3
 
UNIT3_class (1).ppt CRYPTOGRAPHY NOTES AND NETWORK
jeevasreemurali
 
Message auth. code Based on Hash Functions.pptx
aribariaz507
 
chapter three 3-part II-1lecture slide.pptx
meharikiros2
 
NSC_Unit-III_final.ppt
DrVASAVIBANDE
 

Recently uploaded (20)

PPTX
ENGLISH LEARNING ACTIVITY SHE W5Q1.pptxY
CHERIEANNAPRILSULIT1
 
PPTX
Latest Features in Odoo 18 - Odoo slides
Celine George
 
PPTX
How to Consolidate Subscription Billing in Odoo 18 Sales
Celine George
 
PPTX
Views on Education of Indian Thinkers Mahatma Gandhi.pptx
ShrutiMahanta1
 
PPTX
Modern analytical techniques used to characterize organic compounds. Birbhum ...
AyanHossain
 
PDF
Federal dollars withheld by district, charter, grant recipient
Mebane Rash
 
PPTX
Accounting Skills Paper-I, Preparation of Vouchers
Dr. Sushil Bansode
 
PPTX
Gall bladder, Small intestine and Large intestine.pptx
rekhapositivity
 
PDF
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 
PPTX
THE HUMAN INTEGUMENTARY SYSTEM#MLT#BCRAPC.pptx
Subham Panja
 
PPTX
Maternal and Child Tracking system & RCH portal
Ms Usha Vadhel
 
PPTX
ANORECTAL MALFORMATIONS: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
PPTX
Nutrition Month 2025 TARP.pptx presentation
FairyLouHernandezMej
 
PDF
Living Systems Unveiled: Simplified Life Processes for Exam Success
omaiyairshad
 
PPTX
SCHOOL-BASED SEXUAL HARASSMENT PREVENTION AND RESPONSE WORKSHOP
komlalokoe
 
PDF
A guide to responding to Section C essay tasks for the VCE English Language E...
jpinnuck
 
PPTX
PYLORIC STENOSIS: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
PPTX
ABDOMINAL WALL DEFECTS:GASTROSCHISIS, OMPHALOCELE.pptx
PRADEEP ABOTHU
 
PPTX
Various Psychological tests: challenges and contemporary trends in psychologi...
santoshmohalik1
 
PPTX
national medicinal plants board mpharm.pptx
SHAHEEN SHABBIR
 
ENGLISH LEARNING ACTIVITY SHE W5Q1.pptxY
CHERIEANNAPRILSULIT1
 
Latest Features in Odoo 18 - Odoo slides
Celine George
 
How to Consolidate Subscription Billing in Odoo 18 Sales
Celine George
 
Views on Education of Indian Thinkers Mahatma Gandhi.pptx
ShrutiMahanta1
 
Modern analytical techniques used to characterize organic compounds. Birbhum ...
AyanHossain
 
Federal dollars withheld by district, charter, grant recipient
Mebane Rash
 
Accounting Skills Paper-I, Preparation of Vouchers
Dr. Sushil Bansode
 
Gall bladder, Small intestine and Large intestine.pptx
rekhapositivity
 
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 
THE HUMAN INTEGUMENTARY SYSTEM#MLT#BCRAPC.pptx
Subham Panja
 
Maternal and Child Tracking system & RCH portal
Ms Usha Vadhel
 
ANORECTAL MALFORMATIONS: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
Nutrition Month 2025 TARP.pptx presentation
FairyLouHernandezMej
 
Living Systems Unveiled: Simplified Life Processes for Exam Success
omaiyairshad
 
SCHOOL-BASED SEXUAL HARASSMENT PREVENTION AND RESPONSE WORKSHOP
komlalokoe
 
A guide to responding to Section C essay tasks for the VCE English Language E...
jpinnuck
 
PYLORIC STENOSIS: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
ABDOMINAL WALL DEFECTS:GASTROSCHISIS, OMPHALOCELE.pptx
PRADEEP ABOTHU
 
Various Psychological tests: challenges and contemporary trends in psychologi...
santoshmohalik1
 
national medicinal plants board mpharm.pptx
SHAHEEN SHABBIR
 
Ad

Computer network system presentation pdf

  • 1. Cryptography and Network Security Unit - 3 Message Authentication Codes
  • 2. Topics Message Authentication Codes: Authentication Requirements Authentication Functions Message Authentication Code Hash Functions Birthday Attacks Security of Hash Functions Secure Hash Algorithms(SHA) Digital Signatures: Digital Signatures Elgamal Digital Techniques Digital Signature Standard(DSS) Proof of Digital Signature Algorithm
  • 3. Message Authentication Code A Message Authentication Code (MAC) is a cryptographic technique used to ensure the integrity and authenticity of a message. It is a short piece of information used to authenticate a message. Purpose: Verify message hasn't been tampered with, confirm sender's identity. Algorithm: Uses symmetric key cryptography. Calculation: Computed based on message and secret key. Symmetric Key: Both sender and receiver share the same key. Common Algorithms: HMAC, CBC-MAC. Applications: Used in network security, digital signatures, and data integrity checks.
  • 4. MAC: Message Authentication Code If the same MAC is found: then the message is authentic and integrity checked Else: something is not right. MAC MAC Algorithm Key (K) RECEIVER MESSAGE =? MAC Algorithm Key (K) MESSAGE MESSAGE MAC MAC MAC SENDER Message Authentication Code
  • 5. MAC= C(K,M) where, M - Variable Length Message K - Secret Key Shared only by sender and receiver C(K,M) - Fixed Length Authenticator
  • 6. Attack Addressed by Message Authentication Masquerade Attacks: Authentication systems make sure that only the right people can send messages. They stop fakers from pretending to be someone they're not. 1. Data Modification/Tampering: Attackers may attempt to alter the content of a message during transmission. Message authentication ensures that any unauthorized changes to the message are detected. 2. Timing Change Attacks: Authentication systems make sure that the timing of messages is not messed with, preventing anyone from playing with when messages are sent or received. 3. Replay Attacks: In a replay attack, an attacker intercepts and retransmits a valid message. Message authentication helps prevent acceptance of duplicate or previously transmitted messages by ensuring freshness or including timestamps. 4.
  • 7. Working of MAC Let us assume that the sender A wants to send a Message M to a receiver B, as shown in fig. Message Authentication Code(MAC)
  • 8. A and B share a symmetric (secret)key K, which is not known to anyone else. Sender ‘A’ calculates the MAC H1 by applying key K to the message M. A then sends the original message M and the MAC H1 to B. When B receives the message, B also uses K to calculate its own MAC H2 over M. B now compares H1 with H2. If the two match, B concludes that the message M has not been changed during transmit. However, if H1 do not match H2, B rejects the message, realizing that the message was changed during transmit.
  • 9. HMAC (Hash-based Message Authentication Code) Introduction: HMAC (Hash-based Message Authentication Code) is a mandatory security implementation in Internet Protocol (IP) security and widely used in the Secure Socket Layer (SSL) protocol. Fundamental Idea: Reuses existing message digest algorithms like MD5 or SHA-1. Black Box Treatment: HMAC treats the message digest algorithm as a black box. Encryption Process: Uses a shared symmetric key to encrypt the message digest, resulting in the output MAC. Conclusion: HMAC enhances Internet protocol security using shared symmetric keys and established message digest algorithms. This ensures communication integrity and authenticity.
  • 10. Cipher-based Message Authentication Codes (CMAC) Definition: CMAC uses a block cipher and secret key for authentication. 1. Purpose: Verifies message integrity and authenticity. 2. Processing: Divides message into N blocks (m bits), CMAC size is n bits. 3. Padding: Last block padded if not m bits. 4. Encryption Process: First block encrypted with key, XORed with next block, and re-encrypted for a new m-bit block. 5. Conclusion: CMAC ensures secure message authentication through block cipher encryption and XOR operations with a secret key.
  • 11. Requirements of MAC Resistance to Computation: If an opponent observes M and C (K, M) and it must be computationally impossible for the opponent to make a message M' such that C (K, M') = C (K, M). Consistent Distribution: C (K, M) should be consistently distributed in the sense that for randomly selected message, M and M', the probability that C (K, M) = C (K, M') is 2n, where n is the number of bits in the MAC. Transformation Resistance: Let M' be same to some known transformation on M that is M'=f (M). For instance, f can include inverting one or more definite bits. In that case, Pr[C(K, M) = C(K, M')] = 2 . -n
  • 12. Logical Structure of MD5 Algorithm
  • 13. Compression function transforms two fixed-length inputs to an output of the same size. 1. Starts with a fixed Initialization Vector (IV). 2. For each message block, combines the current result with the block, producing an intermediate result. 3. Last block is zero-padded, and bits representing the message length are appended. 4. Result undergoes a finalization function. 5. Finalization compresses a larger internal state into a smaller output hash size. 6.
  • 14. Components of MD5 Algorithm MD5 Algorithm Components: Buffer: Utilizes a 32-bit buffer comprising words A, B, C, and D. 1. Table: Relies on a 64-element table denoted as K. 2. Auxiliary Functions: Employs four auxiliary functions applying logical operators AND, OR, NOT, and XOR to input bits. 3. Blocks Processing: Four buffers (A, B, C, D) mix with input words using auxiliary functions (F, G, H, I) in four rounds, each consisting of 16 basic operations. 4.
  • 15. Algorithmic Steps of MD5 Algorithm Step 1: Padding: Add padding bits to the original message to achieve a length equal to 64 bits but less than a multiple of 512. Fig. Padding Process
  • 16. Step 2: Append length: Calculate the original message length and append it to the end of the message. Fig. Append Length
  • 17. Step 3: Divide the input into 512-bit blocks : Divide the input message into blocks, each of 512 bits. Fig. Data is divided into 512 bits block
  • 18. Step 4: Initialize chaining variables: Initialize four 32-bit variables (chaining variables) named A, B, C, and D. Step 5: Process blocks : a. Copy chaining variables (A, B, C, D) into corresponding variables (a, b, c, d). b. Divide the current 512-bit block into 16 sub-blocks. c. Execute four rounds, processing all 16 sub-blocks in each round using variables a, b, c, d, and constants designated as t.
  • 19. Basic Use of Message Authentication Code(MAC) Message Authentication: Provides authentication but not confidentiality. The message is transmitted in the clear, and confidentiality can be achieved through additional encryption. 1.
  • 20. 2. Message Authentication and Confidentiality (Authentication Tied to Plaintext): Uses two separate keys shared by sender and receiver. MAC is calculated with the message, concatenated, and the entire block is encrypted.
  • 21. 3.Message Authentication and Confidentiality (Authentication Tied to Ciphertext): Encrypts the message, then calculates MAC using the resulting ciphertext. The MAC is concatenated to the ciphertext for transmission.
  • 22. Properties of Modular Arithmetic Operation
  • 23. Objectives of HMAC Hash Function Compatibility: Use existing hash functions without modification. 1. Replaceability: Allow easy substitution of hash functions for improved security or performance. 2. Performance Preservation: Maintain the original hash function performance without significant degradation. 3. Simplified Key Handling: Handle keys in a straightforward and simple manner. 4.
  • 24. HMAC Algorithm HMAC Algorithm Steps: Append zeros to the left end of the secret key K to create K+ (a b-bit string). 1. XOR K+ with ipad to produce the b-bit block S. 2. Append the message M to S. 3. Apply the embedded hash function H to the stream generated in step 3. 4. XOR K+ with opad to produce another b-bit block S'. 5. Append the hash result from step 4 to S'. 6. Apply H to the stream generated in step 6 and output the final result. 7.
  • 25. Notation: K = Secret key K+ = K padded with zeros on the left to achieve a b-bit length. ipad = 00110110 repeated b/8 times opad = 01011100 repeated b/8 times M = Message input H = Embedded hash function
  • 26. Security of HMAC Dependencies: Security relies on hash function strength, secret key size, and message digest length. 1. Probability of Attacks: Success in attacking HMAC equals success in hash function attacks (e.g., calculating output without IV or finding collisions). 2. Random Value Substitution: Intruder may substitute a random n-bit value for the IV. 3. Collision Determination: Finding two messages producing the same hash output is necessary for an attack. 4. MD5 Vulnerabilities: Attacks on MD5 involve selecting messages to create collisions. 5. MD5 Acceptability: Despite vulnerabilities, MD5 is deemed acceptable in HMAC for its speed, requiring observation of 2^64 blocks for a 128-bit hash code. 6.
  • 27. Hash Function Cryptographic hash function transforms input into a fixed-size hash value. 1. Hash value (h) is generated by H(M) from a variable-length message (M). h= H(M) 2. Hash value is appended to the message at the source when the message is assumed or known to be correct. 3. Receiver authenticates by recomputing the hash value. 4. Ideal hash function properties: 5. a. Easy to calculate hash for any data. b. Extremely difficult to calculate a text with a given hash. c. Extremely unlikely for two different messages, even close ones, to have the same hash.
  • 28. Working of Secure Hash Algorithm(SHA) Padding: Add padding to the message, making its length 64 bits short of a multiple of 512. 1. Append Length: Calculate the message length without padding and append it as a 64-bit block. 2. Divide into 512-bit Blocks: Divide the message into 512-bit blocks. 3. Initialize Chaining Variables: Initialize five chaining variables (A through E) for a 160-bit message digest. 4. Process Blocks: Execute the main algorithm in the process block, handling each 512-bit block. 5.
  • 29. Round Function Round Function Operation: Computes a new value for variable A and shifts all working variables once per round. 1. Computation for Variable A: Involves a five-operand addition modulo 2 , where operands depend on all input words, the round-dependent constant K , and the current message word W . 2. 32 t t
  • 30. Block Diagram of SHA 512
  • 31. Core Composition: Comprises the SHA1 Engine and the padding unit. 1. SHA1 Engine: Applies SHA1 loops on a single 512-bit message block. 2. Padding Unit: Splits input messages into 512-bit blocks and handles padding on the last block. 3. Processing Efficiency: One 512-bit block processed in 82 clock cycles, achieving a bit-rate of 6.24 Mbps/MHz on the SHA1 core input. 4.
  • 32. Characteristic of Secure Hash Function Applicability to Any Block Size: The hash function should work on blocks of data of any size. 1. Fixed-Length Output: The output produced by the hash function should always have a fixed length. 2. Ease of Hash Code Generation: Generating the hash code for a given message or block of data should be relatively easy. 3. Hash Code Secrecy: It should be nearly impossible to determine the original message or block of data from a given hash code. 4. Collision Resistance: It should be computationally infeasible to find another message generating the same hash code. 5. Unlikely Hash Code Similarity: No two messages, even if almost identical, should likely have the same hash code. 6.
  • 33. Hash Code Message Authentication Code Feature Function Type Inputs Usage Takes variable-length message, returns fixed code Takes variable-length message, returns fixed code Many inputs (e.g., M1, M2, M3...) Indexing and retrieving items in hashing Cryptographic checksum using a session key Requires message and a secret key Authentication and verification of received data Cryptographic checksum using a session key Length Consistency Purpose Data integrity and indexing Primarily for authentication and data integrity
  • 34. Hash Code Message Authentication Code Feature Key Usage Example Application Typically no secret key involved Hash functions like MD5, SHA-256 Requires a secret key for generation and verification HMAC (Hash-based Message Authentication Code)
  • 35. Weak Collision Resistance Strong Collision Resistance Feature Property Definition Applicability For a given value h, infeasible to find y = x with H(y) = H(x). Bound to a particular input. Infeasible to find any pair (x, y) such that H(x) = H(y). Can be applied to any two arbitrary inputs. Brute Force Attack Complexity Takes 2^n attempts to break weak collision resistance. Takes 2^(2n) attempts to break strong collision resistance.
  • 36. Birthday Attack against Hash Function A birthday attack against a hash function takes advantage of the birthday paradox, which states that the probability of two people sharing the same birthday is surprisingly high in a relatively small group. In the context of hash functions: 64-bit Hash Code: The hash function produces a 64-bit hash code. 1. Cryptographic Hash Collision: The attacker aims to find two different messages (M and M') that produce the same hash code, i.e., H(M) = H(M'). 2. Message Signing: The legitimate sender (A) signs a message by appending the hash code encrypted with their private key. 3. Message Variations: The attacker generates 2 variations of a message and their corresponding fraudulent variations. 4. m/2
  • 37. 5. Collision Search: The attacker compares the hash codes of legitimate and fraudulent messages to find a collision. Due to the birthday paradox, the probability of finding a collision is greater than 0.5 with relatively few attempts. 6. Signature Substitution: Once a collision is found, the attacker substitutes the fraudulent message with the valid one and requests a signature from A. As both messages produce the same hash code, the signature can be used interchangeably.
  • 38. Mathematical Basis of the Attack Given a hash function H with n possible outputs, the probability of finding at least one input y such that H(y) equals a specific value H(x) after applying H to k random inputs is 0.5. 1. For a single value of y, the probability of H(y) matching H(x) is 1/n. 2. Conversely, the probability that H(y) does not match H(x) is [1 - (1/n)]. 3. If we generate k random values of y, the probability that none of them matches H(x) is [1 - (1/n)]^k. 4. Therefore, the probability of having at least one match among k values is 1 - [1 - (1/n)]^k. 5. Using the binomial theorem: (1 - a)^k = 1 - ka + (k(k-1)/2!)a^2 - (k(k-1)(k- 2)/3!)a^3 ... 6. For very small values of a, this can be approximated as (1 - ka). Thus, the probability of at least one match is approximately 1 - [1-(1/n)^k ~ 1-[1- (k/n)]= k/n. For a probability of 0.5, we have k = n/2. 7.
  • 39. Properties of Cryptographic Hash Function Properties of Cryptographic hash function that impact the security of password storage are: Non-reversibility (One-way function): Difficult to reconstruct the original password from the hash output. 1. Diffusion (Avalanche Effect): Changing one bit in the input should alter at least half of the bits in the hash. 2. Determinism: A consistent hash value is generated for a given password. 3. Collision Resistance: It should be challenging to find two distinct passwords producing the same hash. 4. Non-predictability: The hash value should not be predictable from the original password. 5.
  • 40. Feature SHA-1 Algorithm MD5 Algorithm Message Digest Size Speed of Operation Vulnerability to Attacks Security Comparison Endian Scheme Byte Storage Scheme 160 bits 128 bits Little-endian Big-endian Most significant byte in address byte position Least significant byte in low- address low-byte position Slower than MD5 Faster than SHA-1 Not vulnerable to cryptanalytic attack Vulnerable to cryptanalytic attack Considered more secure than MD5 Considered less secure than SHA-1
  • 41. Digital Signature Definition: Digital signature is a mathematical scheme for verifying the authenticity of digital messages or documents. 1. Algorithms Used: 2. a. Key Generation: Selects a private key randomly from a set, generating corresponding public key. b. Signing Algorithm: Produces a signature using the message and private key. c. Signature Verification Algorithm: Accepts or rejects the authenticity claim of a message based on the provided signature and public key.
  • 42. Digital Signature Algorithm(DSA) Digital Signature Algorithm (DSA): DSA is an asymmetric encryption algorithm that works on two different key i.e., one public and ono private to produce digital signature.
  • 46. Encryption Algorithm (Elgamal Encryption): Elgamal_encryption (e_{1}, e_{2}, p, P) { Select a random integer r in the group G=<{Z_{p}}^{*}, x> C_{1} ← {e_{1}}^{r} C_{2} ← (P × e_{0}^{prime})^{r} mod p return C_{1} and C_{2} } Decryption Algorithm (Elgamal Decryption): Elgamal_decryption (d, p, C_{1}, C_{2}) { P ← [C_{2}(C_{1}^{d})^{-1} mod p] return P }
  • 47. Signing Signing algorithm is use to produce signature by using messages private key.
  • 48. Verifying Verifying algorithm is use to either accept or reject the message claim to authenticity.
  • 49. Properties of Digital Signature Author Verification: 1. The signature must verify the author's identity. Timestamp and Date Verification: 2. It should include a timestamp for date and time verification. Content Authentication: 3. Authenticates the contents of the message at the time of the signature. Third-Party Verification: 4. Requires a trusted third party for verification in case of disputes.
  • 50. Requirements for a Digital Signature Bit Pattern Form: 1. The signature must be in the form of a bit pattern relative to the message. Uniqueness to Sender: 2. Should contain unique information to prevent forgery and denial. Ease of Use: 3. Creation, recognition, and verification must be relatively easy. Computational Effort: 4. High computational effort required to forge a digital signature. Storage Mechanism: 5. A copy of the digital signature must be retained in storage.
  • 51. Variants of Digital Signature Timestamped Signature: 1. Purpose: Prevents replay attacks with timestamp inclusion. Blind Signature: 2. Purpose: Hides message content from the signer. Context: Used when message authors and signers are different parties. Implementation: Utilizes public-key schemes like RSA and DSS. Undeniable Digital Signature: 3. Characteristics: Non-self-authenticating scheme. Components: Signing Algorithm: Signs the message. Verification Protocol: Limits users who can verify. Disavowal Protocol: Prevents signer from proving a signature's validity/invalidity without cooperation.
  • 52. Proof of Digital Signature Algorithm:
  • 53. Previous Year Question 2 Marks 10 Marks What is Birthday attack? (2022-23) 1. Explain role of compression function in hash function.(2022-23) 2. What are the requirements of a good hash function? (2021-22) 3. Find gcd (1970, 1066) (2021-22) 4. Why Message Authentication is required? Discuss working of MAC with suitable block diagram. (2022-23) 1. Explain Hash Function? Discuss SHA- 512 with all required steps, round function & block diagram. (2022-23) 2.
  • 54. 3. Explain the idea of Digital Signature for the authentication. Discuss signing & verifying process of Digital Signature Algorithm (DSA) in detail with suitable steps. (2022-23) 4. Illustrate the working of SHA-1 algorithm with diagram. (2021-22) 5. Discuss the Message Authentication Codes. Also give the use of Authentication requirements in MAC. (2021-22) 6. Write the Digital Signature Algorithm (DSA) of Digital Signature Standard. What is the implication if same K (secret per message) is used to sign two different message using DSA? (2021-22)
  • 55. THANK YOU SO MUCH! LIKE & SUBSCRIBE