What are the basic parts of encryption?
There is the plaintext you want to protect, an algorithm (the cipher), a key, and the ciphertext that comes out. Modern ciphers are public and heavily studied; their strength rests entirely on keeping the key secret. A 128-bit key has about 3.4 times ten to the 38th possible values, far beyond any brute-force search, so attacks focus instead on stolen keys, weak passwords that keys are derived from, and mistakes in how encryption is used.
How do symmetric and public key encryption differ?
| Kind | Keys | Speed | Typical algorithms | Used for |
|---|---|---|---|---|
| Symmetric | One shared secret key | Very fast, gigabytes per second per core | AES-GCM, ChaCha20-Poly1305 | Bulk data, disks, sessions |
| Public key (asymmetric) | A public and a private key pair | Much slower | RSA, X25519, Ed25519, ECDSA | Key agreement, signatures, identity |
Real systems combine both. TLS and SSH use public key methods to agree on a fresh symmetric key and to prove identity, then switch to a fast symmetric cipher for the data. TLS Handshake shows that sequence step by step, and SSH keys covers the key pairs you log in with.
What does authenticated encryption add?
Older modes only hid data; an attacker could still flip bits in the ciphertext and change the decrypted result in predictable ways. Authenticated encryption with associated data (AEAD), such as AES-GCM and ChaCha20-Poly1305, attaches a tag that fails to verify if anything was altered. Use AEAD modes for anything new. On x86 processors with AES-NI, AES-GCM is extremely fast; on hardware without it, ChaCha20 is usually quicker. Check support with grep -m1 -o aes /proc/cpuinfo.
What is the difference between encryption in transit and at rest?
- In transit: protects data moving over a network. HTTPS, SSH, WireGuard, SMTP with STARTTLS and database connections with TLS all count.
- At rest: protects stored data if a disk, backup or snapshot is taken. Full-disk encryption with LUKS, encrypted file systems and encrypted backup archives belong here.
- In use: protects data while it is being processed, using special CPU features. Still a niche area for most workloads.
Encryption at rest protects against lost or stolen media. It does not protect a running server from an attacker who already has a shell, since the data is unlocked while the system is up.
How do I encrypt a data disk on my machine?
Machines with two drives let you keep the system on one and encrypt a data volume on the other. With LUKS2 on Debian or Ubuntu:
apt install -y cryptsetup lsblk -o NAME,SIZE,MOUNTPOINT # confirm the empty second drive, here nvme1n1 cryptsetup luksFormat --type luks2 /dev/nvme1n1 cryptsetup open /dev/nvme1n1 vault mkfs.xfs -L vaultdata /dev/mapper/vault mkdir -p /srv/vault && mount /dev/mapper/vault /srv/vault cryptsetup luksDump /dev/nvme1n1 | grep -E 'Cipher|PBKDF'
Formatting erases the drive, so double-check the device name. After a reboot the volume stays locked until you open it with the passphrase, which is a feature: anyone handed the drive gets noise. Since there is no remote console to type a passphrase at boot, unlock the data volume over SSH after the system is up rather than encrypting the root file system.
Which encryption choices are outdated?
A few names still appear in old tutorials and should be retired. DES and 3DES use keys too short or blocks too small for modern volumes of data. RC4 has known biases and was removed from TLS years ago. AES in ECB mode encrypts identical blocks to identical output, which leaks patterns in images and structured data. RSA keys shorter than 2048 bits are within reach of well-funded attackers. When a config file or library default offers one of these, pick an AEAD cipher with a current key length instead; the defaults in current OpenSSL, OpenSSH and LUKS releases already do that.
How should keys be managed?
Keys are the real asset. Keep private keys readable only by the service that needs them (chmod 600, owned by that user), never commit them to version control, and store a backup copy of LUKS headers and passphrases somewhere off the machine. Rotate keys when staff leave or when a key may have been exposed. For backups, tools such as restic and borg encrypt on the client before anything leaves the box, so the backup target only ever holds ciphertext.
Does encryption slow a server down?
Barely, on current hardware. AES-NI and wide vector units let one core encrypt several gigabytes per second, faster than most NVMe drives write. The S6 with the Intel Xeon E-2288G handles encrypted storage and TLS without strain, and DDR5 platforms like the S13 add headroom for encrypted backups running alongside live traffic.
Two-Drive Machines for Encrypted Data Volumes
| Server | Processor | Cores / threads | Memory | Storage | Network | Per month | Smallest order |
|---|---|---|---|---|---|---|---|
| S3 | Intel Xeon E-2356G | 6 / 12 | 64 GB DDR4 | 2x 1 TB NVMe | 2x 10 Gbps | $80.38 | $80.38 (1 month) |
| S6 | Intel Xeon E-2288G | 8 / 16 | 64 GB DDR4 | 2x 1 TB NVMe | 2x 10 Gbps | $89.92 | $89.92 (1 month) |
| S13 | AMD EPYC 4345P | 8 / 16 | 128 GB DDR5 | 2x 2 TB NVMe | 2x 25 Gbps | $237.92 | $237.92 (1 month) |
| D1 | 2x Intel Xeon Gold 5315Y | 16 / 32 | 128 GB DDR4 | 2x 1 TB NVMe | 2x 25 Gbps | $202.94 | $202.94 (1 month) |
Keep Reading
TLS Handshake
The exchange that sets up an encrypted HTTPS connection: hellos, key agreement, certificates, and how TLS 1.3 cut it to one round trip.
OpenSSH keys
How SSH key pairs replace passwords, how to make an ed25519 key and how to have it placed on your machine at install time.
OpenHashing
One-way functions that map any input to a fixed-size value, their uses from hash tables to passwords, and the right algorithm for each job.
OpenTwo-drive mirror (RAID 1)
How RAID 1 keeps a full copy of your data on two drives, which machines have two drives and how to check it with mdadm.
OpenFAQ
Quick Answers
Symmetric uses one shared key and is fast. Asymmetric uses a public and private key pair and is mainly used to agree on keys and sign data.
Both are considered secure. AES-256 has a larger safety margin; AES-128 is slightly faster. Either is fine with a good mode such as GCM.
Yes, with LUKS on Linux. Encrypting a separate data volume and unlocking it over SSH after boot is the practical approach.
No. Data is unlocked while the system runs. It protects drives that are removed or disposed of.
Encryption that also detects tampering, such as AES-GCM or ChaCha20-Poly1305. Altered ciphertext fails to decrypt instead of producing wrong data.