Shield Platform Encryption

What Shield Platform Encryption encrypts, the two schemes, key management, the functionality a field loses when encrypted and what can be undone.

Encrypting a field costs functionality, and some losses cannot be undone. What exactly does Shield Platform Encryption encrypt, what stops working, and on what criterion do you decide whether a field gets encrypted?

What it encrypts

It encrypts sensitive data at rest, not just when it travels over a network. The architecture decision starts by choosing between its two scopes.

Database Encryption encrypts most of the data in the transactional database, at the data tier, with a key of the org’s own. What matters to whoever is designing: it does not impede filtering or sorting, nor the features that rely on filtering and sorting. It is available to Hyperforce customers with a Shield or Shield Platform Encryption license, and it is turned on in Encryption Settings with the Encrypt the Transactional Database option. Salesforce begins encrypting new changes 24 hours later; how long the full re-encryption takes depends on the volume already there.

Help does not agree with itself: two articles say “most” of the data and two others say the “entire” database. This page keeps “most”, which is what the two articles dedicated to the scope say.

Field-level encryption (FLE) encrypts individual standard and custom fields, at the app tier and before the data is stored, with key material the customer controls. It is the one that brings limitations, depending on the scheme chosen. The two scopes combine: Database Encryption is then applied afterwards.

Beyond the two, encryption reaches other stores, each with different keys.

What else is encrypted
Files and attachments Salesforce search indexes, for keyword searches
Chatter data CRM Analytics datasets
Data 360 data stores, vector-based indexes included Event Bus data
Archives made with the Archive app Backups made with Backup & Recover Next
Custom fields in supported managed packages Fields in the Salesforce B2B Commerce package

Data 360 is Salesforce’s data platform, where data from several systems is unified.

The two schemes

An encryption scheme is the rule by which a value becomes ciphertext, and it is chosen field by field.

The probabilistic scheme is the default: each bit of data is turned into a fully random ciphertext string every time it is encrypted. An authorized user is not affected by that. It matters when logic is executed in the database, or when encrypted values are compared to a string or to each other: with the data turned into random, patternless strings, filtering is not possible. Help’s example is a SOQL query against Contact with LastName = 'Smith': if that field is encrypted this way, the query cannot run.

The deterministic scheme addresses that problem. With it, users can filter records in reports and list views even when the field is encrypted; it supports WHERE clauses in SOQL, unique and external ID fields, and single-column indexes and single and double-column unique indexes. It uses AES with 256-bit keys, CBC mode and a static initialization vector. It has two variants, field by field: case-sensitive, and exact-match case-insensitive.

The price is synchronization: when you apply it to a field, or change from one variant to the other, you have to synchronize the data so that filters and queries produce accurate results.

Why a field's encryption scheme gets changedShield Platform Encryption encrypts with the probabilistic scheme by default: each value is turned into a different, random ciphertext string every time it is encrypted. That is why a field encrypted with that scheme can't be used in a SOQL WHERE clause, in a grouping, or in the filter criteria of the data management tools. The deterministic scheme addresses that problem and allows filtering on the field in reports and in list views. The price is that, when you apply a deterministic scheme or change from one variant to the other, you have to synchronize the field's data so that filters and queries produce accurate results.Probabilistic:the defaultNo filtering,no groupingDeterministic:filtering worksNeeds adata sync

The keys

Key material is never saved or shared across orgs. By default a key derivation function (KDF) derives the data encryption key (DEK) from a primary secret for each release and the org’s own key material, and stores it in an encrypted cache: DEKs are never written to disk. You can opt out of derivation key by key.

There are three options for controlling that material: Bring Your Own Key (BYOK), to upload your own; External Key Management; and the Cache-Only Key Service. The last two store the DEK outside Salesforce, in a key service the customer controls, and fetch it on demand.

The tenant secret is the customer’s material that gets combined with the primary secret. It lives on TenantSecret, the API object from which an authorized developer generates, rotates, exports, destroys, reimports and uploads them.

Permissions go by task. Viewing setup needs Customize Application and View Setup and Configuration; working with tenant secrets and key material needs Manage Encryption Keys, as does querying TenantSecret through the API; BYOK certificates also need Manage Certificates. Salesforce enables Customize Application and Manage Certificates for the System Administrator profile, so it pays to watch that activity with the Setup Audit Trail, the log of configuration changes.

What changes in the org

Encryption costs functionality. This is what Help documents as a limitation.

Limitation Scope
The field can’t be used in criteria-based sharing rules, similar opportunities searches or external lookup relationships Any encrypted field, standard or custom
It doesn’t work in filter criteria for data management tools, nor in MAX(), MIN() and COUNT_DISTINCT(), nor in WHERE, GROUP BY and ORDER BY in SOQL and SOSL Probabilistic scheme only; with deterministic, WHERE does work on non-formula fields
Records can’t be sorted in list views by the field Any field holding encrypted data, with either scheme
Fields with the Unique or External ID attribute can’t be encrypted Probabilistic scheme only
Fields on external data objects, fields used in an account contact relation and custom metadata types can’t be encrypted Always
Only 80 fields deploy at a time in a package; with 80 or more configured, the deployment goes in phases Always, with encryption on
Report charts and dashboard components displaying encrypted values might be cached unencrypted Always
Paused flow interviews can save the data unencrypted when serialized Always

The Email field on the User object deserves its own paragraph. If it is encrypted with field-level encryption, the org stops receiving Salesforce’s critical product and service notifications, including emails about org migrations. Login Discovery Handler lookups that rely on email stop working, which can block logins, and calendar invitations can be interrupted. It is no good as a report filter either.

On performance, Help says users are unlikely to notice a difference, and recommends turning it on first in a full copy sandbox: a copy of the org with all its data. If many fields across several objects have to be encrypted or decrypted, it recommends batching, because otherwise searching and retrieving results is degraded for longer than is optimal. Database Encryption is transparent and does not suffer that.

What can be undone

Field encryption is turned on and off field by field; file encryption is all or nothing. Disabling needs Customize Application.

When you turn it off, the data is mass-decrypted automatically as soon as the change is saved, and the functionality the encryption limited is restored. Salesforce notifies you by email when it finishes, or if errors prevented some value from being decrypted. Those errors are most common on fields included in indexes and on those using case-insensitive deterministic encryption; if some values are not decrypted, Help points to Salesforce Customer Support. Decryption takes longer if the key has been archived.

Two cases do not decrypt on their own. Long text area and rich text area fields can’t be decrypted automatically. And data encrypted with a destroyed key can’t be mass-decrypted: the search terms stay in the index, but the data tied to that key can no longer be decrypted. No official source publishes a way to recover it; that none exists is this page’s reading of that silence, not a sentence from Help, and that is why destroying a key is treated here as an operation with no way back. If you can’t access the data after turning encryption off, Help points to Salesforce.

Example: encrypting an account number at a private bank

A private bank has to encrypt the account holder’s account number and keep its change history for the regulator. The case is invented; the order of the steps is this page’s proposal, not a sequence from Help.

  1. See what depends on the field. If it is used in a criteria-based sharing rule, encrypting it breaks that with either scheme. If it is used in a list-view filter, in a report or in a WHERE clause, the probabilistic scheme breaks it and the deterministic one does not.
  2. Choose the scheme with that in front of you. If the field has to be filtered on, pick deterministic and count the data sync as part of the work.
  3. Test in a full copy sandbox. Encrypt the field there and run the reports and integrations that touch it.
  4. Settle the history before encrypting. If a Field Audit Trail policy already archives that field, what is archived so far will stay unencrypted, and encrypting it means asking Salesforce.
  5. Count the fields in the deployment. With 80 encrypted fields or more, the package deploys in phases.

The example does not claim that encryption covers the earlier archive: step 4 exists because it does not.

When to encrypt a field

The criterion below is this page’s reasoning: no source publishes a decision tree for choosing which field to encrypt.

Situation What to do
The requirement is “all data encrypted at rest” and the org is on Hyperforce Database Encryption: it encrypts most of it without touching filters or sorts
One field is sensitive and its key has to be controlled Field-level encryption, with the scheme that allows what the business needs
The field is used in a criteria-based sharing rule Don’t encrypt it with field-level encryption: no scheme allows it
The field is filtered on in reports or list views Field-level encryption with the deterministic scheme, and synchronize the data
The field is the Email on the User object Weigh the cost first: critical Salesforce notifications are lost and logins can be blocked
It is not clear which fields are sensitive Inventory them first; the Data Classification page of this subcategory covers that inventory

Before production

  1. Decide between Database Encryption and field-level encryption, and check whether the org is on Hyperforce (see “What it encrypts”).
  2. List the candidate fields and see whether any is used in criteria-based sharing, filters, sorts or queries (see “What changes in the org”).
  3. Choose each field’s scheme and plan the deterministic sync (see “The two schemes”).
  4. Decide explicitly whether to encrypt the Email field on the User object, knowing that critical Salesforce notifications are lost (see “What changes in the org”).
  5. Turn encryption on first in a full copy sandbox and test reports and integrations (see “What changes in the org”).
  6. Decide what to do with what Field Audit Trail has already archived before encrypting its fields (see “Example”).
  7. Split the permissions by task and treat key destruction as irreversible (see “What can be undone”).

Official sources

Back to the knowledge base