Once that's done, messages can be encrypted in a way that only the communicating parties can decrypt them. The core component of authorization and encryption is cryptography. It is one of the oldest fields of techinal study we can find records of. Click on the links for details on either a short history of cryptography or the cryptography timeline . The reason that cryptography has been studied for the past 4000 years is that people keep cracking the code.
All modern algorithms use a key to control the encryption and decryption.
The key for encryption and descryption need not be the same. Symmetric algorithms uses the same key for both encryption and decryption. Therefore, the key must be secret. Asymmetric algorithms uses different keys for encryption and decryption. The encryption key is public.