Information: Security
Information: Security
Security :
Principles and
Practice
By:William
Stallings
Chapter 1 Introduction
1
Information Security
Lecture 3
Dr.Hani Al-medhegi
Chapter 4:
Public Key Cryptography
Chapter 1 Introduction
3
Public Key Cryptography
Two keys, one to encrypt, another to decrypt
Alice uses Bob’s public key to encrypt
Only Bob’s private key decrypts the message
Based on “trap door, one way function”
“One way” means easy to compute in one
direction, but hard to compute in other direction
Example: Given p and q, product N = pq easy to
compute, but hard to find p and q from N
“Trap door” is used when creating key pairs
Chapter 1 Introduction
4
Public Key Cryptography
Encryption
Suppose we encrypt M with Bob’s public key
Bob’s private key can decrypt C to recover M
Digital Signature
Bob signs by “encrypting” with his private key
Anyone can verify signature by “decrypting” with
Bob’s public key
But only Bob could have signed
Like a handwritten signature, but much better…
Chapter 1 Introduction
5
RSA
The most common public key algorithm is RSA,
named for its inventors Rivest, Shamir, and
Adelman.
It uses two numbers:
e ➔ public key
d ➔ private key
The two keys, e and d, have a special
relationship to each other.
Chapter 1 Introduction
6
RSA
Chapter 1 Introduction
7
RSA –Selecting Keys
Chapter 1 Introduction
8
Figure: The RSA Algorithm
Chapter 1 Introduction
9
Chapter 1 Introduction
10
Chapter 1 Introduction
11
Simple RSA Example
Chapter 1 Introduction
12
Simple RSA Example
Chapter 1 Introduction
13
Assignment
Chapter 1 Introduction
14
Diffie-Hellman
Part 1 Cryptography
15
Diffie-Hellman Key
Exchange
Invented by Williamson (GCHQ) and,
independently, by D and H
(Stanford)
A “key exchange” algorithm
o Used to establish a shared symmetric
key
o Not for encrypting or signing
Based on discrete log problem
o Given: g, p, and gk mod p
o Find: exponent k
Part 1 Cryptography
16
Diffie-Hellman
Let p be prime, let g be a generator
o For any x {1,2,…,p-1} there is n s.t. x = gn
mod p
Alice selects her private value a
Bob selects his private value b
Alice sends ga mod p to Bob
Bob sends gb mod p to Alice
Both compute shared secret, gab mod p
Shared secret can be used as symmetric
17
key
Part 1 Cryptography
Diffie-Hellman
Public: g and p
Private: Alice’s exponent a, Bob’s
exponent b
Part 1 Cryptography
20
Diffie-Hellman
How to prevent MiM attack?
o Encrypt DH exchange with symmetric key
o Encrypt DH exchange with public key
o Sign DH values with private key
o Other?
At this point, DH may look pointless…
o …but it’s not (more on this later)
You MUST be aware of MiM attack on
Diffie-Hellman
Part 1 Cryptography
21
Uses for Public Key Crypto
Part 1 Cryptography
22
Uses for Public Key Crypto
Confidentiality
o Transmitting data over insecure
channel
o Secure storage on insecure media
Authentication protocols (later)
Digital signature
o Provides integrity and non-
repudiation
o No non-repudiation with symmetric
Part 1 keys
Cryptography
23
Non-non-repudiation
Alice orders 100 shares of stock from
Bob
Alice computes MAC using symmetric
key
Stock drops, Alice claims she did not
order
Can Bob prove that Alice placed the
order?
No! Bob also knows the symmetric key,
so he could have forged the MAC
Part 1 Cryptography
24 Problem: Bob knows Alice placed the
Non-repudiation
Alice orders 100 shares of stock from
Bob
Alice signs order with her private key
Stock drops, Alice claims she did not
order
Can Bob prove that Alice placed the
order?
Yes! Alice’s private key used to sign the
order only Alice knows her private key
This assumes Alice’s private key has not
Part 1 Cryptography
25 been lost/stolen
Public Key Notation
Sign message M with Alice’s
private key: [M]Alice
Encrypt message M with Alice’s
public key: {M}Alice
Then
{[M]Alice}Alice = M
[{M}Alice]Alice = M
Part 1 Cryptography
26
Public Key Notation
Sign message M with Alice’s
private key: [M]Alice
Encrypt message M with Alice’s
public key: {M}Alice
Then
{[M]Alice}Alice = M
[{M}Alice]Alice = M
Part 1 Cryptography
27
Sign and Encrypt
vs
Encrypt and Sign
Part 1 Cryptography
28
Confidentiality and
Non-repudiation?
Suppose that we want
confidentiality and integrity/non-
repudiation
Can public key crypto achieve
both?
Alice sends message to Bob
o Sign and encrypt: {[M]Alice}Bob
o Encrypt and sign: [{M}Bob]Alice
Can the order
Part 1 Cryptography
29
possibly matter?
Sign and Encrypt
M = “My theory, which is
mine….”
Part 1 Cryptography
30
Encrypt and Sign
M = “My theory, which is
mine….”
Part 1 Cryptography
32
Elliptic Curve
Cryptography
Definition : Elliptic Curve Cryptography (ECC) is
a form of public key cryptography based on the
algebraic structure of elliptic curves over finite
fields. ECC provides a high level of security with
shorter key lengths compared to traditional
methods such as RSA.
Mathematical Foundation:
Relies on properties of elliptic curves. Defined by
the equation y2=x3+ax+b.
Security:
Provides high security with shorter keys.
256-bit ECC key ≈ 3072-bit RSA key in security.
Chapter 1 Introduction
33
Elliptic Curve
Cryptography
Performance:
Faster computations.
Lower resource usage.
Ideal for devices with limited power and processing
(e.g., mobile phones, IoT).
Applications:
Data encryption.
Digital signatures.
Key exchange in secure communications (e.g., SSL/TLS).
Chapter 1 Introduction
34
Elliptic Curve
Cryptography
Chapter 1 Introduction
35
Elliptic Curve
Cryptography
Chapter 1 Introduction
36
Elliptic Curve
Cryptography
Chapter 1 Introduction
37
Current status and
application
US government
Tor
Bitcoin
iMessage
SSL/TLS
SSH Keys
Mobile and embedded
More
Chapter 1 Introduction
38
Strengths
Relies on difficulty of elliptic curve discrete
logarithm
Offers similar strength with smaller keys
Faster, but more secure
Chapter 1 Introduction
39
Weaknesses
Quantum computing attack on ECC_DH
Similar Diffie Hellman attacks
Theories of built-in backdoors
Patents
Chapter 1 Introduction
40