Encryption
A cryptographic transformation that makes plaintext unreadable without the appropriate decryption key.
Download Markdown (.md)Soroush’s Product Wiki · https://wiki.soroush.uk/topic/encryption/
01What it means
Encryption transforms readable plaintext into ciphertext using an algorithm and key, with authorized holders using a key to recover the plaintext. Symmetric encryption uses a shared secret; asymmetric encryption uses related public and private keys. Encryption protects confidentiality and may provide integrity when an authenticated mode is used.[1][2]
- 01Plaintext + metadataData and authenticated context
- 02Algorithm + keyReviewed mode and secure library
- 03CiphertextUnreadable without authorized key use
- 04Authorized decryptionValidate integrity before releasing plaintext
- 05Key lifecycleGenerate, store, rotate, revoke, back up, destroy
Authenticated encryption can also protect integrity; the security depends on reviewed algorithms, unique nonces, and the entire key lifecycle.
02Why it matters
Encryption limits disclosure when network traffic, disks, backups, or messages are intercepted. Its value depends on key management, authenticated context, endpoint security, and where data is decrypted.
03When to use it
Encrypt sensitive data in transit and at rest according to its threats and obligations. Use established protocols and libraries rather than custom cryptography, and avoid encryption when irreversible verification through hashing is the actual requirement.
04How it works
- Identify the data, attackers, trust boundaries, and required lifetime of confidentiality.
- Choose a reviewed algorithm, mode, protocol, and library appropriate to the use case.
- Generate keys with secure randomness and store them separately under least privilege.
- Encrypt with unique nonces or initialization values and authenticate relevant metadata.
- Decrypt only in authorized contexts and rotate, revoke, back up, and destroy keys through a managed lifecycle.
05A practical example
A document service encrypts each stored file with a data key and protects that key with a centrally managed key-encryption key. TLS protects transfers, while access controls and audit logs govern which service may request decryption.
06Where it breaks
Encryption does not protect data while an authorized endpoint processes it, conceal all metadata, or prevent deletion and misuse. Lost keys can make data unrecoverable; stolen keys can expose every ciphertext they protect.
Common mistakes
- Inventing an algorithm or protocol instead of using reviewed constructions.
- Reusing nonces where the selected mode requires uniqueness.
- Storing encryption keys beside ciphertext with identical access controls.
- Calling encoding, hashing, or signing encryption.
07Sources
- Advanced Encryption Standard (AES) (FIPS 197)NIST · Government standardAdvanced Encryption Standard (AES) (FIPS 197)
- Cryptographic Storage Cheat SheetOWASP Foundation · Security practice guidanceCryptographic Storage Cheat Sheet