0% found this document useful (0 votes)
76 views27 pages

4.2. Cryptographic Coding (Part 2)

The document discusses asymmetric-key cryptography and the RSA public key cryptosystem. It explains the differences between symmetric and asymmetric key cryptography, including how asymmetric key uses two different keys for encryption and decryption while symmetric key uses the same key. It then describes the history and development of asymmetric cryptography, including Diffie-Hellman key exchange and the RSA algorithm. The RSA algorithm uses a public and private key pair to encrypt and decrypt messages securely.

Uploaded by

Reach
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)
76 views27 pages

4.2. Cryptographic Coding (Part 2)

The document discusses asymmetric-key cryptography and the RSA public key cryptosystem. It explains the differences between symmetric and asymmetric key cryptography, including how asymmetric key uses two different keys for encryption and decryption while symmetric key uses the same key. It then describes the history and development of asymmetric cryptography, including Diffie-Hellman key exchange and the RSA algorithm. The RSA algorithm uses a public and private key pair to encrypt and decrypt messages securely.

Uploaded by

Reach
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/ 27

បណ្ឌិត្យសភាបច្ចេកវទ្យាឌ

ិ ជី ថ
ី លកម្ពុជា
Cambodia Academy of Digital and Technology

IV. Cryptographic Coding (Part 2)

Lecturer: Cheat Morokot


3- Asymmetric-Key Cryptography
• Asymmetric-key cryptography is also called as public key
cryptography or conventional cryptographic system.
• It uses the public key for the encryption, and a private key is
used for decryption.

2
3- Asymmetric-Key Cryptography

3
3- Asymmetric-Key Cryptography
• Advantages of asymmetric-key cryptography:
 Key cannot be distributing among sender and receiver as
both have their own key.
 Even if encryption key is stolen by attacker he/ she cannot
decrypt the message as decryption key is only available with
receiver only.
 Easy to use for user and scalable does not require much
administrative work.

4
3- Asymmetric-Key Cryptography
• Disadvantages of asymmetric-key cryptography:
 Require more time to get the transmission done than
symmetric key cryptography.
 Asymmetric key cryptography utilizes more resource as
compare to symmetric key cryptography.

5
3.1- Differences Between Symmetric and Asymmetric Key
Symmetric Encryption Asymmetric Encryption
• Same key is used for encryption • Asymmetric key cryptography two
and decryption. keys are used: for encryption and
• Symmetric key cryptography is also for decryption.
called as secret key cryptography • Asymmetric key cryptography is
or private key cryptography. also called as public key or
• Mathematically it is represented conventional cryptography.
as P = D (K, E(P)). Where K is • Mathematically it represented as
encryption and decryption key. P= P = D(Kd, E (Ke,P)), where Ke and
plain text, D= Decryption, E(P) = Kd are encrytption and decryption
Encryption of plain text. key. D=Decryption , E(Ke, P) =
Encryption of plain text.
6
3.1- Differences Between Symmetric and Asymmetric Key
Symmetric Encryption Asymmetric Encryption
• Symmetric key is faster than • Asymmetric key is slower than
asymmetric key cryptography. symmetric key cryptography.
• Symmetric key cryptography Because of two different key used.
utilizes less resource as compare to • Asymmetric key cryptography
asymmetric key cryptography. For utilizes more resource as compare
Example : AES, DES. to symmetric key cryptography.
For Example : RSA, Diffie Hellman
Key exchange algorithm.

7
3.2- The Birth of Asymmetric Cryptography

• In 1976, Whitfield Diffie and Martin Hellman published their


now famous paper entitled “New Directions in Cryptography.”
• Their method, which is now called Diffie–Hellman key
exchange, is based on discrete logarithm problem.
• The first important contribution of Diffie and Hellman in was:
 the definition of a Public Key Cryptosystem (PKC)

 its associated components, one-way functions and trapdoor

information.

8
3.2- The Birth of Asymmetric Cryptography

• A one-way function is an invertible function that is easy to


compute, but whose inverse is difficult to compute.
• The trapdoor is a piece of auxiliary information that allows the
inverse to be easily computed.

9
3.3- The Discrete Logarithm Problem (DLP)

• The first published public key construction, due to Diffie and


Hellman, is based on the discrete logarithm problem in a finite
field Fp , where Fp is a field with a prime number of elements.
• Definition: Let g be a primitive root for Fp and let h be a
nonzero element of Fp . The Discrete Logarithm Problem (DLP)
is the problem of finding an exponent x such that
• gx ≡ h (mod p).
• The number x is called the discrete logarithm of h to the base g
and is denoted by logg(h).

10
3.4- Diffie-Hellman Key Exchange

• Example: Alice and Bob want to share a secret key, but their
only means of communication is insecure. Every piece of
information that they exchange is observed by adversary Eve.
• How is it possible for Alice and Bob to share a key without
making it available to Eve?
It was a brilliant insight of Diffie and Hellman that the difficulty
of the discrete logarithm problem for F∗p provides a possible
solution.

11
3.4- Diffie-Hellman Key Exchange

1. The first step is for Alice and Bob to agree on a large prime p
and a nonzero integer g modulo p. Alice and Bob make the
values of p and g public knowledge.
2. The next step is for Alice to pick a secret integer “a” that she
does not reveal to anyone, while at the same time Bob picks an
integer “b” that he keeps secret. Bob and Alice use their secret
integers to compute

12
3.4- Diffie-Hellman Key Exchange

3. They next exchange these computed values, Alice sends “A” to


Bob and Bob sends “B” to Alice. Note that Eve gets to see the
values of A and B, since they are sent over the insecure channel.
4. Finally, they again use their secret integers to compute

5. The values that they compute, A’ and B’ respectively, are


actually the same, since

This common value is their exchanged key.


13
3.4- Diffie-Hellman Key Exchange

Diffie–Hellman key exchange 14


3.4- Diffie-Hellman Key Exchange
Example: Alice and Bob agree to use the prime p = 941 and the
primitive root g = 627. Alice chooses the secret key a = 347 and
computes A = 390 ≡ 627347 (mod 941).
• Similarly, Bob chooses the secret key b = 781 and computes B =
691 ≡ 627781 (mod 941).
• Alice sends Bob the number A = 390 and Bob sends Alice the
number B = 691 over an insecure channel (public knowledge).
• The numbers a = 347 and b = 781 are not transmitted and
remain secret.
• Then Alice and Bob are both able to compute the number 470
≡ 627347·781 ≡ Ab ≡ Ba (mod 941), so 470 is their shared secret.
15
3.5- Euler’s Formula

• Euler’s formula is:


ap−1 ≡ 1 (mod p) for all a ≠ 0 (mod p)
where p is prime number.
• If we replace p with a number m that is not prime, this suggests
that some version of Fermat’s little theorem should be true if
the number a is relatively prime to the modulus m, but the
correct exponent to use is not necessarily m − 1.

16
3.6- The RSA Public Key Cryptosystem

• The RSA public key cryptosystem is the first invented and certainly
best known such system.
• RSA is named after its (public) inventors, Ron Rivest, Adi Shamir, and
Leonard Adleman.
• It is the most widely used public key cryptosystem.
• The security of RSA depends on the following dichotomy:
• Setup. Let p and q be large primes, let N = pq, and let e and c be
integers.
• Problem. Solve the congruence me ≡ c (mod N) for the variable m.
17
3.6- The RSA Public Key Cryptosystem

• Easy. Bob, who knows the values of p and q, can easily solve for m.
• Hard. Eve, who does not know the values of p and q, cannot easily
find m.
• Dichotomy. Solving me ≡ c (mod N) is easy for a person who
possesses certain extra information, but it is apparently hard for
all other people.

18
3.6- The RSA Public Key Cryptosystem

• RSA Key Creation, Encryption, and Decryption

19
3.6- The RSA Public Key Cryptosystem

• The following is a summary of the RSA algorithm altered :


1. The receiver chooses primes p and q and computes n = pq.
2. They then choose e such as 1<e< ϕ(n) and gcd(e, ϕ(n)) = 1. (note
that ϕ(n) = ϕ(p) ϕ(q) = (p - 1)(q - 1))
3. d is then computed with d*e ≡ 1 (mod ϕ(n)).
4. n and e are made public, whereas p, q, d are kept secret.
5. A sender encrypts their plain text m as c ≡ me (mod n) and sends c
to the receiver.
6. The receiver decrypts the cipher text c by computing m≡cd (mod n).

20
3.6- The RSA Public Key Cryptosystem

• The integer c is ciphertext, which Alice sends to Bob. It is then a


simple matter for Bob to solve the congruence xe ≡ c (mod N) to
recover Alice’s message m, because Bob knows the factorization
N = pq. Eve, on the other hand, may intercept the ciphertext c,
but unless she knows how to factor N, she presumably has a
difficult time trying to solve xe ≡ c (mod N).

21
3.6- The RSA Public Key Cryptosystem

• Example: We illustrate the RSA public key cryptosystem with a


small numerical example. Of course, this example is not secure,
since the numbers are so small that it would be easy for Eve to
factor the modulus N. Secure implementations of RSA use modulus
N with hundreds of digits.
RSA Key Creation
• Bob chooses two secret primes p = 1223 and q = 1987. Bob
computes his public modulus N = p · q = 1223 · 1987 = 2430101.
• Bob chooses a public encryption exponent e = 948047 with the
property that gcd(e, (p − 1)(q − 1)) = gcd(948047, 2426892) = 1.
22
3.6- The RSA Public Key Cryptosystem

RSA Encryption
• Alice converts her plaintext into an integer m = 1070777
satisfying 1 ≤ m < N.
• Alice uses Bob’s public key (N, e) = (2430101, 948047) to compute
c ≡ me (mod N),
c≡ 1070777948047 (mod 2430101).
• Alice sends the ciphertext c = 1473513 to Bob.

23
3.6- The RSA Public Key Cryptosystem

RSA Decryption
• Bob knows (p − 1)(q − 1) = 1222 · 1986 = 2426892, so he can solve
ed ≡ 1 (mod (p − 1)(q − 1)),
948047 · d ≡ 1 (mod 2426892),
for d and find that d = 1051235.
• Bob takes the ciphertext c = 1473513 and computes
cd (mod N),
14735131051235 ≡ 1070777 (mod 2430101).
• The value that he computes is Alice’s message m = 1070777.

24
3.6- The RSA Public Key Cryptosystem

Remark: The quantities N and e that form Bob’s public key are
called, respectively, the modulus and the encryption exponent. The
number d that Bob uses to decrypt Alice’s message, that is, the
number d satisfying
ed ≡ 1 (mod (p − 1)(q − 1)),
is called the decryption exponent.

25
Matlab Implementation
1. Implementation on Diffie-Hellman Key Exchange.
2. Implementation on RSA algorithm.

26
Thank You

27

You might also like