Encryption
Шифрование
A way to keep data private by scrambling it so that only someone with the right key can read it.
Also known as: симметричное шифрование, асимметричное шифрование
What encryption protects
Suppose someone downloads a copy of your backup from cloud storage. If it was encrypted and they cannot get the decryption key, having the file should not let them read its contents. The original data is called plaintext, even if it is a photo or a database export. The encrypted output is called ciphertext. The algorithm does not need to be secret; what matters is using it correctly and protecting the key that unlocks the data.
Symmetric and asymmetric encryption
Symmetric encryption uses the same secret key to encrypt and decrypt. Algorithms such as AES-GCM and ChaCha20-Poly1305 work well for large files and ongoing network traffic. The challenge is making the key available to authorized readers without exposing it to anyone else.
Asymmetric encryption, also called public-key encryption, uses a key pair. A sender encrypts with the recipient's public key, and the recipient decrypts with the matching private key. The sender must first have a trustworthy way to identify the recipient's public key. Hybrid schemes combine the two approaches: generate a random symmetric key for the data, then protect that key with the recipient's public key.
Example: what goes in an encrypted backup?
With AES-GCM, the backup can contain the ciphertext, a nonce, and an authentication tag. The nonce is not a secret, but it must never be reused for encryption with the same key. The tag lets the library check that the encrypted data has not been tampered with before releasing the plaintext. Keep the key separate, typically under the control of a key management service, and make sure authorized operators can still recover it when they need to restore the backup.
Where encryption helps—and where it doesn't
Encryption at rest protects stored data, such as files on a drive or snapshots in object storage. Encryption in transit protects data moving between endpoints. In HTTPS, TLS 1.3 establishes shared secrets during the handshake and uses symmetric keys to protect the traffic. Neither kind of encryption replaces access control: a service that can decrypt a record can still expose it through a permissions bug.
Confidentiality is not the same as integrity. Use an authenticated encryption scheme (AEAD), such as AES-GCM, when you need to detect tampering as well as hide content. Base64 is not encryption because anyone can decode it without a key. Hashing serves a different purpose: there is no decryption operation, which is why password verification uses a password hash rather than a recoverable copy of the password.
In interviews
Start with the threat rather than naming an algorithm. For a stolen backup, explain who can get the decryption key. For traffic between services, identify where TLS ends and whether the next hop also needs protection.