0% found this document useful (0 votes)
17 views

CompSec 4035 Chapter 3 Lesson 4

Uploaded by

gemeda.gama
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

CompSec 4035 Chapter 3 Lesson 4

Uploaded by

gemeda.gama
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Chapter Three - part 4

Asymmetric Cryptography
Encryption and decryption are performed using two
different keys;
public key and
private key.
 It is also known as public-key encryption
 Invented by Diffie and Hellman in 1976
Based on mathematical functions/the two different
keys are mathematically related
 Transforms plaintext/ciphertext into ciphertext/
plaintext using one of the two keys and an encryption/
decryption algorithm.
Asymmetric-key(public key) encryption
The basic idea:

A user has two keys: a public key and a private key.

A message can be encrypted with the public key


and decrypted with the private key to provide
security.

A message can be encrypted with the private key


and decrypted with the public key to provide
signatures.
Asymmetric-key(public key) encryption
Example: how it works ?
Assume Bob and Alice agreed to use Asymmetric encryption
method, and
Bob wants to send an encrypted message to Alice
Remember : In Asymmetric-key encryption, the encryption
process starts with the receiver
Step1: Alice creates a pair of keys: one public and one private key
Alice keeps the private key and puts the public key in a public key
server which any one can access it
Step1: Alice informs Bob where he can get her public key
Step3: Bob gets Alice’s public key based on Alice’s instruction/info
Step4: Bob writes a message uses Alice’s public key to encrypt it
Step5: Bob sends his encrypted message to Alice
Step6: Alice uses her own private key to decrypt Bob’s message
Asymmetric-key(public key) encryption
Public-Key/ Asymmetric Cryptography
Probably most significant advance in the 3000 year history of
cryptography
Asymmetric since parties are not equal
Uses clever application of number theoretic concepts to
function
Complements rather than replaces private key crypto
No principle of being superior than private key crypto
Key distribution is not simpler than private key crypto

It is a revolutionary concept since it avoids the need


of using a secure channel to communicate the key
It has made cryptography available for the general
public and made many of today’s on-line application
feasible
Asymmetric Key Encryption
Public-key Cryptosystem requirements
It is computationally easy for a party B to generate a pair
(public key PUb, private key PRb)
It is computationally easy for a sender A, knowing the public
key and the plaintext, M, to generate the corresponding
ciphertext: C = E(PUb, M)
It is computationally easy for the receiver B to decrypt the
resulting ciphertext using the private key :M = D(PRb, C) =
D[PRb, E(PUb, M)]
It is computationally infeasible for an adversary, knowing the
public key, PUb, to determine the private key, PRb.
It is computationally infeasible for an adversary, knowing the
public key, PUb, and a ciphertext, C, to recover the original
message, M.
Asymmetric Key Encryption
Based on mathematical functions rather than on simple
operations on bit patterns
Uses two separate keys
 Public key- known publicly
 Private key– known only by the owner

Can be used for:


 Digital signature
 Symmetric key distribution
 Encryption

Different algorithms
 RSA
 Diffie –Hellman
 DSS – Digital Signature Standard
 Elliptic Curve
Public-key Cryptosystem: Example RSA
RSA is from R. Rivesh, S. Shamir and A. Aldermen
Principle:
 No mathematical method is yet known to efficiently find the prime
factors of large numbers: Ex: 2100= 2x2x3x5x5x7
In RSA, the private and public keys are constructed from very
large prime numbers (consisting of hundreds of decimal
digits)
One of the keys can be made public
Support both public key encryption and digital signature
Breaking RSA is equivalent to finding the prime
factors: this is known to be computationally infeasible
It is only the person who has produced the keys from
the prime number can easily decrypt the messages
Public-key Cryptography
RSA- Example of Asymmetric/Public-Key Cryptosystem
I
- The RSA algorithm
 Used for both public key encryption and digital
signatures.
 Security is based on the difficulty of factoring large
integers.

- Major Activities
Key Generation (Algorithm)

 Encryption
 Decryption
 Digital signing
 Signature verification
Public-key Cryptosystem: Example RSA
RSA is the most common and well-known public key
cryptosystem
RSA- Key Generating Algorithm
1. Pick/Generate two large random prime numbers, p and q
2. Compute n = pq and (φ) phi = (p-1)(q-1), totient function
3. Choose an integer e, such that 1 < e < φ, and
gcd(e, phi) = 1, relatively pr.
Doesn’t have common factor
4. Compute/determine d (secret exponent), such that
1 < d < φ ,and φ divides ed-1 or (ed)Mod φ = 1=>(ed-1)Mod φ=0
5. The public key is (n, e) and
The private key is (n, d)
 Keep all the values d, p, q and φ secret
 e is known as the public key exponent or encryption exponent
 d is known as the secret key exponent or decryption exponent.
Public-key Cryptosystem: Example RSA
 Both sender and receiver know n
 Sender knows e
 Only receiver knows d

RSA- Encryption
To encrypt a message M, 0≤M<n
 Obtain the public key (e,n)
 Compute C = Me mod n
RSA- Decryption
To decrypt the cyphertext C,
 Use your private key (d,n)
 Compute M = Cd mod n
Public-key Cryptosystem: RSA Example 1
1. Choose 2 prime numbers: p=7, q=17 & let M=19
2. Compute n=p*q=7*17=119
ø(n)=(p-1)*(q-1)= 6*16=96
3. Choose e relative prime to ø(n), e=5
4. Determine d: de=1 mod 96 and d < 96
 Compute d = 5–1 mod 96=77
5. Publish (5,119), public key
Keep (77,119), 7, 17, Private key
Encrypt
195 mod 119 = 2,476,099 mod 119 = 66
Decrypt
6677 mod 119 = 19 mod 119 = 19
Public-key Cryptosystem: RSA Example 2
1. Select primes p=11, q=3.
2. n = pq = 11*3 = 33
phi = (p-1)(q-1) = 10*2 = 20
3. Choose e=3
Check gcd(e, p-1) = gcd(3, 10) = 1 (i.e. 3 and 10 are relatively
prime - have no common factors except 1) and check gcd(e,
q-1) = gcd(3, 2) = 1,
therefore gcd(e, phi) = gcd(e, (p-1)(q-1)) = gcd(3, 20) = 1
4. Compute d (1<d<phi) such that d = e-1 mod phi = 3-1 mod 20
i.e. find a value for d such that phi divides ed-1 (20 divides 3d-
1)
Simple testing (d = 2, 3 ...) gives d = 7
Check: ed-1 = 3*7 - 1 = 20, which is divisible by phi (20).
5. Public key = (n, e) = (33, 3)
Private key = (n, d) = (33, 7)
Public-key Cryptosystem: RSA Example 2

Given
Public key = (n, e) = (33, 3)
Private key = (n, d) = (33, 7)

Encryption
• Now say we want to encrypt the message m = 7
- c = me mod n = 73 mod 33 = 343 mod 33 = 13
- Hence the ciphertext c = 13
Decryption
• To check decryption we compute
- m = cd mod n = 137 mod 33 = 7
Public-key Cryptosystem: RSA Example 3
1. Select primes: p=17 & q=11
2. Calculate n = pq =17 x 11=187
ø(n)=(p–1)(q-1)=16x10=160
3. Select e: gcd(e,160)=1; choose e=7
4. Determine d: de = 1 mod 160 and d < 160
Value is d=23 since 160 divides 7x23-1
5. Publish public key PU={7,187}
Keep secret private key PR={23,187}

 given message M = 88
 Encryption:
C = 887 mod 187 = 11
 Decryption:
M = 1123 mod 187 = 88
RSA Algorithm Summary
Strengths of RSA
No prior communication needed
Highly secure (for large enough keys)
Well-understood
Allows both encryption and signing

Weaknesses of RSA
Large keys needed (1024 bits is current standard)
Relatively slow
Not suitable for very large messages
Public keys must still be distributed safely.
The Diffie-Hellman Algorithm for generating a
shared secret session key

 The question of key exchange was one of the first


problems addressed by a cryptographic protocol.
This was prior to the invention of public key
cryptography
The Diffie-Hellman key agreement protocol (1976) was
the first practical method for establishing a shared secret
over an unsecured communication channel
It is not an Encryption algorithm.
It is used to exchange the secret/symmetry key.
Used in Asymmetry Encryption algorithm
18
The Diffie-Hellman Algorithm for generating a
shared secret session key steps

1. Select prime number q,


2. Select α such that α is primitive root of q and α <q
3. Key generation for user A
Select
a Private key XA Here, XA <q
Now, Calculation of Public key YA YA = α XA mod q

4. Key generation for user B


Select
a Private key XB Here, XB <q
Now, Calculation of Public key YB YB = α XB mod q

5. Calculation of Secret Key by A(sender side)


key =(YB)XA mod q
6. Calculation of Secret Key by B( receivers side)
key =(YA)XB mod q

19
Diffie-Hellman Example
users Alice & Bob who wish to swap keys:
agree on prime q=11 and α=2
select random secret keys:
A chooses xA=8, B chooses xB=4
compute public keys:
8
yA=2 mod 11 = 3 (Alice)
4
yB=2 mod 11 = 5 (Bob)
compute shared session key as:
xA 8
K= yB mod q = 5 mod 11= 4 (Alice)
xB 4
K= yA mod q = 3 mod 11= 4 (Bob)
20
The Diffie-Hellman Algorithm with key
exchange

The seemingly magical thing about the DH


protocol is that:
an eavesdropper having access to the public keys
for both A and B would still not be able to figure
out the secret key K.
it allows two parties A and B to create a shared
secret K without either party having to send it
directly to the other.

21
The Diffie-Hellman Algorithm Security
The difficulty of determining the secret shared key
K from the publicly available q, α , YA, and YB is
sometimes referred to as the Computational Diffie-
Hellman Assumption.
Is this enough to compute the K value? No! In
order to compute K, the eavesdropper must do
either of two things:
Raise αXA to the XB power (mod q), which he
cannot do because he does not know XB, or
Raise αXB to the XA power (mod q), which he
cannot do because he does not know22XA.
The Diffie-Hellman Algorithm Security

Even if you accept the security of DH on the basis


of the diffi- culty of solving the discrete logarithm
problem, the DH protocol possesses a number of
vulnerabilities.
If interested, see the publication “Security Issues in
the Diffie-Hellman Key Agreement Protocol” by
Raymond and Stiglic for a list of these
vulnerabilities.
One of the most serious vulnerabilities of DH is
man-in-the-middle attack.
23
Digital Signatures and Digital Certificates
Message Authentication
Until now, we have been concerned with protecting
message content (i.e secrecy) by encrypting the
message.
Will now consider:
how to protect message integrity (ie protection from
modification), as well as
confirming the identity of the sender.

generally this is the problem of message authentication,


In eCommerce applications it is more important than
secrecy. 24
Digital Signatures and Digital Certificates
Message Authentication
Message authentication is concerned with:
Protecting the integrity of a message
Validating identity of originator
Non-repudiation of origin (dispute resolution)

Electronic equivalent of a signature on a message.


First, we will consider the security requirements
Then two alternative functions used:
message encryption
hash function

25
Digital Signatures and Digital Certificates
Message Authentication-security requirements
In the context of communications across a network, the
following attacks can be identified:
Disclosure: Release of message contents to any person
or process not possessing the appropriate cryptographic
key.
Traffic analysis: Discovery of the pattern of traffic
between parties.
Masquerade: Insertion of messages into the network
from a fraudulent source.
This includes the creation of messages by an opponent that
are supposed to come from an authorized entity.
26
Digital Signatures and Digital Certificates
Message Authentication-security requirements
Content modification: Changes to the contents of a message,
including insertion, deletion, transposition, and
modification.
Sequence modification: Any modification to a sequence of
messages between parties, including insertion, deletion, and
reordering.
Timing modification: Delay or replay of messages.
Source repudiation: Denial of transmission of message by
source.
Destination repudiation: Denial of receipt of message by
destination. 27
Digital Signatures and Digital Certificates

28
Digital Signatures and Digital Certificates

29
Digital Signatures and Digital Certificates

30
Digital Signatures and Digital Certificates

Reading Assignment
Digital Signatures – Authentication using hash function
Public key Infrastructure
Digital Certification

31

You might also like