Brains4Cloud
ESEN
Practice

Topic 4 of 6

D1 · Security and compliance concepts

Encryption makes data unreadable to anyone without the key. Hashing produces a unique fingerprint that can't be reversed. They seem similar, but they solve different problems, and the exam asks about exactly that difference.

What is encryption?

Encryption turns data into something unreadable and unusable to anyone who isn't authorized. To read it, it has to be decrypted with a secret key. Even if an attacker intercepts the encrypted data, it's useless without the key.

Encryption is one of the most important technical controls for confidentiality, but not the only one: you also need access controls and policies on who can see what. And all its strength depends on the keys being protected.

Symmetric vs. asymmetric

🔑 Symmetric encryption

Uses the same key to encrypt and decrypt. Because only one key is involved, it's fast and suited to large volumes, like files on disk or database records.

Problem: distributing the key. Both parties need the same secret key, and sharing it securely, especially over a network, is hard.

🔐 Asymmetric encryption

Uses a pair of mathematically related keys: one public and one private. The private key can't be derived from the public one.

Advantage: the public key can be shared freely, which solves distribution. Anyone can encrypt with your public key, but only you, with the private key, can decrypt. It's used in HTTPS and email encryption.

SymmetricAsymmetric
KeysOne, sharedA pair: public and private
SpeedFast, suited to large volumesMore expensive
Main challengeDistributing the key securelyProtecting the private key
Typical usesDisks, databasesHTTPS, encrypted email, digital signatures

Which key is used for what

It's the most repeated question on asymmetric encryption. It depends on whether you want confidentiality or authenticity:

Send a message only the recipient can read

  1. The sender gets the recipient's public key.
  2. They encrypt the message with it.
  3. Only the recipient's private key decrypts it.

Sign to prove who's sending

  1. The sender signs with their private key.
  2. Anyone verifies the signature with the sender's public key.
  3. If it verifies, the data came from them and didn't change.

Digital signatures

Asymmetric encryption also enables signing. A digital signature proves two things at once:

Authenticity

The data comes from the expected sender.

Integrity

The data hasn't changed since it was signed.

They're used to verify software downloads, authenticate email, and secure electronic documents and transactions. Note that a signature doesn't hide the content: its goal isn't confidentiality.

Encryption by data state

At rest

Data stored on a physical device: a server disk, a database, or a cloud storage account. If someone steals the disk or accesses the account without authorization, they can't read it without the keys.

In transit

Data traveling over the internet, between services, or across a private network, which anyone observing the traffic could intercept. HTTPS is the best-known example: it uses Transport Layer Security (TLS) so nobody else can read what the browser and server exchange. The same applies between cloud services and to VPN connections over public networks.

In use

Data being processed in memory (RAM) or on the CPU. It's normally decrypted for processing, which opens an exposure window. Confidential computing creates protected environments (secure enclaves) where it's processed without being exposed to the operating system or the hypervisor. This matters especially in multitenant environments, where several customers share the same hardware.

Key management

Encryption is only as secure as its keys. A stolen or exposed key puts the data within the attacker's reach and defeats the encryption. Key management covers how keys are generated, stored, protected, rotated, and retired. Best practices:

Separate keys and data

If they're together, whoever accesses one has both.

Dedicated hardware

HSMs (hardware security modules) are tamper-resistant devices designed to store keys.

Rotate keys

Changing them periodically limits the data exposed if one is compromised.

Control access

Only authorized users and systems, with strong authentication and least privilege.

→

In Azure: centralizes keys, certificates, and secrets, reduces the risk of exposing them, supports rotation, and integrates with other services to encrypt without exposing the key to code or administrators.

Hashing

Hashing turns any input into a fixed-length string called a hash (or digest). It's one-way: it can't be reversed to get the original.

No keys

There's nothing to decrypt: a hash doesn't "open".

Deterministic

The same input with the same algorithm always gives the same hash: it's a reliable fingerprint.

Sensitive to changes

If the data changes, the hash changes. That's why it works for integrity checks.

EncryptionHashing
Uses a key?YesNo
Reversible?Yes, with the keyNo
Output lengthDepends on the dataFixed
Typical useProtecting data that will be read laterStoring passwords and verifying integrity

Passwords and salting

1

Store the hash, not the password

The system stores only the hash. At sign-in, it hashes what the user types and compares it with the stored one. The real password is never stored or transmitted in plain text.

2

If the database is stolen, they only get hashes

That's far more secure than storing plain-text passwords.

3

The risk: precomputed tables

Because the hash is always the same, an attacker can precompute hashes for millions of common passwords and look for matches (rainbow tables or dictionary attacks).

4

The fix: salt

A random, unique value (salt) is added to each password before hashing. Two users with the same password end up with different hashes, and the attacker would need a separate table for every possible salt.

Salting is a standard practice and required in any properly implemented authentication system.

Exam scenarios

NeedAnswerWhy
Protect a disk's files in case it's stolenEncryption at restWithout the keys, whoever has the disk can't read the data.
Stop anyone from reading what travels between the browser and the siteEncryption in transit (HTTPS/TLS)It prevents intercepted traffic from being read.
Process sensitive data without exposing it to the hypervisorConfidential computing (in use)It uses secure enclaves protected even from the operating system.
Prove a document was sent by a person and wasn't alteredDigital signatureIt proves authenticity and integrity.
Store user passwordsHashing with saltThe password isn't stored and precomputed tables don't work.
Check that a download wasn't modifiedCompare the hashIf the file changes, the hash changes.
Centralize keys, certificates, and secrets in AzureAzure Key VaultA managed key management service.

Common exam traps

❓ "The original value can't be recovered." Encryption or hashing?

Hashing. Encryption can always be reversed with the right key.

❓ Which key encrypts a message so only the recipient can read it?

The recipient's public key. Only their private key decrypts it. Signing works the other way: the sender uses their private key.

❓ Does HTTPS protect data at rest?

No. HTTPS (TLS) encrypts data in transit. Data at rest is encrypted in storage.

❓ Does hashing use a secret key?

No. Hashing uses no keys; encryption does.

❓ Does a digital signature hide the document's content?

No. It proves authenticity and integrity, not confidentiality.

❓ Which data state does confidential computing protect?

Data in use, being processed in memory or on the CPU.

❓ What is the salt for?

So identical passwords produce different hashes and precomputed tables stop working.

Did you get this topic?

Test what you just learned

An application stores user passwords. If the database is stolen, they want it to be very hard to use precomputed tables to discover the passwords. What should they apply?

Ready to test "Encryption, hashing, and digital signatures"?

Original questions, each with a full explanation.

Start a mock exam