# Understanding the Basics of Cryptography and Public Key Algorithm

In traditional encryption and decryption methods, the key was needed to be protected from intruders, which was its major drawback. This drawback was taken care of by the introduction of a new encryption/decryption method called Public Key Algorithm. Here's more...

In traditional methods, a key was used to encrypt data, and the data was then transmitted to the intended receiver of the information. But the major flaw of this technique was that the method used to encrypt the data was not strong enough, and the key used to encrypt the message also needed to be transferred for the receiver of the message to decrypt it. In such a scenario, if an intruder stole the key, then the method that was used to encrypt the message was useless.

The distribution of the key had always been a problem, as there were chances of intruders getting the key by chance. In 1976, two researchers at Stanford University, Diffie and Hellman, formed a method that would help solving the problem with the key distribution. Diffie and Hellman proposed a cryptosystem in which the encryption key and the decryption key were different. The important point was that the decryption key could not be derived from the encryption key. According to their method, the encryption algorithm (E) and the decryption algorithm (D), had to meet the following three requirements:

1. D(E(P)) = P

2. It is exceedingly difficult to deduce D from E.

3. E cannot be broken by chosen plain text attack.

2. It is exceedingly difficult to deduce D from E.

3. E cannot be broken by chosen plain text attack.

According to the first requirement, if we apply the decryption algorithm (D) to the encrypted data/message E(P), we get the original message, P, back. As per second requirement, it should be nearly impossible to deduce the decryption algorithm (D) from the encryption algorithm (E). And as per the third requirement, it may happen that intruders try to figure out the encryption algorithm with the help of plaintext, but the encryption algorithm (E) should be made in such a way that it cannot be broken easily using anticipation.

Suppose two persons, A and B, wish to communicate with each other over the Internet, but at the same time they do not wish their message to be read by any other person. A will devise his/her own encryption algorithm, a decryption algorithm, an encryption key (Ea) and a decryption key (Da). A makes the encryption algorithm public along with encryption key, but will keep the decryption key (Db) private.

Similarly, B will devise his/her encryption algorithm, decryption algorithm, encryption key (Eb) and a decryption key (Db). B will also make his/her encryption algorithm and encryption key (Eb) public keeping the decryption key (Db) private. Now, A will take a plain text (P) and will encrypt it (Eb(P)) using the encryption algorithm (Eb) and encryption key (Eb) provided by B. A then will send this message to B and B will use his/her decryption key (Db) to retrieve the plain text. In the same way, B will use A's public key (Ea) and encryption algorithm to send a message to A. In this way, it is exceedingly hard to anticipate decryption key (D) from the encryption key (E), which is made public, and no one else except A and B will be able to retrieve the messages.