Private key & Public key Encryption!

Geeky much!
Networks & Security
3 min readMay 4, 2021

--

Private key Encryption

In private key encryption data is encrypted and decrypted by a single key that the sender and the reciever know, that is why it is also called symmetric key encryption because during both encryption and decryption of the data, the same key is used.

Symmetric Key Encryption

The flow of sending and recieving goes like this:

  1. The sender uses a key and an encrypting algorithm to encrypt the data.
  2. The ciphered data is then decrypted with the same private key and a decrypting algorithm at the reviever’s end.

Let’s take a look at the different techniques of private key encrption.

  • Stream Cipher — Stream cipher works at a single bit at a time. This is not used much today. RC4 is the most used stream cipher.
  • Block Cipher — Block cipher encrypts data by a certain block or chunk lenghts like 64 bits, 128 bits or 256 bits. Examples of block ciphers are — DES, AES , IDEA, RC5, Blowfish, Triple DES

Private key encryption is easy to use but it has its disadvantages —

The sender needs to get the key to the reciver, and if the private key is acquired by an untrusted entity the privacy of the whole conversation may be compromised. And that’s why we have an alternative called public key encryption.

Public key Encryption

Assymetric Key Encryption

In public key encryption data is encrypted and decrypted by 2 different keys, that is why it is also called asymmetric key encryption. These two keys are mathematically related and form a pair. This is also known as assymetric key encryption. Whatsapp uses this as END-TO-END encryption.

The public key in assymetric encryption is available to everyone while the private key is with the person who generates both of these keys.

Public Key Encryption flow goes as following:

  1. The reciver has generated a public key and put it on a server database.
  2. The reciver informs the sender where he can get the public key.
  3. The sender uses the public key to encrypt the message, and sends it to the reciver.
  4. The reciever using the private key decrypts the message to acquire the plaintext message.

--

--