π§ CTA Knowledge Bytes #9 - Security Architecture (Domain 2/8) - Encryption Strategy & Implementation
Understanding encryption isn't optional for CTAs β it's critical for compliance, security, and client trust.
Hereβs your comprehensive encryption architecture guide:
π Classic Encryption for Custom Fields
What It Is:
Built-in functionality using 128-bit AES encryption
Creates special encrypted custom text fields (175 char limit)
Provides data masking with random characters
Included in base Salesforce license (no extra cost)
When to Use:
β Masking sensitive data from internal users (SSN, credit cards)
β Budget constraints (no additional licensing cost)
β Simple field-level protection requirements
β Custom fields only (standard fields not supported)
Limitations:
β Cannot use in formula fields or workflows
β Cannot use in validation rules or reports
β 175-character limit per field
β Manual permission set configuration required
π Shield Platform Encryption Key Functionalities
1. Key Architecture:
Tenant Secret (customer-controlled) + Master Secret (Salesforce-managed) = Data Encryption Key
Key material never shared across orgs
Hardware Security Module (HSM) generates master secret
2. Encryption Schemes:
Probabilistic Encryption (Default):
Same text encrypted repeatedly yields different ciphertext
Stronger security through randomisation
β Cannot filter or sort on encrypted fields
Use case: Maximum security for non-searchable data
Deterministic Encryption:
Same text always produces same ciphertext (static IV)
β Enables filtering, sorting, and WHERE clauses
Available in case-sensitive or case-insensitive variants
Use case: Encrypted data requiring search/filter capability
3. Key Management Options:
Option A - Salesforce-Generated Keys:
Salesforce generates tenant secret
Combined with master secret for encryption
Easiest implementation path
Option B - Bring Your Own Key (BYOK):
Upload customer-generated tenant secret from external HSM
Customer controls key lifecycle
Enhanced compliance posture
Option C - Cache-Only Key Service:
Store keys externally, Salesforce fetches on demand
Keys never permanently stored in Salesforce
Ultimate customer control
4. Key Rotation:
Regular rotation without data re-encryption
New data uses new key, old data accessible with old key
Critical for security best practices
π» Using the Crypto Class for Custom Encryption
When to Use Crypto Class:
β Custom encryption logic beyond platform capabilities
β Integration with external systems requiring specific algorithms
β Encrypting data for secure transmission
β Creating message authentication codes (MACs)
β Generating cryptographic signatures
π Subscribe: gouravsood.substack.com
π― When to Use Shield Platform Encryption
Compliance Requirements:
β HIPAA (healthcare), GDPR (privacy), PCI DSS (payments)
β Financial services, government, healthcare industries
β Contractual obligations requiring encryption at rest
β Data residency and sovereignty requirements
Functional Requirements:
β Need to encrypt standard fields (Account Name, Email, etc.)
β Encrypt files, attachments, and documents
β Use encrypted data in formulas and business logic
β Search and filter on encrypted data
β SOQL queries on encrypted fields
Key Management Requirements:
β Bring Your Own Key (BYOK) for customer-controlled encryption
β Regular key rotation policies
β Separation of duties for key management
β External HSM integration needs
π‘οΈ Classic vs Shield Platform Encryption Comparison
ποΈ Encryption Architecture Decision Tree
START: Do you need encryption?
ββ No β Use Field-Level Security (FLS)
ββ Yes
ββ Custom fields only + budget constraints?
β ββ YES β Classic Encryption
ββ NO
ββ Need standard fields/files/attachments?
β ββ YES β Shield Platform Encryption
ββ Compliance requirements (HIPAA/GDPR/PCI)?
β ββ YES β Shield Platform Encryption
ββ Need custom encryption logic?
β ββ YES β Crypto Class
ββ Need search/filter on encrypted data?
ββ YES β Shield (Deterministic Encryption)π¨ Common Encryption Anti-Patterns
β Using Classic Encryption for compliance (insufficient for most regulations)
β Over-encrypting data (performance impact + complexity)
β Encrypting data needed for business processes (breaks automation)
β Not planning for key rotation (security risk)
β Hardcoding encryption keys in Apex (major security vulnerability)
β Using probabilistic encryption when filtering needed (functionality breaks)
β Not testing backup/restore with encrypted data (data recovery risk)
#CTAKnowledgeBytes #SalesforceArchitecture #EnterpriseArchitecture #AI #Agentforce
Salesforce | Salesforce Architecture Talk | Salesforce Partners | Salesforce Architects | Salesforce Admins | Salesforce Developers


