0% found this document useful (0 votes)
40 views39 pages

Public Key

Uploaded by

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

Public Key

Uploaded by

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

(Public Key Cryptography)

1
Content
•Public-Key Cryptography : Principles Of Public-Key Cryptography,
RSA Algorithm,
•Key Management, Diffie-Hellman Key Exchange,
• Elgamal Algorithm, Elliptic Curve Cryptography

08/03/2024 PCTE GROUP OF INSTITUTES 2


Principles of Public Key Cryptosystem
• It evolves due to two problems associated with symmetric
encryption.
1. Key distribution under symmetric encryption requires
A. either that two communicants already share a key,
B. Or the use of a key distribution center (KDC).
Key secrecy is a major concern
2. Need of Digital signatures
Public Key Cryptosystem
• Also known as Asymmetric Encryption.
• It needs one key for encryption and a different but related key for
decryption.
• These algorithms have the following important characteristic.
• It is computationally infeasible to determine the decryption key
• Either of the related keys can be used for encryption, other for decryption.
Terminology
Terminology

• Plaintext : Original message

• Ciphertext : Coded message

• Encryption / Enciphering : Process of converting from plaintext to


ciphertext

• Decryption / Deciphering : Restoring the plaintext from ciphertext


Public Key Cryptosystems
Public Key Cryptosystems

Essential Steps
• user generates a pair of keys, for the encryption and decryption
• user places one of the two keys:
• in a public register or other accessible file (public key).
• The companion key is kept private (Private Key).
• Each user maintains a collection of public keys obtained from
others.
Public Key Cryptosystem
Public Key Cryptosystem
Public Key Cryptosystems
Public Key Cryptosystems

• With this approach, all participants have access to public keys


• Private keys are generated locally by each participant and therefore:
• never be distributed.
• As long as a user’s private key remains protected and secret:
• incoming communication is secure.
• At any time, a system can change its private key and publish:
• the companion public key to replace its old public key.
Essential Elements of Public Key Systems
Essential Elements of Public Key Systems

• Source A produces a message in plaintext X = [X1, X2,…XM]

• The M elements of X are letters in some finite alphabet.

• B generates a related pair of keys:


• a public key PUb
• a private key PRb

• PRb is known only to B, whereas PUb is publicly available and


therefore accessible by A.
Essential Elements of Public Key Systems

• With the message X and the encryption key PUb as input, A forms
the ciphertext Y = [Y1, Y2,…YM]

• The intended receiver, in possession of the matching private key, is


able to invert the transformation:
Digital Signature

the entire encrypted message serves as a digital signature.


Authentication and Confidentiality

 It is, however, possible to provide both the authentication function


and confidentiality by a double use of the public-key scheme.

 Complex in nature. Must be exercised four times rather than two in


each communication.
Essential Elements of Public Key Systems
Applications for Public Key Systems

• Public-key systems are characterized by the use of a cryptographic


algorithm with two keys, one held private and one available
publicly.

• Depending on the application, the sender uses either the sender’s


private key or the receiver’s public key, or both, to perform some
type of cryptographic function.

• Public-key cryptosystems can be classified into three categories


Applications for Public Key Systems

1. Encryption /decryption
• The sender encrypts a message with the recipient’s public key.
2. Digital signature
• The sender “signs” a message with its private key.
• Signing is achieved by a cryptographic algorithm applied to the message or
to a small block of data that is a function of the message.
Applications for Public Key Systems

3. Key Exchange
• Two sides cooperate to exchange a session key. Several different
approaches are possible, involving the private key(s) of one or both parties
RSA Algorithm

• Developed in 1977 by Ron Rivest, Adi Shamir, and Len Adleman at


MIT and first published in 1978.

• Most widely accepted and implemented general-purpose approach


to public-key encryption.

• The RSA scheme is a block cipher in which the plaintext and


ciphertext are integers between 0 and n - 1 for some n.
RSA Algorithm

• RSA makes use of an expression with exponentials.

• Both sender and receiver must know the value of n.

• For some plaintext block M and ciphertext block C:


RSA Algorithm
• Sender knows the value of e.

• Only receiver knows the value of d.

• Thus, this is a public-key encryption algorithm with a public key of


PU = {e, n} and a private key of PR = {d, n}
RSA Algorithm
Example:
• p=3, q=11 and m=5
• n=p*q= 33
• Calculate Φ(n) = (p - 1) (q - 1)=2*10=20
• e is relative prime to Φ(n) and e=7
• (de)mod Φ(n) =1, d=3
• Encryption key= (e,n) and decryption key=(d,n)
• c=memodn , suppose m=5, c=57mod33=14
• m=cdmpdn

08/03/2024 PCTE GROUP OF INSTITUTES 23


RSA Algorithm
Example
1. Select two prime numbers p = 17 and q = 11

2. Calculate n = p x q = 17 × 11 = 187

3. Calculate Φ(n) = (p - 1) (q - 1) = 16 × 10 = 160

4. Select e such that e is relatively prime to Φ(n) = 160 and less than
Φ(n); we choose e = 7
RSA Algorithm
5. Determine d such that de ≡ 1 (mod 160) and d < 160.
The correct value is d = 23
because 23 × 7 = 161 = (1 × 160) + 1;
d can be calculated using the extended Euclid’s algorithm.

The resulting keys are:


Public key PU = {7, 187}
Private key PR = {23, 187}.
RSA Algorithm

M = 88
C = 887 mod 187
= (884 mod 187) x (882 mod 187) x (881 mod 187)
= 11
Requirements of RSA Algorithm
• It is possible to find values of e, d, n such that
Med mod n = M for all M < n.

• It is relatively easy to calculate Me mod n and Cd mod n for all


values of M < n.

• It is infeasible to determine d given e and n.


Security of RSA Algorithm
• Four possible approaches to attacking the RSA algorithm are

1. Brute force attack


• Involves trying all possible private keys.
• Defense against the brute-force approach is to use a large key
space. Thus, the larger the number of bits in d.
• key generation and encryption/decryption, are complex.
• The larger the size of the key, the slower the system will run.
Security of RSA Algorithm
2. Mathematical attacks
Effort to factoring the product of two primes.

3. Timing attacks
These depend on the running time of the decryption algorithm.

4. Chosen ciphertext attacks


This type of attack exploits properties of the RSA algorithm.
Diffie-Hellman Algorithm

Elliptic Curve Cryptography (ECC)

• is a planar algebraic curve defined by an equation of the form

Y2=X3+ax+b

Where ‘a’ is the co-efficient of x and ‘b’ is the constant of the


equation
Elliptic Curve Cryptography (ECC)
Diffie-Hellman Algorithm

• The Diffie-Hellman algorithm is being used to establish a shared


secret communications while exchanging data over a public network.

• the elliptic curve is used to generate points and get the secret key
using the parameters.

• For practical implementation of the algorithm, we will consider only 4


variables one prime P and G (a primitive root of P) and two private
values a and b.
Diffie-Hellman Algorithm
• Step by Step Explanation
Alice Bob

Public Keys available = P, G Public Keys available = P, G

Private Key Selected = a Private Key Selected = b

Key generated = Key generated =


x= G mod P
a y= Gb mod P
Diffie-Hellman Algorithm

• Exchange of generated keys takes place

• Key received = y Key received = x

• Generated Secret Key = Generated Secret Key =


ka = yamod P kb= xbmod P

Algebraically it can be shown that ka=kb


Diffie-Hellman Algorithm

Example

• Step 1: Alice and Bob get public numbers P = 23, G = 9

• Step 2: Alice selected a private key a = 4 and


Bob selected a private key b = 3

• Step 3: Alice and Bob compute public values


Alice: x =(9^4 mod 23) = (6561 mod 23) = 6
Bob: y = (9^3 mod 23) = (729 mod 23) = 16
Diffie-Hellman Algorithm

• Step 4: Alice and Bob exchange public numbers

• Step 5: Alice receives public key y =16 and


Bob receives public key x = 6

• Step 6: Alice and Bob compute symmetric keys


Alice: ka = y^a mod p = 65536 mod 23 = 9
Bob: kb = x^b mod p = 216 mod 23 = 9

• Step 7: 9 is the shared secret.


08/03/2024 PCTE GROUP OF INSTITUTES 37
References
• http://www.brainkart.com/article/Classical-Encryption-Techniques_83
39/
• https://www.tutorialspoint.com/cryptography/index.htm
• https://www.geeksforgeeks.org/cryptography-introduction/
• https://www.techopedia.com/definition/1770/cryptography#:~:text=
Cryptography%20involves%20creating%20written%20or,information%
20to%20be%20kept%20secret.&text=Information%20security%20use
s%20cryptography%20on,transit%20and%20while%20being%20store
d
.
E- Books Recommended
• https://www.pdfdrive.com/cyber-security-books.html
• https://bookauthority.org/books/new-cyber-security-ebooks
• https://bookauthority.org/books/best-cyber-security-ebooks
• https://www.freetechbooks.com/information-security-f52.html

You might also like