What if your private secrets were left unprotected, just waiting for someone to steal them?
Why Encryption at rest and in transit in HLD? - Purpose & Use Cases
Imagine you have a treasure chest full of valuable letters and you keep it in your house. You also send some letters to your friend through a regular mail service. You worry someone might open your chest or read your letters while they travel.
Without proper protection, anyone who breaks into your house can read your letters in the chest. Also, letters sent through mail can be intercepted and read by strangers. Manually trying to guard every letter or package is slow, risky, and often fails to keep secrets safe.
Encryption at rest locks your treasure chest with a strong lock so even if someone breaks in, they can't read the letters. Encryption in transit wraps each letter in a secure envelope that only your friend can open, protecting it while it travels.
Store data directly on disk
Send data over network as plain textEncrypt data before saving to disk Use secure protocols (like TLS) to send data
It enables secure storage and communication so sensitive information stays private and safe from attackers everywhere.
When you shop online, your credit card info is encrypted before saving on servers and also encrypted while traveling from your browser to the store, keeping your payment details safe.
Manual protection of data is unreliable and risky.
Encryption at rest secures stored data from unauthorized access.
Encryption in transit protects data while it moves between systems.
Practice
encryption at rest in system design?Solution
Step 1: Understand encryption at rest
Encryption at rest means encrypting data when it is stored on disks or databases to prevent unauthorized access.Step 2: Identify the main goal
The main goal is to protect stored data from being read by unauthorized users if the storage is compromised.Final Answer:
To protect stored data from unauthorized access -> Option AQuick Check:
Encryption at rest = Protect stored data [OK]
- Confusing encryption at rest with encryption in transit
- Thinking encryption at rest speeds up data
- Mixing encryption with user authentication
encryption in transit?Solution
Step 1: Identify encryption in transit protocols
Encryption in transit protects data moving over networks. TLS is the standard protocol for this purpose.Step 2: Differentiate options
AES-256 is a symmetric encryption algorithm (used for data at rest), SHA-256 is a hash function, RSA is an encryption algorithm but not a protocol for transit encryption.Final Answer:
TLS (Transport Layer Security) -> Option BQuick Check:
Encryption in transit = TLS protocol [OK]
- Confusing encryption algorithms with protocols
- Choosing AES or RSA as transit protocols
- Mixing hash functions with encryption
Solution
Step 1: Analyze encryption at rest with AES-256
AES-256 encrypts data stored on disk, protecting it from unauthorized access.Step 2: Analyze encryption in transit with TLS
TLS encrypts data moving over the network, preventing interception or tampering.Step 3: Combine both protections
Using both means data is secure when stored and when sent, covering both attack surfaces.Final Answer:
Data is protected both when stored and when transmitted -> Option CQuick Check:
AES-256 + TLS = Full data protection [OK]
- Assuming TLS speeds up transmission
- Thinking encryption only protects passwords
- Ignoring encryption in transit
Solution
Step 1: Understand difference between HTTP and HTTPS
HTTP transmits data in plain text, while HTTPS uses TLS to encrypt data in transit.Step 2: Identify the problem with using HTTP
Using HTTP means data is sent unencrypted, vulnerable to interception and attacks.Final Answer:
Data is not encrypted during transmission -> Option AQuick Check:
HTTP = no encryption in transit [OK]
- Confusing encryption at rest with in transit
- Assuming HTTP encrypts data
- Thinking keys are exposed due to HTTP
Solution
Step 1: Identify strong encryption for data at rest
AES-256 is a widely accepted strong encryption standard for stored data.Step 2: Choose secure protocol for data in transit
TLS 1.3 is the latest secure protocol for encrypting data during transmission, better than older SSL versions.Step 3: Evaluate other options
SHA-256 is a hash, not encryption; HTTP is unencrypted; VPN alone does not encrypt stored data; SSL 2.0 is outdated and insecure.Final Answer:
Encrypt data at rest with AES-256 and use TLS 1.3 for all client-server communication -> Option DQuick Check:
AES-256 + TLS 1.3 = Best practice for confidentiality [OK]
- Using outdated SSL instead of TLS
- Confusing hashing with encryption
- Relying only on VPN without encryption
Ready to prove it?
Pass the test and this pattern moves unknown
