Key
A key is a piece of information used by a cipher for encryption and/or decryption.
A key is a piece of information used by a cipher for encryption and/or decryption.
Encrypted messages should remain secure even if everything about the cryptosystem, except for the key, is public knowledge.
In symmetric-key cryptography, the same key is used for both encryption and decryption.
This key is referred to as the _shared key_, or the _secret key_.
In public-key cryptography, there exists a pair of related keys known as the _public key_ and _private key_. The public key is freely available, whereas the private key is kept secret. The public key is able to encrypt messages that only the corresponding private key is able to decrypt, and vice versa.
## See also
- [Kerckhoffs's principle](https://en.wikipedia.org/wiki/Kerckhoffs%27s_principle) on Wikipedia
- Related glossary terms:
- Block cipher mode of operation
- Cipher
- Ciphertext
- Cipher suite
- Cryptanalysis
- Cryptography
- Decryption
- Encryption
- Plaintext
- Public-key cryptography
- Symmetric-key cryptography
Cite this
"Key". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Glossary/Key