Salta ai contenuti

Tenant Secrets, Bring Your Own Key, and Who Holds Them

Questi contenuti non sono ancora disponibili nella tua lingua.

Module 4 of 7 in the chapter Encryption: Classic, Shield and Apex Crypto, chapter 18 of Securing Salesforce: Sharing and Visibility. Each module stands on its own.

The question this module answers: Shield Platform Encryption lets you control the keys. What exactly do you control, how do you look after it, what are your options for keeping the key yourself, and who on the project should hold it?

Here’s where Shield changes the conversation from module 2. Some compliance environments ask a simple question: why does a third party have control of the encryption? Why don’t you? With Classic Encryption, Salesforce holds the keys. With Shield, you hold one of them.

Think of a safe deposit box at a bank. It takes two keys. The bank keeps one, you keep the other, and the box opens only when both are turned. Shield works the same way: Salesforce has its key, you have yours, and only the two together unlock the data.

Salesforce describes it like this: “For field-level encryption and Database Encryption, it uses a derived key composed of a unique tenant secret that you control and a primary secret that Salesforce maintains” (How Shield Platform Encryption Works (opens in a new tab), Salesforce Help, checked 2026-11-26). Salesforce’s half, the primary secret, is generated “with a hardware security module (HSM) once per release during a High Assurance Virtual Ceremony.” Your half, the tenant secret, “is unique to your org. You control when it’s generated, activated, revoked, or destroyed. Salesforce doesn’t store derived DEKs” (Why Bring Your Own Key? (opens in a new tab), Salesforce Help, checked 2026-11-26). A DEK is a data encryption key, the key that actually encrypts and decrypts the data.

Two keys, one data key Two keys, one data key. On the left, two keys: your tenant secret, which you control, and Salesforce's primary secret, made once per release. In the middle, both combine into the data encryption key, which is never stored. On the right, the data encryption key encrypts and decrypts your data at rest, in fields and files. Footnote: like a safe deposit box, only both keys together open it; lose yours with no copy, and the box stays shut. {"author": "Steve Simpson", "blueprint": "1.0.0", "builder": "standard 1.59.0", "built": "2026-11-21", "id": "DGM-SVA-SD-05", "rights": "\u00a9 2026 Twinshark LLC. All rights reserved.", "template": "cells 0.5.0", "theme": "stevetecharc 1.4.0"} TWO KEYS COMBINED YOUR DATA Your tenant secret you control it Salesforce's primary secret made once per release The data encryption key made from both; never stored Your encrypted data fields, files, at rest your key their key encrypts and decrypts Like a safe deposit box: only both keys together open it. Lose yours with no copy, and the box stays shut. HOW TO READ IT the data encryption key at work © 2026 Twinshark LLC · stevetecharc.com
Click to enlarge

Now the other side of having a key. If you lose your key, you’re in trouble, and Salesforce can’t get you out of it. “Once you destroy key material, related data is not accessible unless you import previously exported key material.” And: “Salesforce can’t help you with deleted, destroyed, or misplaced tenant secrets and keys” (Destroy Key Material (opens in a new tab), Salesforce Help, checked 2026-11-26). That’s the safe deposit box too: lose your key, and the box stays shut. The control the regulator wanted you to have is the same control that lets you lock yourself out.

In my demo org, the key management page had a key I’d generated. I could export it, stash it somewhere safe, generate a new one, and archive the old one. That’s the whole life of a key, and looking after it has a name: key hygiene.

Generate. Salesforce generates the tenant secret for you, or you bring your own (below). Either way, “you manage your own key material: you can rotate it, archive it, and designate other users to share responsibility for it” (Key Management and Rotation (opens in a new tab), Salesforce Help, checked 2026-11-26).

Export, so you have a copy. “Salesforce recommends that you export your tenant secret to ensure continued access to the related data.” The file you get “is itself encrypted,” and it’s “a copy of the key material in your org” (Back Up Your Tenant Secrets (opens in a new tab), Salesforce Help, checked 2026-11-26). Over time you’ll have several, so Salesforce asks for a registry too: “due to rotation, over time you will accumulate a number of keys. You should back them up into source control, and keep an up-to-date registry of your keys outside of Salesforce” (Destroy Key Material). Wherever your organization keeps them, the point is the same: more than one copy, outside Salesforce, that the right people can find.

Rotate. You’ll have one active key and your archived keys. “Salesforce recommends that you regularly generate or upload new Shield Platform Encryption key material.” How often is your policy’s call: “To decide how often to rotate, consult your security policies.” What Salesforce sets is the minimum time between rotations, which differs by what the key protects. In production: 24 hours for fields and files with probabilistic encryption, 7 days for deterministic fields, the event bus and search indexes, and 3 months for Database Encryption (Rotate Your Encryption Key Material (opens in a new tab), Salesforce Help, checked 2026-11-26).

Archive. Rotating doesn’t re-encrypt what’s already stored. An archived key “can’t encrypt new data. The key can decrypt data that it encrypted when it was active” (same page). To bring existing data up to your newest key, you synchronize it, yourself or with Salesforce’s background encryption service, and the Encryption Statistics page shows what’s still on which key (Key Management and Rotation). Module 5 comes back to that.

Here is a rotation from start to finish, one step at a time: the active key, the copy you export, the new key rotated in, and the old records brought over when you synchronize.

Rotating a key Rotating a key, in four steps. Step 1: Key 1 is active and encrypts and decrypts your records. Step 2: export a copy of Key 1 to your exported copies, with a registry of every key, outside Salesforce. Step 3: rotate. Key 2 becomes the active key and encrypts and decrypts records saved after; Key 1 is archived and only decrypts the records it encrypted before; you export a copy of Key 2 as well. Step 4: synchronize. The records saved before are re-encrypted with Key 2, and Key 1 has nothing left to decrypt, with its copy kept outside Salesforce. Footnote: rotating doesn't re-encrypt what's stored; the archived key keeps decrypting old records until you synchronize them to the new key. {"author": "Steve Simpson", "blueprint": "1.0.0", "builder": "standard 1.59.0", "built": "2026-11-21", "id": "DGM-SVA-SD-06", "rights": "\u00a9 2026 Twinshark LLC. All rights reserved.", "template": "cells 0.5.0", "theme": "stevetecharc 1.4.0"} OUTSIDE SALESFORCE YOUR KEYS YOUR DATA Exported copies and a registry of every key Key 1 archived: decrypts what it encrypted Key 2 active rotated in Records saved before Records saved after copy kept export a copy re-encrypted on sync encrypts and decrypts Rotating doesn't re-encrypt what's stored: the archived key keeps decrypting old records until you synchronize them to the new key. HOW TO READ IT the active key at work © 2026 Twinshark LLC · stevetecharc.com
Click to enlarge

Destroy, rarely. “Only destroy Shield Platform Encryption tenant secrets and key material in extreme cases where access to related data is no longer needed.” A destroyed key “can’t encrypt or decrypt data. You can’t access encrypted data or download files and attachments encrypted with this key” (Destroy Key Material; Rotate Your Encryption Key Material). And Database Encryption is different here: you “can’t destroy key material used by Database Encryption,” and it doesn’t support exporting or importing keys either (Destroy Key Material; Back Up Your Tenant Secrets).

Generating the tenant secret in Salesforce is the simplest option. When a requirement asks for more, Salesforce lists the others (Why Bring Your Own Key?):

  • Bring Your Own Key (BYOK). You generate the key material in “the infrastructure of your choice, such as an on-premises HSM,” and upload it. “BYOK is available for field-level encryption, Database Encryption, search indexes, Backup & Recover Next, and Data 360.”
  • Opt out of key derivation. You upload the data encryption key itself, and Shield “bypasses the derivation process and uses that DEK directly.”
  • Keep it outside, and lend it on demand. “Generate and store key material outside of Salesforce by using the key service of your choice. Then use either the Salesforce External Key Management Service or Salesforce Cache-Only Key Service to fetch your key material on demand.” Salesforce holds it only in an encrypted cache for the encrypt and decrypt operations. “Cache-Only Keys isn’t available for Database Encryption.”

Why would anyone take that on? Salesforce’s answer: BYOK “gives you an extra layer of protection against unauthorized access to critical data. It can also help you meet the regulatory requirements that come with handling financial, health, or personal data” (same page). That’s the same reason we encrypt at all in module 1: someone requires it.

But notice what each step outward costs. With a cache-only key, the key isn’t stored in Salesforce: it’s fetched from your key service and kept in the cache until it’s “revoked or rotated, or until the cache is flushed,” and “Some internal operations flush the cache every 24 hours” (How Cache-Only Keys Works (opens in a new tab), Salesforce Help, checked 2026-11-26). So your key service becomes part of how your org runs. Plan its availability like any system Salesforce depends on.

So who on the project should hold it? My answer, and I said it plainly in class: chances are, we as consultants won’t be managing the keys, and we shouldn’t. I would hate to have a consultant lose a key and lock the entire org out. Let the client do the key management. Be careful putting your hands on their actual keys. That’s their IT and security team’s job.

Salesforce points the same way. “Key management begins with assigning appropriate permissions to security administrators.” Give them only to people you trust with encryption, certificates and key material, and watch their activity in the Setup Audit Trail (Key Management and Rotation). The permission is Manage Encryption Keys, and it’s a short list. And the responsibility is stated without any softening: “You are solely responsible for making sure that your data and key material are backed up and stored in a safe place” (Destroy Key Material).

Where the consultant or partner does belong is the design: which data gets encrypted (module 3), how the project turns it on without breaking things (module 5), and helping the client write down who holds the keys, where the copies are, how often they rotate, and who’s allowed to destroy one. Assign the keys judiciously.

Three ways to hold a Shield key Three ways to hold a Shield key. Salesforce generates it: a tenant secret, combined with Salesforce's per-release primary secret; export a copy and keep a registry outside Salesforce; works with field-level and Database Encryption. You bring your own, BYOK: generated in your own infrastructure, such as an on-premises HSM, and uploaded; you can also upload the data encryption key itself; available for field-level and Database Encryption, search indexes, Backup & Recover Next and Data 360. You keep it outside: External Key Management or the Cache-Only Key Service fetch it on demand; Salesforce holds it only in an encrypted cache; your key service becomes part of how the org runs; cache-only keys aren't available for Database Encryption. Footnote: destroy every copy of a key and the data it encrypted can't be read; Salesforce can't help. {"author": "Steve Simpson", "blueprint": "1.0.0", "builder": "standard 1.59.0", "built": "2026-11-21", "id": "DGM-SVA-SD-04", "rights": "\u00a9 2026 Twinshark LLC. All rights reserved.", "template": "comparison 0.5.0", "theme": "stevetecharc 1.4.0"} Salesforce generates it a tenant secret Combined with Salesforce's per-release primary secret Export a copy; keep a registry outside Field-level and Database Encryption You bring your own BYOK Made in your own infrastructure, then uploaded Or upload the data encryption key itself Field-level, Database, search, backups, Data 360 You keep it outside External Key Management, cache-only Fetched on demand, held in an encrypted cache Your key service becomes part of the org Cache-only: not for Database Encryption Destroy every copy of a key and the data it encrypted can't be read. Salesforce can't help. © 2026 Twinshark LLC · stevetecharc.com
Click to enlarge

Test knowledge. Know that Shield Platform Encryption derives its data encryption key from a tenant secret you control and a primary secret Salesforce maintains (generated with an HSM once per release), and that Salesforce doesn’t store derived keys. Know the Manage Encryption Keys permission and the key life cycle: generate, export (back up), rotate, archive, destroy, import; that an archived key decrypts what it encrypted but encrypts nothing new; that destroying key material makes the related data inaccessible unless you import an exported copy; and that Database Encryption keys can’t be destroyed, exported or imported. Know the options for holding the key yourself: Bring Your Own Key, opting out of key derivation, External Key Management and the Cache-Only Key Service (not for Database Encryption). Know that rotation frequency follows your security policy, with minimum intervals set by key type. A likely area, not a known question.

  • Which key option the requirement calls for: Salesforce-generated, BYOK, or a key kept outside with External Key Management or cache-only keys, and whether that option works with the chosen path (field-level or Database Encryption).
  • Who holds Manage Encryption Keys: a short list on the client’s side, monitored in the Setup Audit Trail.
  • Where the exported copies live, and the registry of keys outside Salesforce.
  • How often keys rotate, by the client’s security policy, and how existing data is brought up to the new key.
  • Who may destroy a key, and the check that an exported copy exists before anyone does.
  • For keys kept outside: the key service’s availability, planned like any system the org depends on.

Beyond the exam: what AI changes. Keys decide whether the stored data can be read at all, not who reads it. When an agent’s user has access, Salesforce decrypts for the agent the same way it does for a person (module 1). So a strong key design doesn’t make an agent safe, and a missing one doesn’t make it unsafe. Ask both questions separately: who holds the keys, and what can the agent’s user see? Chapter 20 covers agents.