#1 India's Top IT Training Institute
×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
Mentors

Mentors

Meet the industry experts who train and guide you through your course.

Read More →
Free Resources

Free Resources

Free tutorials, interview questions, tools and calculators to help you learn.

Explore →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →

Data Encryption at Rest and in Transit

What Is Data at Rest and Data in Transit?

Data at rest refers to information stored on a device or server, such as files on a hard drive or database records, while data in transit refers to data actively moving across a network, such as an email being sent or a file being uploaded.

Encrypting Data at Rest

Encrypting data at rest protects stored information from being read if a storage device is stolen, lost, or accessed without authorization, typically using full-disk encryption or database-level encryption.

Encrypting Data in Transit

Encrypting data in transit protects information as it travels between systems, commonly implemented using protocols like TLS, preventing attackers from intercepting and reading data while it is being transmitted.

StateRisk if UnencryptedCommon Protection
At RestTheft of storage device, unauthorized file accessFull-disk or database encryption
In TransitInterception, eavesdroppingTLS/SSL, VPN

Why Both Are Necessary

Protecting data in only one state leaves a gap - encrypting data in transit but not at rest still leaves stored files vulnerable, and vice versa, so a complete strategy addresses both.

Encrypting data wherever it lives is only half the equation - that protected data must also be reliably recoverable, which is where secure backup strategies come in.

How Encryption at Rest Works Behind the Scenes

Most platforms use a pattern called envelope encryption. The data itself is encrypted with a data encryption key (DEK), usually a symmetric AES key, because symmetric ciphers are fast for large volumes. The DEK is then encrypted with a key encryption key (KEK) held in a key management service or hardware security module. Only the wrapped DEK is stored next to the data.

  1. The application or storage layer asks the key service for a new DEK.
  2. Data is encrypted with the DEK, and the plaintext key is wiped from memory after use.
  3. The encrypted DEK is saved with the data.
  4. To read, the system sends the wrapped DEK to the key service, which checks permissions and returns it unwrapped.

This design means rotating the master key does not require re-encrypting every file, and access to the key service can be logged and revoked separately from access to storage.

Protecting Data in Transit in Practice

For web traffic, TLS is configured on the server or load balancer. A safe baseline is to allow only modern protocol versions, redirect plain HTTP to HTTPS and tell browsers to remember that choice. An nginx example:

server {
    listen 443 ssl;
    server_name example.com;
    ssl_certificate     /etc/ssl/certs/example.com.fullchain.pem;
    ssl_certificate_key /etc/ssl/private/example.com.key;
    ssl_protocols TLSv1.2 TLSv1.3;
    add_header Strict-Transport-Security "max-age=31536000" always;
}

Internal traffic matters too. Connections from an app to its database, cache or message broker should also use TLS, ideally with certificate verification turned on. You can confirm what a server actually offers with a read-only check:

openssl s_client -connect example.com:443 -servername example.com -tls1_2

Mistakes That Leave Data Exposed

  • Storing encryption keys in the same place as the encrypted data, such as a config file inside the same backup.
  • Disabling certificate verification in code to "fix" a connection error, which removes protection against impersonation.
  • Encrypting the main database but forgetting log files, exports, temporary files and backups.
  • Keeping old protocol versions enabled for a single legacy client long after it is gone.
  • Never rotating keys or certificates, so a leaked key stays useful indefinitely.
ChoiceWhen it helpsLimitation
Full-disk encryptionLost or stolen laptops and drivesNo protection once the system is running and unlocked
Database or column encryptionSensitive fields such as ID numbersAdds key handling inside the application
Application-level encryptionData that even admins should not readSearching and indexing become harder

Practical Hardening Checklist

  • List where sensitive data lives, including copies and backups.
  • Use a managed key service and restrict who can use each key.
  • Enforce HTTPS everywhere and keep certificate renewal automated.
  • Turn on TLS for service-to-service and database connections.
  • Review access logs for the key service regularly and alert on unusual use.

Ready to master Cybersecurity Training Course?

Join Uncodemy's hands-on training and build real-world cybersecurity skills with expert mentors.

Explore Course