Encryption is the process of transforming readable data, called plaintext, into an unreadable form, called ciphertext, by means of a mathematical algorithm and a secret key, so that only a party holding the correct key can reverse the operation. In cryptography and cybersecurity, encryption is the primary control for confidentiality: it protects stored files, network traffic, backups and messages even when the underlying medium is lost, stolen or intercepted.
Modern data encryption does not rely on keeping the algorithm secret. Following Kerckhoffs’s principle, the design is public and scrutinized, and all security rests on the key. A well-implemented cipher such as AES is considered secure because no practical attack recovers the key faster than exhaustive search.
How encryption turns plaintext into ciphertext
An encryption scheme consists of three algorithms: key generation, encryption and decryption. The encryption function takes the plaintext and a key and outputs ciphertext; the decryption function takes the ciphertext and the matching key and returns the original data. A correct scheme guarantees that decryption with the right key always recovers the plaintext exactly.
Security is defined formally rather than intuitively. The modern standard is indistinguishability under chosen-plaintext attack (IND-CPA), meaning an attacker who can request encryptions of chosen messages still cannot tell which of two messages a given ciphertext contains. The stronger notion, IND-CCA2, also allows the attacker to request decryptions of other ciphertexts. Meeting these definitions requires randomized encryption: encrypting the same message twice must yield different ciphertexts, which is why schemes use a nonce or an initialization vector.
The table below summarizes the components that appear in nearly every encryption system.
| Component | Role | Typical size or form |
|---|---|---|
| Plaintext | Original readable data | Any length |
| Ciphertext | Encrypted output | Plaintext length plus overhead |
| Key | Secret parameter controlling the transformation | 128 or 256 bits (symmetric) |
| Nonce or IV | Value that makes each encryption unique | 96 to 128 bits |
| Authentication tag | Detects tampering with ciphertext | 128 bits typical |
Symmetric and asymmetric encryption
Encryption algorithms fall into two families that differ in how keys are used. Symmetric encryption uses one shared key for both encryption and decryption, while asymmetric encryption uses a key pair: a public key that anyone may use to encrypt and a private key that only the owner uses to decrypt. Each family has its own dedicated entry; here the point is how they cooperate.
Symmetric ciphers such as AES and ChaCha20 are thousands of times faster than asymmetric operations and handle bulk data. Asymmetric algorithms such as RSA and elliptic curve cryptography solve the key distribution problem, because two parties can establish a shared secret without meeting. Real systems therefore use hybrid encryption: an asymmetric step or a key exchange agrees on a random session key, and a symmetric cipher encrypts the actual payload.
| Property | Symmetric | Asymmetric |
|---|---|---|
| Keys | One shared secret key | Public and private key pair |
| Speed | Very fast, often hardware-accelerated | Slow, used on small data |
| Key size for 128-bit security | 128 bits | 3072-bit RSA or 256-bit curve |
| Main use | Bulk data and storage | Key transport and exchange |
| Examples | AES-GCM, ChaCha20-Poly1305 | RSA-OAEP, ECIES |
Where encryption is applied: at rest, in transit and end to end
Encryption is classified by the state of the data it protects, and each state has different threats and tooling. Encryption at rest protects stored data against theft of disks or backups; encryption in transit protects data moving across networks; end-to-end encryption keeps data encrypted from sender to recipient so that intermediate servers never see plaintext.
| Data state | Threat addressed | Common mechanisms |
|---|---|---|
| At rest | Lost devices, stolen drives, exposed backups | Full-disk encryption, database TDE, object storage keys |
| In transit | Eavesdropping and interception on networks | TLS 1.3, IPsec, SSH, WireGuard |
| End to end | Compromised or curious service providers | Signal protocol, MLS, OpenPGP |
| In use | Memory inspection on untrusted hosts | Confidential computing enclaves, homomorphic encryption |
These layers are complementary, not alternatives. A database protected by disk encryption is still exposed to an attacker who queries it through the application, because the data is decrypted automatically for any authorized process. Defense in depth combines several layers with access control.
Authenticated encryption and cipher modes
Confidentiality alone is insufficient, because unauthenticated ciphertext can be modified without detection. An attacker who flips bits in a stream cipher ciphertext flips the same bits in the plaintext. Authenticated encryption with associated data (AEAD) solves this by producing an authentication tag that the recipient verifies before releasing any plaintext.
A block cipher by itself encrypts only one fixed-size block, so a mode of operation defines how longer messages are processed. The choice of mode matters as much as the choice of cipher.
| Mode | Authenticated | Status and remarks |
|---|---|---|
| ECB | No | Insecure; identical blocks leak patterns |
| CBC | No | Legacy; vulnerable to padding oracle attacks without a MAC |
| CTR | No | Fast and parallel; needs separate integrity protection |
| GCM | Yes | Standard AEAD; catastrophic failure on nonce reuse |
| ChaCha20-Poly1305 | Yes | AEAD suited to devices without AES hardware |
| AES-GCM-SIV | Yes | Misuse-resistant; tolerates accidental nonce reuse |
Key management, strength and limitations
Encryption is only as strong as the protection of its keys. In practice, breaches rarely result from breaking AES; they result from keys stored beside the data, hard-coded in source code, or derived from weak passwords. Key management covers generation from a cryptographically secure random source, storage in hardware security modules or key management services, rotation, revocation and destruction.
Key length determines resistance to brute force. A 128-bit symmetric key is beyond exhaustive search with classical computers, and 256-bit keys keep a wide margin against Grover’s algorithm on future quantum computers. Asymmetric schemes based on factoring or discrete logarithms, however, would be broken by a large quantum computer running Shor’s algorithm, which motivates the migration to post-quantum cryptography and the threat known as harvest now, decrypt later.
Several misconceptions recur in practice:
- Encoding is not encryption: Base64 and compression provide no secrecy.
- Hashing is not encryption: a hash function is one-way and has no decryption key.
- Encryption does not hide metadata: message size, timing and endpoints often remain visible.
- Custom ciphers are a red flag: unreviewed designs almost always contain exploitable flaws.
- Nonce reuse can be fatal: repeating a nonce with the same key in GCM can expose plaintext and the authentication key.
Explained without jargon
Encryption is like putting a message in a locked box that only the right key opens. Anyone can see the box and even carry it away, but without the key the contents look like random noise.
The lock design is public and has been tested by experts for years, so the only thing that must stay secret is the key itself. Lose control of the key and the protection is gone, which is why careful organizations spend as much effort guarding keys as choosing algorithms.
A typical use case
A regional health clinic stores patient records on laptops used by visiting nurses. The security team enables full-disk encryption with AES-256 on every laptop, ties the disk key to the device’s TPM chip combined with a user PIN, and escrows recovery keys in a central key management service.
All traffic between the laptops and the records server runs over TLS 1.3 with AES-GCM, and the server database uses transparent data encryption with keys held in a hardware security module. When a nurse’s laptop is stolen from a car, the clinic confirms through its device management console that encryption was active. The data on the disk is unreadable without the key, so the incident is handled as a lost device rather than a patient data breach.