Data protection: encryption, masking and data classification
Encryption at rest with Shield Platform Encryption (probabilistic vs deterministic, key management, BYOK and cache-only keys), classic encrypted fields, data classification, and masking sandbox data.
Simple explanation
Defaults: data is encrypted in transit (TLS) and Salesforce encrypts data at rest in its infrastructure. Customers who need control over keys or to encrypt specific fields use Shield Platform Encryption.
Shield Platform Encryption
- Encrypts chosen fields, files and attachments (and some other data) at rest, transparently for authorised users.
- Probabilistic encryption: strongest, but the field can't be filtered, sorted or used in most queries.
- Deterministic encryption: allows exact-match filtering (case-sensitive or insensitive), slightly weaker.
- Key management: tenant secrets generated by Salesforce, BYOK (bring your own key material) or cache-only keys fetched from your key service at runtime (you can cut access by withholding the key).
- Encryption policy decides which fields; turning it on has functional impact (reports, formulas, search, some features) that must be tested.
Classic encrypted text fields: masked display for a few values, limited and separate from Shield.
Data classification: field metadata for sensitivity and compliance categories to document where personal and regulated data lives.
Sandboxes: full copies contain production data; use Data Mask (or equivalent) to anonymise personal data in non-production orgs.
Real-world analogy
Probabilistic encryption is a safe deposit box with a new random lock every time: very secure, but you can't search through the boxes. Deterministic encryption uses the same lock pattern for the same contents, so you can find "all boxes with X" by matching the pattern, at a small cost in secrecy. Cache-only keys mean you keep the master key at home: the bank can't open anything without asking you.
Worked example
Health insurer:
- Shield Platform Encryption for
National_Id__c(deterministic, needed for exact-match lookups during claims), diagnosis notes (probabilistic), and case attachments. - BYOK with key material from the insurer's HSM; key rotation every 12 months.
- Functional test plan covering reports, list views, duplicate rules and integrations before enabling each field.
- Data Mask run after every full sandbox refresh; developers never see real patient data.
Diagram
Key points
- Shield Platform Encryption for field, file and attachment encryption at rest with key control.
- Probabilistic (strongest, no filtering) vs deterministic (exact-match filtering).
- Keys: tenant secrets, BYOK, cache-only keys; plan rotation.
- Test functional impact before encrypting fields.
- Data classification metadata documents sensitive fields.
- Mask personal data in sandboxes.
Limits and gotchas
- Encrypted fields can break formulas, reports filters, sorting, search and some features; check the compatibility list for each field β verify.
- Destroying key material makes data unreadable permanently; follow strict key management procedures.
- Encryption is not access control: authorised users (and integrations) see decrypted values. Permissions still matter.
- Shield is a paid add-on; Data Mask is licensed separately β verify packaging.
π€ How to say this in an interview
Explain why a field needs encryption (regulation, contracts, key control), pick deterministic vs probabilistic per field with a reason, and show you'd test functional impact and manage keys. Interviewers like the point that encryption doesn't replace permissions.
Common follow-ups
Does Shield encryption protect data from an admin?
Not by itself: users with access to the field see decrypted data. Combine with field-level security, permission reviews and monitoring. Cache-only keys protect against data access when you withhold keys at the infrastructure level.
Which fields would you avoid encrypting?
Fields used heavily in filters, sorting, formulas or reporting, unless deterministic encryption supports the use. Encrypt what regulation or risk requires, not everything.