Topic 35

Encryption and Secrets

Concept

IAM controls who can reach your data. But what if someone gets through anyway — a stolen disk drive, a compromised connection, an insider threat? When access controls fail, the last line of defence is making the data itself unreadable. That is what encryption does.

Two complementary ideas work together here. Encryption scrambles data so that only someone holding the right key can read it. Secret management keeps those keys — and also passwords, API keys, and tokens — locked away so they cannot be stolen separately. Neither is complete without the other.

Think of a locked safe. A thief who steals the safe gets nothing without the combination. But if you tape the combination to the outside of the safe, the lock is pointless. Encryption is the safe; secret management is keeping the combination on a guarded key-ring, not taped to the door.

Encryption at Rest

Encryption at rest means data is scrambled while it is sitting on a disk. If someone physically steals a hard drive from a data center, the data on it is gibberish without the decryption key. Cloud providers encrypt stored data by default in most services — you generally get this protection without thinking about it, but it is important to know it is there and why it matters. The full mechanism of how encryption works is a deep-dive topic; the key takeaway is: a stolen copy of the data is useless without the key.

Encryption in Transit

Encryption in transit means data is scrambled while it is moving over the network — from your browser to a web server, from one service to another, from a server to a database. The familiar padlock icon in a browser's address bar is the visible sign of this: the connection between your device and the website is encrypted using a standard called TLS. Data intercepted mid-journey is scrambled and unreadable to the interceptor.

Keys: Encryption Depends on Them

Encryption works by combining data with a secret piece of information called a key. Lock the data with the key, and only the same key can unlock it. This raises an obvious question: how do you keep the key safe? A cloud provider could manage keys for you automatically — convenient, but you are trusting them entirely. Or you can manage your own keys using a dedicated service, giving you more control over who can access them and when they can be revoked. Managing encryption keys is its own discipline; cloud providers offer key management services specifically for this job.

Secrets: Passwords and Keys Must Never Be Hard-Coded

Secrets — passwords, API keys, tokens, database credentials — are the pieces of information that grant access to something. They are extremely sensitive, and the number-one mistake with them is writing them directly into application code. Code gets shared with colleagues, committed to version control, copied into emails, and occasionally posted publicly. Any secret in the code is exposed the moment the code is. The right approach is a dedicated secrets vault: a locked service that stores secrets, controls which application or person can retrieve them, and keeps an audit log of every access. When a secret needs to be rotated — changed because it may have been exposed — a vault makes it a single operation rather than a hunt through dozens of files.

Three layers of data protection
Encryption at rest
data scrambled on disk — a stolen drive is unreadable without the key
Encryption in transit
data scrambled over the network — an intercepted connection is unreadable
Keys and secrets vault
encryption keys and passwords stored in a locked, audited service — not in code
Key managementAWS KMS (Key Management Service)Google Cloud Cloud KMSAzure Azure Key Vault
SecretsAWS Secrets ManagerGoogle Cloud Secret ManagerAzure Azure Key Vault (covers both keys and secrets)
Common Confusions
  • "Encryption makes me unhackable." It protects data confidentiality — a stolen or intercepted copy is unreadable. It does not stop attackers from getting in through other means, like weak access controls or social engineering. Encryption is one layer, not a complete shield.
  • "The padlock means the site is trustworthy." The padlock means the connection between your browser and the site is encrypted — that is all. It says nothing about whether the site is honest, legitimate, or secure on its own end. A fraudulent site can have a padlock.
  • "It's fine to put a database password in the code for now." Code leaks — through version control, sharing, or accidental publication. There is no safe version of "for now" with secrets. Use a vault from the start; rotation is straightforward when the secret is in one place.
Why It Matters
  • Leaked secrets and unencrypted data are among the most common, most damaging incidents in cloud computing. Both are largely preventable with the habits described here.
  • Understanding the padlock — and what it does not promise — is everyday digital literacy, not an advanced topic. It affects every person who uses the web.
  • The two-word summary of cloud data protection: encrypt the data, vault the keys. These two ideas cover the majority of what "protecting data" means in practice.

Knowledge Check

What does "encryption at rest" protect?

  • Data traveling across the internet from a user to a server
  • Passwords and API keys saved inside an application's source code
  • Stored files on disk — scrambled so a stolen copy is useless
  • Encrypted backups sent automatically to a different region

Your browser shows a padlock next to a website's address. What does that confirm?

  • The website owner has been verified as trustworthy and legitimate
  • The connection between your browser and the site is encrypted
  • All data stored on the web server is also encrypted on disk
  • The site has passed a formal security audit and cannot be breached

Why should passwords and API keys never be written directly into application code?

  • Code containing passwords runs more slowly than code that reads from a vault
  • Encryption cannot protect keys once they are compiled into the application
  • Code gets shared and versioned — secrets inside it leak when the code leaks
  • Cloud providers automatically block any deployment that contains a plaintext secret

You got correct