Modern cryptography is composed of two flavors: symmetric & asymmetric.

In symmetric cryptography, there is only one key that is used in both encryption/decryption. It is also called shared-key cryptography.

While in asymmetric cryptography, there is a key-pair, i.e., a public key and a private key, so it is also named as public-key cryptography. The ciphertext which is encrypted by public key can only be decrypted by private key and vice versa. Generally, as the name indicates, public key is accessed by every one, while private key only you can access . When someone wants to send you confidential message, he/she encrypts the information using public key and only you can use private key to decrypt it. For the same reason, you can use private key to make a digital signature and every one can use public key to make sure it is indeed you publish.

Although asymmetric cryptography is more safer than symmetric, but symmetric is more faster. Nowadays, there is usually a hybrid solution, which is for the content, it is encrypted using symmetric cryptography, while for the key transfer, using asymmetric cryptography. This method can leverage the advantages of both methods.