Is Chep-5
Is Chep-5
5TH SEM
INFORMATION SECURITY(1030106503)
THEORY NOTES
There are a large number of locations at which an attack can occur. Furthermore, for wide area
communications, many of these locations are not under the physical control of the end user. Even in
the case of local area networks, in which physical security measures are possible, there is always the
threat of the disgruntled employee.
The most powerful and most common approach to securing the points of vulnerability
highlighted in the preceding section is encryption. If encryption is to be used to counter these attacks,
then we need to decide what to encrypt and where the encryption gear should be located. There are
two fundamental alternatives: link encryption and end-to-end encryption.
Basic Approaches
Link to Link Encryption:
With link encryption, each vulnerable communications link is equipped on both ends with an
encryption device. Thus, all traffic over all communications links is secured. One of its disadvantages
is that the message must be decrypted each time it enters a switch because the switch must read the
address (logical connection number) in the packet header in order to route the frame. Thus, the
message is vulnerable at each switch. If working with a public network, the user has no control over
the security of the nodes.
Several implications of link encryption should be noted. For this strategy to be effective, all the
potential links in a path from source to destination must use link encryption. Each pair of nodes that
share a link should share a unique key, with a different key used on each link. Thus, many keys must
be provided.
With end-to-end encryption, the encryption process is carried out at the two end systems. The
source host or terminal encrypts the data. The data in encrypted form are then transmitted unaltered
across the network to the destination terminal or host. The destination shares a key with the source
and so is able to decrypt the data. This plan seems to secure the transmission against attacks on the
network links or switches. Thus, end-to-end encryption relieves the end user of concerns about the
degree of security of networks and links that support the communication. There is, however, still a
weak spot.
Consider the following situation. A host connects to a frame relay or ATM network, sets up a
logical connection to another host, and is prepared to transfer data to that other host by using end-to-
end encryption. Data are transmitted over such a network in the form of packets that consist of a
header and some user data. What part of each packet will the host encrypt? Suppose that the host
encrypts the entire packet, including the header. This will not work because, remember, only the other
host can perform the decryption. The frame relay or ATM switch will receive an encrypted packet
and be unable to read the header. Therefore, it will not be able to route the packet. It follows that the
host may encrypt only the user data portion of the packet and must leave the header in the clear.
Thus, with end-to-end encryption, the user data are secure. However, the traffic pattern is not,
because packet headers are transmitted in the clear. On the other hand, end-to-end encryption does
provide a degree of authentication. If two end systems share an encryption key, then a recipient is
assured that any message that it receives comes from the alleged sender, because only that sender
shares the relevant key. Such authentication is not inherent in a link encryption scheme.
To achieve greater security, both link and end-to-end encryption are needed, as is shown in
Figure 7.2. When both forms of encryption are employed, the host encrypts the user data portion of a
packet using an end-to-end encryption key. The entire packet is then encrypted using a link
encryption key. As the packet traverses the network, each switch
decrypts the packet, using a link encryption key to read the header, and then encrypts the
All data are encrypted, including headers, Headers, addresses, and routing information
addresses, and routing information. are not encrypted, and therefore not protected.
All of the information is encrypted, and the The packets do not need to be decrypted and
packets must be decrypted at each hop so then encrypted again at each hop, because the
the router, or other intermediate device, headers and trailers are not encrypted.
knows where to send the packet next.
The following types of information that can be derived from a traffic analysis attack:
● Identities of partners
● How frequently the partners are communicating
● Message pattern, message length, or quantity of messages that suggest important information
is being exchanged
● The events that correlate with special conversations between particular partners
Another concern related to traffic is the use of traffic patterns to create a covert channel.
Typically, the channel is used to transfer information in a way that violates a security policy. For
example, an employee may wish to communicate information to an outsider in a way that is not
detected by management and that requires simple eavesdropping on the part of the outsider.
With the use of link encryption, network-layer headers (e.g., frame or cell header) are
encrypted, reducing the opportunity for traffic analysis. However, it is still possible in those
circumstances for an attacker to assess the amount of traffic on a network and to observe the amount
of traffic entering and leaving each end system. An effective countermeasure to this attack is traffic
padding, illustrated in Figure 7.6.
Traffic padding produces ciphertext output continuously, even in the absence of plaintext. A
continuous random data stream is generated. When plaintext is available, it is encrypted and
transmitted. When input plaintext is not present, random data are encrypted and transmitted. This
makes it impossible for an attacker to distinguish between true data flow and padding and therefore
impossible to deduce the amount of traffic.
One technique that might prove useful is to pad out data units to a uniform length at either the
transport or application level. In addition, null messages can be inserted randomly into the stream.
These tactics deny an opponent knowledge about the amount of data exchanged between end users and
obscure the underlying traffic pattern.
For symmetric encryption to work, the two parties to an exchange must share the same key,
and that key must be protected from access by others. Furthermore, frequent key changes are usually
desirable to limit the amount of data compromised if an attacker learns the key. Therefore, the term
that refers to the means of delivering a key to two parties who wish to exchange data, without
allowing others to see the key. For two parties A and B, key distribution can be achieved in a number
of ways, as follows:
A third party, whom all parties trust, can be used as a trusted intermediary to mediate the
establishment of secure communications between them (4). Must trust intermediary not to abuse the
knowledge of all session keys. As number of parties grow, some variant of 4 is only practical solution
to the huge growth in number of keys potentially needed.
● The use of a key distribution center is based on the use of a hierarchy of keys. At a minimum,
two levels of keys are used.
● Communication between end systems is encrypted using a temporary key, often referred to as
a session key.
● Typically, the session key is used for the duration of a logical connection and then discarded
● master key is shared by the key distribution center and an end system or user and used to
encrypt the session key.
A issues a request to the KDC for a session key to protect a logical connection to B. The message
includes the identity of A and B and a unique identifier, N1, for this transaction, which we refer to as a
nonce. The nonce may be a timestamp, a counter, or a random number; the minimum requirement is that
it differs with each request. Also, to prevent masquerade, it should be difficult for an opponent to guess
the nonce. Thus, a random number is a good choice for a nonce.
2. The KDC responds with a message encrypted using Ka Thus, A is the only one who can successfully
read the message, and A knows that it originated at the KDC. The message includes two items
intended for A:
Thus, A can verify that its original request was not altered before reception by the KDC and,
because of the nonce, that this is not a replay of some previous request.
These last two items are encrypted with Kb (the master key that the KDC shares with B). They are to
be sent to B to establish the connection and prove A's identity.
● A stores the session key for use in the upcoming session and forwards to B the information that
originated at the KDC for B, namely, E(Kb, [Ks || IDA]). Because this information is encrypted
with Kb, it is protected from eavesdropping. B now knows the session key (Ks), knows that the
other party is A (from IDA), and knows that the information originated at the KDC (because it
is encrypted using Kb).
At this point, a session key has been securely delivered to A and B, and they may begin their
protected exchange. However, two additional steps are desirable:
● Using the newly minted session key for encryption, B sends a nonce, N2, to A.
● Also using Ks, A responds with f(N2), where f is a function that performs some transformation on
N2 (e.g., adding one).
These steps assure B that the original message it received (step 3) was not a replay.
Note that the actual key distribution involves only steps 1 through 3 but that steps 4 and 5, as well as 3,
perform an authentication function.
For very large networks, a hierarchy of KDCs can be established. For communication among
entities within the same local domain, the local KDC is responsible for key distribution. If two
entities in different domains desire a shared key, then the corresponding local KDCs can
communicate through a (hierarchy of) global KDC(s)
To balance security & effort, a new session key should be used for each new connection-
oriented session. For a connectionless protocol, a new session key is used for a certain fixed period
only or for a certain number of transactions.
An automated key distribution approach provides the flexibility and dynamic characteristics
needed to allow a number of terminal users to access a number of hosts and for the hosts to exchange
data with each other, provided they trust the system to act on their behalf.
The use of a key distribution center imposes the requirement that the KDC be trusted and be
protected from subversion. This requirement can be avoided if key distribution is fully decentralized.
In addition to separating master keys from session keys, may wish to define different types of
session keys on the basis of use.
Random numbers play an important role in the use of encryption for various network security applications.
A brief overview of the use of random numbers in network security and some approaches to generating
random numbers are:
In all the cases where the random numbers are used, the requirements are:
• The numbers should be generated such that statistically randomness is maintained with uniform distribution
• Those random numbers should be independent and unpredictable
Pseudorandom numbers are resulting sequences will pass many reasonable tests of randomnes
There are two basic principles of any cryptosystem i.e. confidentiality and authenticity. We have seen that
the symmetric cryptosystem has a problem associated with these two principles.
In symmetric cryptography, the problem associated with confidentiality is that we all know in symmetric
cryptography a secret key is used to encrypt as well as decrypt the message. So, this key must be shared
by both the communicating parties by any means or they must rely on a third party for the distribution of
the key i.e. key distribution centre. But relying on a third party again risk the secrecy of the secret key.
Symmetric key also had an issue with authentication. To become widespread there was a need for digital
signatures that assure all parties that a particular message has been sent from a particular person.
The public key cryptosystem is successful in achieving both these principles i.e. confidentiality and
authenticity.
We begin with first, encrypting the message using the senders private key. Now, as the message is
encrypted using the sender’s private key it is confirmed that the message has been prepared by the sender.
This does the function of the digital signature.
Nobody is able o modify the message without having the sender’s private key. So, public key cryptosystem
has achieved authentication in both the terms data integrity and source.
Now, the message that was first encrypted with the sender’s private key is again encrypted using the
intended receiver’s public key.
M’ = E(PUR ,E(PRS, M)
The final cipher text can only be decrypted by the intended receiver’s private key which is only known to
him. In this way, the public key cryptography achieves confidentiality.
There is a drawback with this approach. We all know that the public key cryptosystem is based on
mathematical function and has too much of computation which makes it complex. To achieve
both confidentiality and authenticity the public key algorithm has to be applied four times.
Step 1. Each user has to generate two keys one of which will be used for encryption and other for
decryption of messages.
Step 2. Each user has a pair of keys, among which one has to be made public by each user. And the other has
to be kept secret.
Step 3. If a user has to send a message to a particular receiver then the sender must encrypt the message
using the intended receivers public key and then send the encrypted message to the receiver.
Step 4. On receiving the message, the receiver has to decrypt the message using his private key.
In public key cryptography, there is no need for key distribution as we have seen in symmetric key
cryptography. As long as this private key is kept secret no one can interpret the message. In future, the user
can change its private key and publish its related public key in order to replace the old public key.
To accomplish the public key cryptography there are following requirements as discussed below.
● The computation of the pair of keys i.e. private key and the public key must be easy.
● Knowing the encryption algorithm and public key of the intended receiver, computation of
cipher text must be easy.
● For a receiver of the message, it should be computationally easy to decrypt the obtained cipher
text using his private key.
● It is also required that any opponent in the network knowing the public key should be unable
to determine its corresponding private key.
● Having the cipher text and public key an opponent should be unable to determine the
original message.
● The two keys i.e. public and private key can be implemented in both
orders D[PU, E(PR, M)] = D[PR, E(PU, M)]
In public key cryptography, every user has to generate a pair of keys among which one is kept secret known
as a private key and other is made public hence called as a public key. Now, the decision of whether the
sender’s private key or receiver’s pubic key will be used to encrypt the original message depends totally on
application.
a. Encryption/Decryption
If the purpose of an application is to encrypt and decrypt the message then the sender has to encrypt the
message using the intended receivers public and the receiver can decrypt the message using his own private
key.
b. Digital Signature
If the purpose of the application is to authenticate the user then the message is signed or encrypted using the
senders private key. As only the sender can have its private key, it assures all parties that the message is
sent by the particular person.
c. Key Exchange
The two communicating parties exchange a secret key (maybe a private key) for symmetric encryption to
secure a particular transaction. This secret key is valid for a short period.
Well, some algorithms implement all the three application and some implement one or two among these
applications. Below is the image showing you the details of algorithm possessing these applications.
To prevent the brute force attack the key size must be kept large enough so that it would be impractical
for an adversary to calculate the encryption and decryption. But the key size should not be so large such
that it would become impractical to compute practical encryption and decryption.
Another type of attack in public key cryptography is that the adversary would try to compute private key
knowing the public key.
One more type of attack is probable message attack. If an adversary knows that the encrypted message from
a particular sender is a 56-bit key. Then he would simply encrypt all possible 56-bit keys using the sender’s
public key as the public key is known to all. And then match all the encrypted messages with the cipher
text. This type of attack can be prevented by appending some random bits to the original message.
In cryptography, it is a very tedious task to distribute the public and private keys between sender and
receiver. If the key is known to the third party (forger/eavesdropper) then the whole security mechanism
becomes worthless. So, there comes the need to secure the exchange of keys.
There are two aspects for Key Management:
1. Distribution of public keys.
2. Use of public-key encryption to distribute
secrets. Distribution of Public Key:
The public key can be distributed in four ways:
1. Public announcement
2. Publicly available directory
3. Public-key authority
4. Public-key certificates.
These are explained as following below:
2. Publicly Available Directory: In this type, the public key is stored in a public directory. Directories
are trusted here, with properties like Participant Registration, access and allow to modify values at any
time, contains entries like {name, public-key}. Directories can be accessed electronically still vulnerable
to forgery or tampering.
3. Public Key Authority: It is similar to the directory but, improves security by tightening control over the
distribution of keys from the directory. It requires users to know the public key for the directory.
Whenever the keys are needed, real-time access to the directory is made by the user to obtain any desired
public key securely.
4. Public Certification: This time authority provides a certificate (which binds an identity to the public key)
to allow key exchange without real-time access to the public authority each time. The certificate is
accompanied by some other info such as period of validity, rights of use, etc. All of this content is signed
by the private key of the certificate authority and it can be verified by anyone possessing the authority’s
public key.
First sender and receiver both request CA for a certificate which contains a public key and other information
and then they can exchange these certificates and can start communication
1. The first party picks two prime numbers, g and p and tells them to the second party.
result back to the first party; let’s call the result A. Keep in mind that the secret number is not sent to
anyone, only the result is.
3. Then the first party does the same; it selects a secret number b and calculates the result B similor to the
5. The second party takes the received number B and calculates Ba mod p
6. The first party takes the received number A and calculates Ab mod p
the answer in step 5 is the same as the answer in step 4. This means both parties will get the same answer no
matter the order of exponentiation.
(ga mod p)b mod p = gab mod p
(gb mod p)a mod p = gba mod p
The number we came within steps 4 and 5 will be taken as the shared secret key. This key can be used to do
any encryption of data that will be transmitted, such as blowfish, AES, etc.
2.
Global Public Elements
● q: q is a prime number
● a: a < q and α is the primitive root of q
3.
Key generation for user A
4.
Key generation for user B
5.
Calculation of Secret Key by A
q Example
2. Alice selected private key a = 4, and Bob selected b = 3 as the private key
3. Both Alice and bob now calculate the value of x and y as follows:
4. Now, both Alice and Bob exchange public numbers with each other.
● Encryption: The Diffie Hellman key exchange algorithm can be used to encrypt; one of the first
schemes to do is ElGamal encryption. One modern example of it is called Integrated
Encryption Scheme, which provides security against chosen plain text and chosen clipboard
attacks.
● Password Authenticated Agreement: When two parties share a password, a password-authenticated
key agreement can be used to prevent the Man in the middle attack. This key Agreement can be in
the form of Diffie-Hellman. Secure Remote Password Protocol is a good example that is based on
this technique.
● Forward Secrecy: Forward secrecy-based protocols can generate new key pairs for each new
session, and they can automatically discard them when the session is finished. In these forward
Secrecy protocols, more often than not, the Diffie Hellman key exchange is used.
● The sender and receiver don’t need any prior knowledge of each other.
● Once the keys are exchanged, the communication of data can be done through an insecure channel.
● The algorithm can not be sued for any asymmetric key exchange.
● Similarly, it can not be used for signing digital signatures.
● Since it doesn’t authenticate any party in the transmission, the Diffie Hellman key exchange
is susceptible to a man-in-the-middle attack.
Conclusion
The Diffie Hellman key Exchange has proved to be a useful key exchange system due to its advantages.
While it is really tough for someone snooping the network to decrypt the data and get the keys, it is still
possible if the numbers generated are not entirely random. Also, the key exchange system makes it possible
to do a man in the middle attack; to avoid it, both parties should be very careful at the beginning of the
exchange.
Recommended Article
This has been a guide to Diffie Hellman Key Exchange Algorithm. Here we discuss the uses, different
algorithms, advantages, and disadvantages. You can also go through our other suggested articles to learn
more
5.8 RSA
RSA algorithm is asymmetric cryptography algorithm. Asymmetric actually means that it works on two
different keys i.e. Public Key and Private Key. As the name describes that the Public Key is given to
everyone and Private key is kept private.
An example of asymmetric cryptography :
1. A client (for example browser) sends its public key to the server and requests for some data.
2. The server encrypts the data using client’s public key and sends the encrypted data.
3. Client receives this data and decrypts it.
Since this is asymmetric, nobody else except browser can decrypt the data even if a third party has public
key of browser.
The idea! The idea of RSA is based on the fact that it is difficult to factorize a large integer. The public key
consists of two numbers where one number is multiplication of two large prime numbers. And private key is
also derived from the same two prime numbers. So if somebody can factorize the large number, the private
key is compromised. Therefore encryption strength totally lies on the key size and if we double or triple the
key size, the strength of encryption increases exponentially. RSA keys can be typically 1024 or 2048 bits
RSA algorithm processes plaintext blocks, with each block having a binary value less than some number
● An integer.
● Not be a factor of n.
● 1 < e < Φ(n) [Φ(n) is discussed below],
● Let us now consider it to be equal to 3.
Note that the actual key distribution involves only steps 1 through 3 but that steps 4 and 5, as well as 3,
perform an authentication function.
For very large networks, a hierarchy of KDCs can be established. For communication among
entities within the same local domain, the local KDC is responsible for key distribution. If two
entities in different domains desire a shared key, then the corresponding local KDCs can
communicate through a (hierarchy of) global KDC(s)
To balance security & effort, a new session key should be used for each new connection-
oriented session. For a connectionless protocol, a new session key is used for a certain fixed period
only or for a certain number of transactions.
An automated key distribution approach provides the flexibility and dynamic characteristics
needed to allow a number of terminal users to access a number of hosts and for the hosts to exchange
data with each other, provided they trust the system to act on their behalf.
The use of a key distribution center imposes the requirement that the KDC be trusted and be
protected from subversion. This requirement can be avoided if key distribution is fully decentralized.
In addition to separating master keys from session keys, may wish to define different types of
session keys on the basis of use.
Random numbers play an important role in the use of encryption for various network security applications.
A brief overview of the use of random numbers in network security and some approaches to generating
random numbers are:
In all the cases where the random numbers are used, the requirements are:
• The numbers should be generated such that statistically randomness is maintained with uniform distribution
• Those random numbers should be independent and unpredictable
Pseudorandom numbers are resulting sequences will pass many reasonable tests of randomnes
There are two basic principles of any cryptosystem i.e. confidentiality and authenticity. We have seen that
the symmetric cryptosystem has a problem associated with these two principles.
In symmetric cryptography, the problem associated with confidentiality is that we all know in symmetric
cryptography a secret key is used to encrypt as well as decrypt the message. So, this key must be shared
by both the communicating parties by any means or they must rely on a third party for the distribution of
the key i.e. key distribution centre. But relying on a third party again risk the secrecy of the secret key.
Symmetric key also had an issue with authentication. To become widespread there was a need for digital
signatures that assure all parties that a particular message has been sent from a particular person.
The public key cryptosystem is successful in achieving both these principles i.e. confidentiality and
authenticity.
We begin with first, encrypting the message using the senders private key. Now, as the message is
encrypted using the sender’s private key it is confirmed that the message has been prepared by the sender.
This does the function of the digital signature.
Nobody is able o modify the message without having the sender’s private key. So, public key cryptosystem
has achieved authentication in both the terms data integrity and source.
Now, the message that was first encrypted with the sender’s private key is again encrypted using the
intended receiver’s public key.
M’ = E(PUR ,E(PRS, M)
The final cipher text can only be decrypted by the intended receiver’s private key which is only known to
him. In this way, the public key cryptography achieves confidentiality.
There is a drawback with this approach. We all know that the public key cryptosystem is based on
mathematical function and has too much of computation which makes it complex. To achieve
both confidentiality and authenticity the public key algorithm has to be applied four times.
Step 1. Each user has to generate two keys one of which will be used for encryption and other for
decryption of messages.
Step 2. Each user has a pair of keys, among which one has to be made public by each user. And the other has
to be kept secret.
Step 3. If a user has to send a message to a particular receiver then the sender must encrypt the message
using the intended receivers public key and then send the encrypted message to the receiver.
Step 4. On receiving the message, the receiver has to decrypt the message using his private key.
In public key cryptography, there is no need for key distribution as we have seen in symmetric key
cryptography. As long as this private key is kept secret no one can interpret the message. In future, the user
can change its private key and publish its related public key in order to replace the old public key.
To accomplish the public key cryptography there are following requirements as discussed below.
● The computation of the pair of keys i.e. private key and the public key must be easy.
● Knowing the encryption algorithm and public key of the intended receiver, computation of
cipher text must be easy.
● For a receiver of the message, it should be computationally easy to decrypt the obtained cipher
text using his private key.
● It is also required that any opponent in the network knowing the public key should be unable
to determine its corresponding private key.
● Having the cipher text and public key an opponent should be unable to determine the
original message.
● The two keys i.e. public and private key can be implemented in both
orders D[PU, E(PR, M)] = D[PR, E(PU, M)]
In public key cryptography, every user has to generate a pair of keys among which one is kept secret known
as a private key and other is made public hence called as a public key. Now, the decision of whether the
sender’s private key or receiver’s pubic key will be used to encrypt the original message depends totally on
application.
a. Encryption/Decryption
If the purpose of an application is to encrypt and decrypt the message then the sender has to encrypt the
message using the intended receivers public and the receiver can decrypt the message using his own private
key.
b. Digital Signature
If the purpose of the application is to authenticate the user then the message is signed or encrypted using the
senders private key. As only the sender can have its private key, it assures all parties that the message is
sent by the particular person.
c. Key Exchange
The two communicating parties exchange a secret key (maybe a private key) for symmetric encryption to
secure a particular transaction. This secret key is valid for a short period.
Well, some algorithms implement all the three application and some implement one or two among these
applications. Below is the image showing you the details of algorithm possessing these applications.
To prevent the brute force attack the key size must be kept large enough so that it would be impractical
for an adversary to calculate the encryption and decryption. But the key size should not be so large such
that it would become impractical to compute practical encryption and decryption.
Another type of attack in public key cryptography is that the adversary would try to compute private key
knowing the public key.
One more type of attack is probable message attack. If an adversary knows that the encrypted message from
a particular sender is a 56-bit key. Then he would simply encrypt all possible 56-bit keys using the sender’s
public key as the public key is known to all. And then match all the encrypted messages with the cipher
text. This type of attack can be prevented by appending some random bits to the original message.
In cryptography, it is a very tedious task to distribute the public and private keys between sender and
receiver. If the key is known to the third party (forger/eavesdropper) then the whole security mechanism
becomes worthless. So, there comes the need to secure the exchange of keys.
There are two aspects for Key Management:
3. Distribution of public keys.
4. Use of public-key encryption to distribute
secrets. Distribution of Public Key:
The public key can be distributed in four ways:
5. Public announcement
6. Publicly available directory
7. Public-key authority
8. Public-key certificates.
These are explained as following below:
2. Publicly Available Directory: In this type, the public key is stored in a public directory. Directories
are trusted here, with properties like Participant Registration, access and allow to modify values at any
time, contains entries like {name, public-key}. Directories can be accessed electronically still vulnerable
to forgery or tampering.
3. Public Key Authority: It is similar to the directory but, improves security by tightening control over the
distribution of keys from the directory. It requires users to know the public key for the directory.
Whenever the keys are needed, real-time access to the directory is made by the user to obtain any desired
public key securely.
4. Public Certification: This time authority provides a certificate (which binds an identity to the public key)
to allow key exchange without real-time access to the public authority each time. The certificate is
accompanied by some other info such as period of validity, rights of use, etc. All of this content is signed
by the private key of the certificate authority and it can be verified by anyone possessing the authority’s
public key.
First sender and receiver both request CA for a certificate which contains a public key and other information
and then they can exchange these certificates and can start communication
1. The first party picks two prime numbers, g and p and tells them to the second party.
result back to the first party; let’s call the result A. Keep in mind that the secret number is not sent to
anyone, only the result is.
3. Then the first party does the same; it selects a secret number b and calculates the result B similor to the
5. The second party takes the received number B and calculates Ba mod p
6. The first party takes the received number A and calculates Ab mod p
the answer in step 5 is the same as the answer in step 4. This means both parties will get the same answer no
matter the order of exponentiation.
(ga mod p)b mod p = gab mod p
(gb mod p)a mod p = gba mod p
The number we came within steps 4 and 5 will be taken as the shared secret key. This key can be used to do
any encryption of data that will be transmitted, such as blowfish, AES, etc.
2.
Global Public Elements
● q: q is a prime number
● a: a < q and α is the primitive root of q
3.
Key generation for user A
4.
Key generation for user B
5.
Calculation of Secret Key by A
q Example
2. Alice selected private key a = 4, and Bob selected b = 3 as the private key
3. Both Alice and bob now calculate the value of x and y as follows:
4. Now, both Alice and Bob exchange public numbers with each other.
● Encryption: The Diffie Hellman key exchange algorithm can be used to encrypt; one of the first
schemes to do is ElGamal encryption. One modern example of it is called Integrated
Encryption Scheme, which provides security against chosen plain text and chosen clipboard
attacks.
● Password Authenticated Agreement: When two parties share a password, a password-authenticated
key agreement can be used to prevent the Man in the middle attack. This key Agreement can be in
the form of Diffie-Hellman. Secure Remote Password Protocol is a good example that is based on
this technique.
● Forward Secrecy: Forward secrecy-based protocols can generate new key pairs for each new
session, and they can automatically discard them when the session is finished. In these forward
Secrecy protocols, more often than not, the Diffie Hellman key exchange is used.
● The sender and receiver don’t need any prior knowledge of each other.
● Once the keys are exchanged, the communication of data can be done through an insecure channel.
● The algorithm can not be sued for any asymmetric key exchange.
● Similarly, it can not be used for signing digital signatures.
● Since it doesn’t authenticate any party in the transmission, the Diffie Hellman key exchange
is susceptible to a man-in-the-middle attack.
Conclusion
The Diffie Hellman key Exchange has proved to be a useful key exchange system due to its advantages.
While it is really tough for someone snooping the network to decrypt the data and get the keys, it is still
possible if the numbers generated are not entirely random. Also, the key exchange system makes it possible
to do a man in the middle attack; to avoid it, both parties should be very careful at the beginning of the
exchange.
Recommended Article
This has been a guide to Diffie Hellman Key Exchange Algorithm. Here we discuss the uses, different
algorithms, advantages, and disadvantages. You can also go through our other suggested articles to learn
more
5.8 RSA
RSA algorithm is asymmetric cryptography algorithm. Asymmetric actually means that it works on two
different keys i.e. Public Key and Private Key. As the name describes that the Public Key is given to
everyone and Private key is kept private.
An example of asymmetric cryptography :
4. A client (for example browser) sends its public key to the server and requests for some data.
5. The server encrypts the data using client’s public key and sends the encrypted data.
6. Client receives this data and decrypts it.
Since this is asymmetric, nobody else except browser can decrypt the data even if a third party has public
key of browser.
The idea! The idea of RSA is based on the fact that it is difficult to factorize a large integer. The public key
consists of two numbers where one number is multiplication of two large prime numbers. And private key is
also derived from the same two prime numbers. So if somebody can factorize the large number, the private
key is compromised. Therefore encryption strength totally lies on the key size and if we double or triple the
key size, the strength of encryption increases exponentially. RSA keys can be typically 1024 or 2048 bits
RSA algorithm processes plaintext blocks, with each block having a binary value less than some number
● An integer.
● Not be a factor of n.
● 1 < e < Φ(n) [Φ(n) is discussed below],
● Let us now consider it to be equal to 3.