Thanks to visit codestin.com
Credit goes to www.scribd.com

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

Network Security Cryptography Basics

Uploaded by

MOORAM AKHILA
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 views26 pages

Network Security Cryptography Basics

Uploaded by

MOORAM AKHILA
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/ 26

Cryptography in Network Security

Unit-VI
Cryptography in Network Security-
In network security,
1.Cryptography is a method of storing and transmitting data in a
particular form.
2.It ensures that only the person for whom the message is intended can
read the message.

The message exchange using cryptography involves the following steps-


 Step-01:

 At sender side,
 Using an encryption algorithm, the message is converted into an unreadable form.
 The message in unreadable form is called as cipher text.

 Step-02:

 The cipher text is sent to the receiver over the communication channel.
 Since the message is encrypted, the attackers can not read the message.

 Step-03:

 At receiver side,
 Using a decryption algorithm, the message is again converted into the readable
form.
 Then, receiver can read the message.

Cryptography Techniques-
Symmetric Key Cryptography-
In this technique,
Both sender and receiver uses a common key to
encrypt and decrypt the message.
This secret key is known only to the sender and to the
receiver.
It is also called as secret key cryptography.
Working-
The message exchange using symmetric key
cryptography involves the following steps-
Before starting the communication, sender and
receiver shares the secret key.
This secret key is shared through some external
means.
At sender side, sender encrypts the message using his
copy of the key.
The cipher text is then sent to the receiver over the
communication channel.
At receiver side, receiver decrypts the cipher text using
his copy of the key.
After decryption, the message converts back into
readable format.
 Symmetric Encryption Algorithms-
 Some of the encryption algorithms that use symmetric key are-
 Advanced Encryption Standard (AES)
 Data Encryption Standard (DES)
 Advantages-
 The advantages of symmetric key algorithms are-
 They are efficient.
 They take less time to encrypt and decrypt the message.
 Disadvantages-
 Point-01:
 The number of keys required is very large.
 In symmetric key cryptography,
 Each pair of users require a unique secret key.
 If N people in the world wants to use this technique, then there needs to be N(N-1) / 2
secret keys.
 For 1 million people to communicate, a half billion secret keys would be needed.
 Point-01:
 Sharing the secret key between the sender and receiver is an important issue.
 While sharing the key, attackers might be come.
 To overcome this disadvantage,
 Diffie Hellman Key Exchange Algorithm is used for exchanging the secret key
Asymmetric Key Cryptography-

In this technique,


Sender and receiver use different keys to encrypt and
decrypt the message.
So that sender and receiver use different keys.
It is also called as public key cryptography.

Working-

The message exchange using public key cryptography


involves the following steps-
 Step-01:
 At sender side,
 Sender encrypts the message using receiver’s public key.
 The public key of receiver is publicly available and known to everyone.
 Encryption converts the message into a cipher text.
 This cipher text can be decrypted only using the receiver’s private key.
 Step-02:
 The cipher text is sent to the receiver over the communication channel.
 Step-03:
 At receiver side,
 Receiver decrypts the cipher text using his private key.
 The private key of the receiver is known only to the receiver.
 Using the public key, it is not possible for anyone to determine the
receiver’s private key.
 After decryption, cipher text converts back into a readable format.
Advantages-
The advantages of public key cryptography are-
It is more robust.
It is less susceptible to third-party security breach attempts.
Disadvantages-
The disadvantages of public key cryptography are-
It involves high computational requirements.
It is slower than symmetric key cryptography.
Number of Keys Required-
To use public key cryptography,
Each individual requires two keys- one public key and one
private key.
For n individuals to communicate, number of keys required
= 2 x n = 2n keys.
Asymmetric Encryption Algorithms-
The famous asymmetric encryption algorithms are-
RSA Algorithm-
 Let-
 Public key of the receiver = (e , n)
 Private key of the receiver = (d , n)
 Then, RSA Algorithm works in the following steps-
 Step-01:
 At sender side,
 Sender represents the message to be sent as an integer between 0 and n-1.
 Sender encrypts the message using the public key of receiver.
 It raises the plain text message ‘P’ to the eth power modulo n.
 This converts the message into cipher text ‘C’.
C = Pe mod n
 Step-02:

 The cipher text ‘C’ is sent to the receiver over the communication channel.
Step-03:
At receiver side,
Receiver decrypts the cipher text using his private key.
It raises the cipher text ‘C’ to the dth power modulo n.
This converts the cipher text back into the plain text
‘P’.
P = Cd mod n
After decryption, receiver must have-
P = Cd mod n
P = (Pe mod n)d mod n
P = Ped mod n
For this equation to be true, by Euler’s Theorem, we
must have-
ed = 1 mod Ø(n)
OR
ed = kØ(n) + 1
 An
Steps individual
to Generate Public Keycan generate
And Private Key- his public key and private key using the following steps-
 Step-01:
Choose any two prime numbers p and q such that-
They are different.
They are very large.
 Step-02:
Calculate ‘n’ and toilent function Ø(n) where-
n=pxq
Ø(n) = (p-1) x (q-1)
 Step-03:
Choose any value of ‘e’ such that-
1 < e < Ø(n)
gcd (e, Ø(n)) = 1
 Step-04:
Determine ‘d’ such that-
You already know the value of ‘e’ and Ø(n).
Choose the least positive integer value of ‘k’ which gives the integer value of ‘d’ as a result.
Use trial and error method.
Start substituting different values of ‘k’ from 0.
d = (1 + k.φ (n))/e
In an RSA cryptosystem, a particular A uses two prime numbers, 13 and 17, to generate the public
and private keys. If the public of A is 35. Then the private key of A is ……………?.
Explanation:
 Step 1: in the first step, select two large prime numbers, p and q.
p = 13
q = 17
 Step 2: Multiply these numbers to find n = p x q, where n is called the modulus for encryption and decryption.
First, we calculate
n=pxq
n = 13 x 17
n = 221
 Step 3: Choose a number e less that n, such that n is relatively prime to (p - 1) x (q -1). It means that e and (p - 1) x (q - 1) have no
common factor except 1. Choose "e" such that 1<e < φ (n), e is prime to φ (n), gcd (e, d (n)) =1.
Second, we calculate
φ (n) = (p - 1) x (q-1)
φ (n) = (13 - 1) x (17 - 1)
φ (n) = 12 x 16
φ (n) = 192
g.c.d (35, 192) = 1
 Step 3: To determine the private key, we use the following formula to calculate the d such that:
Calculate d = de mod φ (n) = 1
d = d x 35 mod 192 = 1
d = (1 + k.φ (n))/e [let k =0, 1, 2, 3………………]
Put k = 0
d = (1 + 0 x 192)/35
d = 1/35
Put k = 1
d = (1 + 1 x 192)/35
d = 193/35
Put k = 2
d = (1 + 2 x 192)/35
d = 385/35
d = 11
The private key is <d, n> = (11, 221)
Hence, private key i.e. d = 11
 A RSA cryptosystem uses two prime numbers 3 and 13 to generate the public key= 3 and
the private key = 7, if message is 5. What is the value of cipher text for a plain text
value,?
Explanation:
 Step 1: In the first step, select two large prime numbers, p and q.
p=3
q = 13
 Step 2: Multiply these numbers to find n = p x q, where n is called the modulus for
encryption and decryption.
First, we calculate
n=pxq
n = 3 x 13
n = 39
 Step 3: If n = p x q, then the public key is <e, n>. A plaintext message m is encrypted
using public key <e, n>.
 Thus the public key is <e, n> = (3, 39).
To find ciphertext from the plain text following formula is used to get ciphertext C.
C = me mod n
C = 53 mod 39
C = 125 mod 39
C=8
Hence, the ciphertext generated from plain text, C = 8.
This algorithm is used to exchange the secret key between the sender and the receiver.
Diffie
 ThisHellman Key Exchange-
algorithm facilitates the exchange of secret key without actually transmitting it.
 Diffie Hellman Key Exchange Algorithm-
 Let-
Private key of the sender = Xs
Public key of the sender = Ys
Private key of the receiver = Xr
Public key of the receiver = Yr
 Using Diffie Hellman Algorithm, the key is exchanged in the following steps-
Step-01:
 One of the parties choose two numbers ‘a’ and ‘n’ and exchange with the other party.
 ‘a’ is the primitive root of prime number ‘n’.
 After this exchange, both the parties know the value of ‘a’ and ‘n’.
Step-02:
 Both the parties already know their own private key.
 Both the parties calculate the value of their public key and exchange with each other.
Sender calculate its public key as-
Ys = aXs mod n
Receiver calculate its public key as-
Yr = aXr mod n
Step-03:
 Both the parties receive public key of each other.
 Now, both the parties calculate the value of secret key.
Sender calculates secret key as-
Secret key = (Yr)Xs mod n
Receiver calculates secret key as-
Secret key = (Ys)Xr mod n
 Suppose that two parties A and B wish to set up a common secret key (D-H key) between themselves using the Diffie Hellman key
exchange technique. They agree on 7 as the modulus and 3 as the primitive root. Party A chooses 2 and party B chooses 5 as their
respective secrets. Their D-H key is-
 Solution-
 Given-
 n=7
 a=3
 Private key of A = 2
 Private key of B = 5
Step-01:
 Both the parties calculate the value of their public key and exchange with each other.
Public key of A
 = 3private key of A mod 7
 = 32 mod 7
 =2
Public key of B
 = 3private key of B mod 7
 = 35 mod 7
 =5
Step-02:
 Both the parties calculate the value of secret key at their respective side.
Secret key obtained by A
 = 5private key of A mod 7
 = 52 mod 7
 =4
Secret key obtained by B
 = 2private key of B mod 7
 = 25 mod 7
 =4
 Finally, both the parties obtain the same value of secret key.

 In a Diffie-Hellman Key Exchange, Alice and Bob have chosen prime value q = 17 and primitive root = 5. If Alice’s secret key is 4
and Bob’s secret key is 6, what is the secret key they exchanged?
 Solution-
 Given-
 n = 17
 a=5
 Private key of Alice = 4
 Private key of Bob = 6
 Step-01:
 Both Alice and Bob calculate the value of their public key and exchange with each other.
 Public key of Alice
 = 5private key of Alice mod 17
 = 54 mod 17
 = 13
 Public key of Bob
 = 5private key of Bob mod 17
 = 56 mod 17
 =2
 Step-02:
 Both the parties calculate the value of secret key at their respective side.
 Secret key obtained by Alice
 = 2private key of Alice mod 7
 = 24 mod 17
 = 16
 Secret key obtained by Bob
 = 13private key of Bob mod 7
 = 136 mod 17
 = 16
 Finally, both the parties obtain the same value of secret key.
 The value of common secret key = 16.
Digital Signatures-
 The signature on a document is the proof to the receiver that the document is coming
from the correct entity.
 A digital signature guarantees the authenticity of an electronic document in digital
communication.

 How Digital Signature Works?

 The sender of the document digitally signs the document.


 The receiver of the document verifies the signature.

 The steps involved in the digital signature algorithm are-

 At Sender Side-

 Using a hash function, sender converts the message to be sent into a digested form.
 There are various hash functions that may be used like SHA-1, MD5 etc.
 The message in digested form is called as message digest.
 Sender encrypts the message digest using his private key.
 The encrypted message digest is called as signed digest or signature of the sender.
 Sender sends the signed digest along with the original message to the receiver.
At Receiver Side-

At receiver side,
Receiver receives the original message and the signed
digest.
Using a hash function, receiver converts the original
message into a message digest.
Also, receiver decrypts the received signed digest
using the sender’s public key.
On decryption, receiver obtains the message digest.
Now, receiver compares both the message digests.
If they are same, then it is proved that the document is
coming from the correct entity.

You might also like