You are on page 1of 37

Lectures #6

Asymmetric Encryption
CYS535 Network Security
Prepared By: Dr. Ihab ELAFF
Introduction
Introduction
Symmetric Encryption
Introduction
Symmetric Encryption (problem)
Introduction
Symmetric Encryption

One of the main problems of symmetric key


encryption is it requires a secure & reliable
channel for the shared key exchange.
Introduction
Asymmetric Encryption
Introduction
Asymmetric Encryption (Problem)
Introduction
Asymmetric Encryption (Problem)
Introduction
Asymmetric Encryption
• Diffie-Hellman
• RSA
• Elliptic Curve Cryptography (ECC)
• Identify Based Encryption (IBE)
• Content Based Encryption (CBE)
• Attribute Based Encryption (ABE)
Diffie-Hellman
Diffie-Hellman
• The 1976 publication of “New Directions in
Cryptography,” by Whitfield Diffie and Martin
Hellman, was epochal in cryptographic history.
• Many regard it as the beginning of public-key
cryptography.
Basic Math
• We will rely on the formula below being an easy
problem one direction and hard in reverse.
• s = gn mod p
▫ Easy: given g, n, & p, solve for s
▫ Hard: given s, g, & p, solve for n
• And the property of
▫ ga*b mod p = gb*a mod p
Step 1 –Publicly shared information
• Alice & Bob publicly agree to a large prime number called
the modulus, or p.
• Alice & Bob publicly agree to a number called the
generator, or g, which has a primitive root relationship
with p.
• Eve is aware of the values of p or g.
• For example:
▫ p = 17
▫ g=3
Step 1 –Publicly shared information
Step 2 – Select a secret key
• Alice selects a secret key, which we will call a.
• Alice selects a secret key (Private Key), which we will call a.
• Bob selects a secret key (Private Key), which we will call b.
• For our example assume:
▫ a= 54
▫ b = 24
• Eve is unaware of the values of a and b as they are PRIVATE
Step 2 – Select a secret key
Step 3 – Combine secret key with public info.
• Alice combines her secret key of a with the public
information to compute her public key A.
▫ A = ga mod p
▫ A = 354 mod 17
▫ A = 15
• Bob combines his secret key of b with the public
information to compute his public key B.
▫ B = gb mod p
▫ B = 324 mod 17
▫ B = 16
Step 3 – Combine secret key with public info.
Step 4 – Share Public Key
• Alice shares her combined value, A, with Bob
• Bob shares his combined value, B, with Alice.
• Eve knows both Alice’s and Bob’s public keys “A” and
“B”
Step 4 – Share Public Key
Step 5 – Compute Shared Key
• Alice computes the shared secret key.
▫ s = (B mod p)a mod p (s= gb*a mod p)
▫ s = (16 mod 17)24 mod 17
▫ s=1
• Bob computes the shared secret key.
▫ s = (A mod p)b mod p  (s = ga*b mod p)
▫ s = (15 mod 17)54 mod 17
▫ s=1
Step 5 – Compute Shared Key
Step 6 - Alice & Bob have a shared
encryption key, unknown to Eve
• Alice & Bob have created a shared secret key, s,
unknown to Eve
• In our example s=1
• The shared secret key can now be used to encrypt &
decrypt messages by both parties.
Step 6 - Alice & Bob have a shared
encryption key, unknown to Eve
The RSA Algorithm
RSA
• A public-key cryptosystem
• Proposed by Rivest, Shamir, and Adleman in
1977 and a paper was published in The
Communications of ACM in 1978.
• Security relies on the difficulty of factoring large
composite numbers
• Essentially the same algorithm was discovered
in 1973 by Clifford Cocks, who works for the
British intelligence
Basic Math
• Factorization of integers into their prime factors
is hard: n=p.q, where p and q are distinct
primes.
• Congruent (≡):
X mod Y = Z  X ≡ Z mod Y
Securing Messages from Alice to Bob using
RSA
Step 1: Receiver Side Calculations
• Bob chooses two primes p,q
• Bob compute n = pq, and (n) = (q-1)(p-1)
▫ Ex: if p = 53, q = 59 then
n = 3127, (n) = 52x58 = 3016
• Bob pick an exponent that not shared a factor with (n) (
this is written as gcd(e, (n))=1).
▫ Ex: e = 3
• Bob solves d.e≡1 (mod (n))
k∗(n)+1 2∗3016+1
d= = = 2011
e 3
k= 1, 2, …
• d is Bob’s Private Key
Step 1: Receiver Side Calculations
Step 2: Receiver Send Public information
• Bob send only n and e to Alice
▫ n=3127
▫ e=3
• Eve can see n and e
Step 2: Receiver Send Public information
Step 3: Sender Side Data Encryption
• Alice uses n and e to encrypt her message “m” using
the formula:
c = me mod n
where “c” is the encrypted message
▫ Ex.: With m=89 and
▫ n=3127
▫ e=3
▫ Then c = 893 mod 3127 = 1394

• Alice send the encrypted message “c” to Bob


Step 3: Sender Side Data Encryption
Step 4: Receiver side decryption
• Bob decrypt Alice’s message using the formula:
m = cd mod n
▫ Ex.: With c=1394 and
▫ n=3127
▫ d=2011  Private key
▫ Then m = 13942011 mod 3127 = 89
Step 4: Receiver side decryption
End.

You might also like