Uploaded by shujahammad9507

Diffie-Hellman Key Exchange

advertisement
Diffie-Hellman Key Exchange
Information Security
Presented to
Presented By
 MS Fatima




Date
 15th Nov 2023
Hammad Hassan
Sahil Mehmood
M Ibrahim
Shahroz Ali
Department of Computer Science and Engineering
University of Engineering and Technology Lahore
Narowal Campus
2021-CS-509
2021-CS-517
2021-CS-506
2021-CS-514
Agenda | Diffie-Hellman Key Exchange
Exploration of the Elgamal PKCS,
another significant scheme.
Examination of public-key
algorithms for pseudorandom
number generation.
Overview of elliptic curve
cryptography, an increasingly
important PKCS.
Introduction to DiffieHellman key exchange, one of
the earliest PKCS.
The Diffie-Hellman key exchange is a method in cryptography used for securely exchanging cryptographic keys over a
public channel. It allows two parties to agree on a shared secret key, even if an eavesdropper can observe all the
communication between them. The value of Diffie-Hellman lies in its ability to establish a shared secret key without
directly transmitting it over the communication channel.
This key exchange is a fundamental part of asymmetric cryptography. While it's not an encryption method, it's used to
securely generate a shared secret key that can be used in subsequent symmetric encryption. This shared secret key is
then utilized for secure and efficient symmetric encryption of the actual data being transmitted.
In terms of its category in cryptography and information security, Diffie-Hellman falls under the umbrella of public key
cryptography, specifically in the realm of key exchange protocols. It's a crucial element in ensuring secure
communications over potentially insecure channels.
Why Diffie-Hellman Key Exchange ?

The first public-key algorithm, introduced by
Diffie and Hellman in their seminal paper
[DIFF76b].
Introduction to
Diffie-Hellman
Key Exchange

Commonly known as the Diffie-Hellman key
exchange technique.

Widely used in commercial products for secure
key exchange.

Objective: Facilitate secure key exchange
between two users for subsequent symmetric
encryption.

Limitation: Primarily focused on exchanging
secret values.
Foundation of Diffie
Hellman Security

Discrete Logarithm's Role

Diffie-Hellman algorithm's security relies on
the challenge of computing discrete logarithms.

Definition: Discrete logarithm finds the unique
exponent (i) when (b equiv a^i mod p) for (0 leq i
leq (p - 1)).
Revisiting
Primitive Roots
Understanding Primitive Roots:
 Primitive roots of prime number (p) generate
all integers from 1 to (p - 1) modulo (p).
 Notably, if (a) is a primitive root of prime
(p), the series (a mod p), (a^2 mod p), up to
(a^{p-1} mod p) encompass all integers from 1
to (p - 1) in a distinct permutation.
Discrete Logarithm & Prime Roots:


- Discrete Logarithm Formula

- Explanation of the discrete logarithm
(dlog_a,p(b)) where (b equiv a^i pmod p).

- Significance: Key in Diffie-Hellman
algorithm for secure key exchange.

- Points towards Chapter 8 for an
extensive dive into discrete logarithms.
Diffie-Hellman Key
Exchange: Algorithm
Overview
Figure 01: Overview of the DiffieHellman key exchange

Two known values: prime number
(q) and primitive root (a) of (q).

Objective: Users A and B aim to
create a shared key for secure
communication
Alice
Bob
Alice and Bob share a prime
number q and an integer α,
such that α > q and α is a
primitive root of q
Alice and Bob share a prime
number q and an integer α,
such that α > q and α is a
primitive root of q
Alice generates a private
key 𝑋𝐴 , such that 𝑋𝐴 < q
Alice generates a private
key 𝑋𝐵 , such that 𝑋𝐵 < q
Alice calculates a public
key 𝑌𝐴 = 𝛼 𝑥𝐴 mod q
Alice calculates a public
key 𝑌𝐵 = 𝛼 𝑥𝐵 𝑚𝑜𝑑 𝑞
Alice receives Bob’s public
key 𝑌𝐵 in plain text
Alice receives Bob’s public
key 𝑌𝐴 in plain text
Alice calculates shared
secret key
K=(𝑌𝐵 )^𝑋𝐴 𝑚𝑜𝑑 𝑞
Alice calculates shared
secret key
K=(𝑌𝐴 )^𝑋𝐵 𝑚𝑜𝑑 𝑞
Figure # 01
Key
Exchange
Steps
User Actions
User A: Selects (XA leq
q), computes (YA =
a^{XA} mod q).
User B: Independently
chooses (XB leq q),
computes (YB = a^{XB}
mod q).
(X) values are private,
(Y) values are shared
publicly.
"Mathematical
Calculations"
Key Derivation
Process
User A's Key: (K =
(YB)^{XA} mod q)
User B's Key: (K =
(YA)^{XB} mod q)
Step-by-Step Calculation
Process
•
Mathematical steps
demonstrating the
derivation of the keys.
•
Starting from (K = (YB)^{XA}
mod q)
•
(YA)^{XB}
and (K =
•
Identical Results
•
Showcasing that both
calculations result in the same
key.
•
Explanation of the key
exchange, emphasizing the
generation of a shared secret
value.
mod q)
•
"Results and Secret Exchange"
Note on the typical usage of
this shared value as a
symmetric secret key for
secure communication.
Stepwise
Calculations
: Key
Derivation
Adversary's Perspective
Adversary's View
Challenge: Adversary aims to determine the secret key (K) without access to (X A) or (XB).
Available ingredients for the adversary: (q), (a), (YA), and (YB).
Forced action: Adversary must resort to computing discrete logarithms.
"Discrete Logarithm Calculation"
Adversary's Task
Equation for determining private key of user B: (X_B = dlog_a,q(YB)).
Adversary's key calculation: (K = (YA)^{XB} mod q).
Security in Diffie-Hellman
Security Measures

Diffie-Hellman's Strength: Ease of calculating exponentials vs. difficulty in
computing discrete logarithms.

Difficulty Level: Calculating discrete logarithms is considerably arduous,
especially for large primes.
Illustrative Example

Using prime number (q = 353) and primitive root (a = 3).

User A's private key (XA = 97) and User B's private key (XB = 233).

Computation of public keys and common secret key by A and B.

"Adversarial Scenario Details"

Adversarial Information

Details available to an attacker: (q = 353), (a = 3), (YA = 40), and (YB = 248).

Assumptions on the attacker's accessible data for the scenario
Brute-Force Attack
Simple example: Attacker's attempt to determine the secret key (160)

Challenge: Attacker, denoted as E, aims to discover a solution for equations involving powers of 3
modulo 353.

"Brute-Force Calculation"

Brute-Force Method

Brute-force approach: Calculate powers of 3 modulo 353.

Objective: Reach the result of either 40 or 248.

Exponent value: Finding the exponent value that yields (3^a mod 353 = 40) or (3^b mod 353 = 248).

Solution found with the exponent value of 97: (3^{97} mod 353 = 40).
Complexity and Practicality
Scaling Challenge

Complexity with larger numbers: Demonstrating the impracticality of brute-force
attacks.

As numbers grow, the problem's size escalates, rendering such attacks infeasible for
secure key exchanges.

This section illustrates the possibility of breaking the key exchange in a simple
example using brute force, emphasizing its impracticality as numbers increase in size..
Key Exchange Protocols: Using Diffie-Hellman

Figure 1 Reference: Illustration of a basic protocol utilizing the Diffie-Hellman calculation.

Scenario: User A intends to establish a connection with User B for encrypted communication.

Key Exchange Process: A generates (XA) and (YA), then sends it to B; B reciprocates with (XB) and (YB).

"Calculation and Key Generation"

Key Generation Process

User Actions:

A generates (XA), computes (YA), and sends to B.

B generates (XB), computes (YB), and shares it with A.

Both calculate the key using shared public values (q) and (a).
Alternative Use: Group Communication
Group Communication Scenario:

Use Case: Group of users creating long-lasting private and public values.

Storage in a central directory with shared (q) and (a) values.

Access and key generation by any user for encrypted messaging.

"Confidentiality and Authentication"
Security Aspects:

Confidentiality: Only involved users can determine the key, ensuring message confidentiality.

Authentication: Recipient user knows the sender based on the shared key.

Limitation: Vulnerability to replay attacks, not providing protection against this threat.
Bob
Darth
Alice
Man-in-the-Middle Attack: Overview
Understanding the Vulnerability:
Private key 𝑋𝐴
Public Key
𝑌𝐴 = 𝛼 𝑥𝐴 𝑚𝑜𝑑 𝑞
𝑌𝐴
Protocol Vulnerability: Figure 10.1's depicted
protocol is susceptible to a man-in-the-middle
attack.
Private key 𝑋𝐷1 , 𝑋𝐷2
Public Keys
𝑌𝐷1 = 𝛼 𝑥𝐷1 𝑚𝑜𝑑 𝑞
𝑌𝐷2 = 𝛼 𝑥𝐷2 𝑚𝑜𝑑 𝑞
"Players Involved: Alice, Bob, and the adversary,
Darth.
Attack Scenario“
Attack Sequence:
1. Darth prepares by generating private keys
and respective public keys.
𝑌𝐷1
𝑌𝐷2
Secret Key
𝐾2 = (𝑌𝐷2 )^𝑋𝐴 𝑚𝑜𝑑 𝑞
Private key 𝑋𝐵
Public Keys
𝑌𝐷1 = 𝛼 𝑥𝐵 𝑚𝑜𝑑 𝑞
Secret Key
𝐾2 = (𝑌𝐴 )^𝑋𝐷2 𝑚𝑜𝑑 𝑞
2. Alice sends (YA) to Bob.
𝑌𝐵
3. Darth intercepts (YA) and sends (YD1) to Bob;
also computes (K2 = (YA)^{XD2} mod q).
Secret Key
𝐾1 = (𝑌𝐵 )^𝑋𝐷1 𝑚𝑜𝑑 𝑞
4. Bob receives (YD1) and computes (K1 =
(YD1)^{XB} mod q).
5. Bob sends (YB) to Alice.
6. Darth intercepts (YB) and sends (YD2) to
Alice; also calculates (K1 = (YB)^{XD1} mod q).
Alice and Darth
share K2
Secret Key
𝐾1 = (𝑌𝐷1 )^𝑋𝐷1 𝑚𝑜𝑑 𝑞
Alice and Darth
share K1
7. Alice receives (YD2) and computes (K2 =
(YD2)^{XA} mod q).
Man-in-the-Middle Steps
Manipulation and Key Exchange

Darth's intervention manipulates the key exchange between Alice and Bob.

Calculation of keys based on intercepted values leads to compromised keys (K1) and (K2).

This sequence demonstrates how a man-in-the-middle attack disrupts the key exchange protocol
between Alice and Bob, compromising the keys in the process.
"Compromised Key Sharing"
Result of Attack:

Secret Key Distribution:

Bob and Alice believe they share a secret key, but they inadvertently share with Darth.

Bob shares secret key (K1) with Darth; Alice shares secret key (K2) with Darth.
Impact on Messages
Manipulation of Communication:

Alice encrypts a message, (M), believing it's
secure with (K2).

Darth intercepts and decrypts the message.

Darth sends (E(K1, M)) or (E(K1, M')) to Bob.

Compromised
Communication
Intent: Eavesdropping or message modification by
Darth.

"Protocol Vulnerability“
Root Cause of Vulnerability
Authentication Lapse:


Protocol's flaw: Lack of participant authentication.
Resulting vulnerability exploited by the man-inthe-middle attack.
Enhancing Protocol Security
Security Enhancement Approaches
Authentication Methods:
Future mitigation methods: Digital signatures and public-key certificates.
Still, it is being used
???????
The current applications of the Diffie-Hellman key exchange method are :

Secure Web Browsing: Used in SSL/TLS protocols for secure browsing (HTTPS).

Secure Email Communications: Employed in various email encryption protocols.

Secure Remote Logins: Utilized in SSH for secure remote login sessions.

Virtual Private Networks (VPNs): Enables secure connections for remote access.

Forward Secrecy Implementation: Maintains security even if keys are compromised in the future.

Group Communication Security: Establishes shared keys for secure multi-party communication.

Cryptographic Protocols: Forms the basis for various secure communication and encryption protocols.

Combined with Digital Signatures: Used in some scenarios for key exchange and authentication.

These applications showcase the versatility of the Diffie-Hellman key exchange method in ensuring secure
communication and data transfer across various technological domains.
Thank You
Any Questions ?
Download