Encryption is the method by which data is converted from a readable form to an encoded version that can only be decoded by another entity if they have access to a decryption key. Encryption is one of the most important methods for providing data security, especially for end-to-end protection of data transmitted across networks.
1. Symmetric encryption:
In symmetric encryption,Single key is used for both the tasks i.e., for encrypting as well as decrypting. Taking the example I gave below, sending a secure message to your granny, both of you need to have the same key in order to encrypt and decrypt the messages that you may exchange with each other.
2. Asymmetric encryption:
Asymmetric encryption is opposite to the symmetric encryption as it uses pair of keys: a private one and a public one.
Now, Why do you need two keys?
You use one to encrypt your data, which is called public key, and the other to decrypt the encrypted message, which is called the private key.
When you encrypt your message using, let’s say, your granny’s public key, that same message can only be decrypted using her private key.
Your private key, as the name states, is yours and it must be kept private, as it’s the only key that can decrypt any message that was encrypted with your public key.
Public keys are public and thus no security is required because of it should publicly available and can be passed over the internet. The public key is used to encrypt a message that can only be decrypted using, as I written above, its private counterpart.
In order to understand what I’ve written above take a look at the image below:
3. Hybrid Encryption:
Combination of Symmetric key encryption and asymmetric key encryption.
Here, Public key encryption is used to exchange data.
Whereas, symmetric encryption is used to encrypt communication.
Hybrid encryption is used in all forms of internet communication between client and server these days.
SSL handshake is one good example of Hybrid encryption.