4.2. Cryptographic Coding (Part 2)
4.2. Cryptographic Coding (Part 2)
ិ ជី ថ
ី លកម្ពុជា
Cambodia Academy of Digital and Technology
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
information.
8
3.2- The Birth of Asymmetric Cryptography
9
3.3- The Discrete Logarithm Problem (DLP)
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
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
19
3.6- The RSA Public Key Cryptosystem
20
3.6- The RSA Public Key Cryptosystem
21
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