What file encryption actually does — and what it doesn’t protect
This guide is for non-engineers who need to decide whether encrypted files are enough for their business, customer data, or compliance needs. You’ll learn what file encryption means in plain language, where it sits in a typical system, when it helps, when it doesn’t, and the practical steps teams usually take to use it safely.
TL;DR — File encryption turns readable file contents into unreadable data unless someone has the right key (a secret used to lock and unlock data). The most important takeaway is this: encryption protects files best when a device is lost, a disk is stolen, or storage is breached — but it does not stop an already signed-in app or user from reading the file. Reading time: ~7 min
What it is and where it sits
When people say a file is "encrypted," they mean the file’s contents have been transformed so they look like random noise to anyone without the decryption key.
In plain language:
- Unencrypted file: anyone or any system with access to the storage can read it directly.
- Encrypted file: the storage still holds the file, but what it holds is scrambled data. To get the original file back, software must use the right key.
This matters in data protection because files live in more places than people expect: on laptops, servers, cloud object storage, backups, synced folders, and temporary caches. Encryption is one control in that chain.
Where encryption sits in a typical system
There are two common places file encryption shows up:
-
Encryption at rest (stored data on disk or in cloud storage)
- Example: a PDF saved in cloud storage is encrypted before or while it is written to disk.
- Protects against stolen drives, storage snapshots, and some types of provider-side breach.
-
Encryption in transit (data moving over the network)
- Example: a browser uploads a file over HTTPS (web encryption) to your app.
- Protects against eavesdropping while the file travels.
People often mix these up. HTTPS does not mean the stored file is encrypted after upload. It only protects the trip.
What talks to it, what it replaces, where it lives
In a normal upload flow:
- A browser or mobile app sends a file.
- The web app receives it.
- The app stores it in disk storage, object storage (a file store like S3-compatible buckets), or a database.
- An encryption layer may sit:
- in the storage provider,
- in the server’s filesystem,
- or inside the app itself before the file is saved.
What it replaces depends on the design:
- Provider-managed encryption replaces plain storage with encrypted storage, usually with little app change.
- App-level encryption replaces "save raw file bytes" with "encrypt bytes, then save ciphertext (encrypted output)."
A simple flow looks like this:
View as text
[User Browser] ---- 1. HTTPS upload ----> [Web App] [Web App] ---- 2. encrypt or hand off ----> [Storage Layer] [Storage Layer] ---- 3. write encrypted data ----> [Disk/Object Store] [Web App] <---- 4. read + decrypt on access ---- [Storage Layer] [User Browser] <---- 5. download file ---- [Web App]
The key architectural question is: who holds the key?
- If your cloud/storage provider holds it, setup is easier.
- If your app holds it, you get more control, but more operational burden.
- If only the end user holds it, privacy is strongest, but features like search, previews, and server-side processing become harder.
How it actually works
Let’s walk one realistic example through the system.
Example: a customer uploads a signed contract PDF
Imagine a customer portal where users upload signed contracts. Your team wants those files protected if the storage bucket is exposed or a backup is stolen.
Step by step:
-
The user uploads
contract.pdfover HTTPS- The browser sends the file to your app over TLS (the encryption used by HTTPS).
- This protects the file while it moves across the internet.
-
Your app receives the readable file
- At this moment, the app can read the file normally.
- If the app is compromised right now, encryption at rest will not save you; the app already has the plaintext (readable original data).
-
The app or storage layer encrypts the file before saving
- Software generates or uses an encryption key.
- It runs the file through an algorithm such as AES-256 (a widely used encryption standard).
- The output is ciphertext — unreadable bytes.
-
The encrypted file is stored
- Disk, object storage, or backup systems now hold ciphertext, not the original PDF.
- If someone copies the raw storage contents without the key, they get useless data.
-
Metadata may stay readable
- Important detail: encryption often protects file contents, but not always everything around them.
- File name, upload time, size, owner ID, and folder path may still be visible unless you encrypt those too.
-
Later, an authorized user downloads the file
- The app checks permissions.
- The storage layer or app decrypts the ciphertext using the key.
- The user receives the original PDF.
-
Backups and replicas may also be encrypted — or not
- Good setups encrypt primary storage, backups, and snapshots.
- Weak setups encrypt only the main copy and forget the backup chain.
The key point most people miss
Encryption protects stored bytes, not business logic.
If your app says, "this logged-in staff member may open this contract," the app will decrypt it for them. So encryption is not a replacement for:
- access control (who is allowed in),
- audit logs (who opened what),
- malware protection,
- secure backups,
- or least privilege (giving people only the access they need).
When to use it (and when not to)
For a software agency customer, the decision is usually less about "is encryption good?" and more about which layer you need.
| Scenario | Recommendation |
|---|---|
| You store customer documents, IDs, contracts, medical, legal, HR, or financial files | Yes — use encryption at rest by default, plus HTTPS in transit |
| You use cloud object storage or managed databases | Yes — turn on provider-managed encryption first; it is the lowest-friction baseline |
| Staff laptops hold downloaded client files | Yes — use full-disk encryption on company devices |
| You need the provider to be unable to read files | Consider app-level or client-side encryption, but expect product trade-offs |
| You need server-side search, previews, OCR, or antivirus scanning on files | Provider-managed or server-side encryption is usually a better fit than end-user-only encryption |
| Your files are already public marketing assets | You probably don’t need special file encryption beyond normal HTTPS and access controls |
| Your biggest risk is staff over-access, weak passwords, or shared logins | Encryption alone will not solve that; fix identity and permissions first |
| You only want to tick a compliance checkbox | Don’t stop at encryption; regulators usually care about access, retention, deletion, and auditability too |
You probably don’t need advanced file encryption if...
- the files are intentionally public,
- your main concern is accidental sharing inside your team,
- or you are not prepared to manage keys, recovery, and access procedures.
In those cases, start with:
- HTTPS,
- strong login security,
- role-based access,
- encrypted provider storage,
- and encrypted device disks.
That gets most organizations the majority of the practical protection they need.
Trade-offs
Encryption is valuable, but it is not free.
| Benefit | What it costs |
|---|---|
| Protects files if disks, backups, or storage snapshots are stolen | Adds key management work; if keys are lost, data may be unrecoverable |
| Helps with privacy and many compliance expectations | Does not by itself prove compliance; you still need access control, retention, and logging |
| Provider-managed encryption is easy to enable | Gives you less control over keys and may increase vendor dependence |
| App-level encryption gives stronger separation from the storage provider | More engineering complexity, harder debugging, and more chances to break features |
| End-user-held keys maximize privacy | Search, previews, thumbnails, deduplication, and server-side processing become difficult or impossible |
| Encrypted backups reduce breach impact | Backup restore procedures become more complex and must be tested |
| Can reduce breach severity | Usually adds some CPU work and small latency during upload/download |
The biggest operational risk: key management
The hard part is rarely the algorithm. It is the key lifecycle:
- where keys are stored,
- who can use them,
- how they rotate (are replaced safely),
- how they are backed up,
- and what happens if a key is exposed.
A simple rule: if your team cannot clearly answer "where are the keys, who can use them, and how do we recover after a mistake?" then your encryption plan is incomplete.
In practice
Below are two practical examples teams commonly use today.
Example 1: Encrypt a file with OpenSSL before storing or sending it
⚠️ If you lose the password or key used here, the file may be permanently unreadable. Test with a copy of a file first, not your only copy.
openssl enc -aes-256-cbc -pbkdf2 -salt -in contract.pdf -out contract.pdf.enc
This command reads contract.pdf, encrypts it with AES-256-CBC, and writes the encrypted result to contract.pdf.enc. The gotcha: OpenSSL will prompt for a password, and that password now becomes part of your recovery problem — do not put it in email or a shared chat.
To decrypt it later:
openssl enc -d -aes-256-cbc -pbkdf2 -in contract.pdf.enc -out contract-restored.pdf
This reverses the process and restores the original file. The gotcha: if the wrong password is entered, decryption fails or produces unusable output.
Example 2: Encrypt files in application code before upload
import { randomBytes, createCipheriv } from "crypto";
import { readFileSync, writeFileSync } from "fs";
const key = randomBytes(32); // 32 bytes = 256-bit key
const iv = randomBytes(12); // nonce/IV for GCM mode
const plaintext = readFileSync("contract.pdf");
const cipher = createCipheriv("aes-256-gcm", key, iv);
const encrypted = Buffer.concat([cipher.update(plaintext), cipher.final()]);
const tag = cipher.getAuthTag();
writeFileSync("contract.pdf.enc", Buffer.concat([iv, tag, encrypted]));
console.log("Save this key securely:", key.toString("hex"));
This Node.js example encrypts a PDF using AES-256-GCM (an encryption mode that also detects tampering). The gotcha: the printed key is extremely sensitive; in a real app, store it in a proper secret manager or key management service, not in logs or source code.
Dashboard-first actions most teams actually take
If you are using a cloud provider or managed storage, the usual first step is not custom code. It is:
- in your provider’s dashboard, open your storage service,
- open the bucket/container or volume settings,
- look for Encryption, Default encryption, or Server-side encryption,
- enable it for the storage location that holds uploaded files,
- then verify backups/snapshots have encryption enabled too.
Because provider screens vary, the exact path differs, but it is typically under the storage resource’s Settings or Properties page. If you cannot find it, search your provider docs for the storage product name plus "default encryption".
Further reading
- NIST SP 800-57 Part 1: Recommendation for Key Management
- OWASP Cryptographic Storage Cheat Sheet
- The "HTTP Encryption" and "TLS" sections of the MDN Web Docs
- libsodium documentation, especially the "Secret-key cryptography" section
- Practical Cryptography by Niels Ferguson and Bruce Schneier
This article was written by an AI system and published pending human review. Verify anything you intend to act on.
Have a project in mind?
Get an instant AI price estimate for it, or talk directly to our team.
One email a month on what we learn building with AI