First of all we will define what is symmetric and what asymmetric encryption.
Symmetric Encryption is when a single key is being used for encrypting and decrypting text. It is fast and is used for large data transmission. So you have to remember:
- one key
- fast
- large data
Asymmetric Encryption is when we use different keys for encrypting and decrypting text. It is slow and is used for encrypting keys. So you have to remember:
- pair of keys
- slow
- small data
So imagine a situation in which you have to encrypt your data transfer. You can use both techniques for better results. So you can do the following:
- Server uses symmetric encryption to encrypt the response that goes back to client – encrypt data with random symmetric key
- Server encrypts with asymmetric encryption with the users public key the servers symmetric key – encrypt server’s symmetric key with user public key
- Server sends back the data to client together with the encrypted key
- User decrypts the encrypted symmetric key with his private key – decrypt server’s symmetric key with his private key
- User decrypts the encrypted data with the decrypted symmetric key – decrypt data with decrypted symmetric key