Verified by Garnet Grid

Data Encryption at Rest & in Transit

Implement encryption across your stack. Covers TLS configuration, at-rest encryption, key management, envelope encryption, database encryption, and certificate management.

Encryption protects data from unauthorized access even when other controls fail. If an attacker gains access to your database files, encryption at rest makes them unreadable. If an attacker intercepts network traffic, encryption in transit (TLS) makes it unintelligible. Encryption isn’t a nice-to-have — it’s a regulatory requirement for virtually every compliance framework.


Encryption Overview

TypeWhat It ProtectsHowExample
In transitData moving between systemsTLS 1.3HTTPS, database connections
At restData stored on diskAES-256Database files, S3 objects
In useData being processedConfidential computingEnclaves, secure memory
Application-levelSpecific fieldsField-level encryptionCredit cards, SSN

TLS Configuration

# Modern TLS config (nginx)
server {
    listen 443 ssl http2;
    
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:
                ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384;
    ssl_prefer_server_ciphers off;
    
    # HSTS (force HTTPS for 1 year)
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
    
    # OCSP stapling
    ssl_stapling on;
    ssl_stapling_verify on;
    
    # Certificate
    ssl_certificate /etc/ssl/certs/fullchain.pem;
    ssl_certificate_key /etc/ssl/private/privkey.pem;
}

Envelope Encryption

┌─────────────────────────────────────────────┐
│ Data Encryption Key (DEK)                    │
│ • Encrypts your actual data                  │
│ • Unique per record/file                     │
│ • Stored ENCRYPTED alongside data            │
└──────────────────┬──────────────────────────┘
                   │ encrypted by

┌─────────────────────────────────────────────┐
│ Key Encryption Key (KEK)                     │
│ • Encrypts the DEK                           │
│ • Stored in KMS (AWS KMS, GCP KMS, Vault)    │
│ • Never leaves KMS in plaintext              │
└─────────────────────────────────────────────┘

Advantage: Rotate KEK without re-encrypting all data.
           Only re-encrypt the DEK headers.

Database Encryption

ApproachCoveragePerformance ImpactKey Management
Full disk encryptionEverything on disk~5% overheadOS-level or cloud provider
Transparent Data Encryption (TDE)Database files~5-10% overheadDatabase manages keys
Column-level encryptionSpecific sensitive columnsPer-query overheadApplication manages keys
Application-level encryptionSelected fields before storageApplication overheadApplication manages keys

Anti-Patterns

Anti-PatternProblemFix
TLS 1.0/1.1Known vulnerabilitiesTLS 1.2 minimum, TLS 1.3 preferred
Self-signed certs in productionNo trust verificationLet’s Encrypt or commercial CA
Encryption keys in codeKeys exposed in repoKMS (AWS KMS, Vault, GCP KMS)
Same key for everythingOne compromise exposes all dataEnvelope encryption, key-per-resource
No key rotationCompromised key used foreverAutomate rotation every 90 days

Checklist

  • TLS 1.2+ on all external and internal connections
  • HSTS enabled with long max-age
  • Certificates: automated renewal (Let’s Encrypt / ACM)
  • At-rest encryption: enabled on all databases and storage
  • Envelope encryption for sensitive application data
  • Key management: KMS, not in code/config files
  • Key rotation: automated, every 90 days
  • Database connections: SSL/TLS required, no plaintext
  • Audit: log all key usage and access

:::note[Source] This guide is derived from operational intelligence at Garnet Grid Consulting. For security consulting, visit garnetgrid.com. :::

Jakub Dimitri Rezayev
Jakub Dimitri Rezayev
Founder & Chief Architect • Garnet Grid Consulting

Jakub holds an M.S. in Customer Intelligence & Analytics and a B.S. in Finance & Computer Science from Pace University. With deep expertise spanning D365 F&O, Azure, Power BI, and AI/ML systems, he architects enterprise solutions that bridge legacy systems and modern technology — and has led multi-million dollar ERP implementations for Fortune 500 supply chains.

View Full Profile →