In this article
May 22, 2025
May 22, 2025

Why building your own BYOK is a trap

Enterprise customers want to bring their own keys. You don’t want to build the infrastructure to support it. WorkOS Vault bridges the gap with the fastest way to ship BYOK.

If you’ve got enterprise customers, you’ve probably heard the phrase “Bring Your Own Key”—usually in the same breath as a massive security questionnaire.

It’s not just a buzzword. BYOK is quickly becoming a must-have for security-conscious organizations that want full control over their data encryption keys. But implementing it yourself? That's where things get messy.

Enter WorkOS Vault—a clean, powerful way to support BYOK without building a custom encryption key management system from scratch.

Let’s break down what Vault does, why BYOK is such a pain without it, and how it can save your team weeks (or months) of infrastructure work.

What is BYOK and why should I care?

BYOK stands for Bring Your Own Key, and it does exactly what it says on the tin: it allows your customers—typically enterprise organizations—to manage and supply their own encryption keys for the data they store in your systems.

More specifically, it means:

  • You encrypt their data using a key they control, typically hosted in their cloud provider's Key Management Service (KMS). Think systems like AWS KMS, GCP KMS, and Azure Key Vault.
  • Your system doesn’t generate, own, or permanently store this key—it acts as a broker between your application and the customer’s key.

Large enterprises don’t mess around when it comes to data security and compliance. BYOK gives them three major things:

  • Control: The key lives in their infrastructure. They can revoke it at any time, which gives them confidence that they can immediately shut down access to their data if needed.
  • Compliance: Frameworks like HIPAA, ISO 27001, PCI-DSS, and FedRAMP, all place a strong emphasis on encryption and proper key management. While they don’t strictly require customer-managed encryption keys (CMEK), many organizations choose to implement Bring Your Own Key (BYOK) to meet these standards more effectively. BYOK can help with:
    • Data sovereignty (keeping control over where your encryption keys live and who can access them)
    • Cryptographic separation of tenant data (isolating each customer’s data using their own keys)
    • Event-driven key revocation (quickly cutting off access in response to incidents or policy changes)
  • Trust: BYOK is a signal that you're taking data ownership seriously. It shows your customers that you’re willing to hand over the last mile of control—even if their data lives in your system.

If you’re storing sensitive data—PII, PHI, financial info, or anything government-related— or selling to security-conscious verticals (finance, healthcare, government, etc.), BYOK isn’t just “nice to have”. It’s quickly becoming the price of entry for landing enterprise contracts.

But supporting it properly? Not so fun.

Why is BYOK hard?

Implementing BYOK sounds simple on paper: “Just let the customer plug in their KMS key and use it to encrypt their data.”

In reality, here’s what that actually means for your engineering team:

  • Build integrations with multiple cloud providers: Enterprise customers don’t all use the same cloud. You’ll likely need to integrate with AWS KMS, Azure Key Vault, Google Cloud KMS, etc. Each provider has its own SDK, its own authentication model, and its own way of structuring key references. Maintaining these integrations means tracking SDK versions, building fallback logic for network failures, and handling region-specific availability. And you need to make it work without storing keys in your app, which adds another layer of indirection.
  • Design a way to associate keys with tenants or users: You can’t just stick a key in memory. You need to associate each customer with a specific encryption key, ensure all encryption/decryption operations are scoped to that key, and prevent key reuse or misattribution. In a multi-tenant architecture, this often means:
    • Encrypting per-record or per-blob, tagged with a tenant ID
    • Fetching the correct key at runtime based on context
    • Handling all of this at low latency, so you don’t bottleneck your read/write throughput
  • Handle key rotation, revocation, and metadata tracking: Enterprises rotate keys on a schedule—or on demand if they suspect compromise. Your app must support non-breaking key rotation, know how to re-encrypt existing data with the new key, prevent partial access during a key transition, and handle revoked keys cleanly. This gets even more complex if you support versioned keys (e.g., key-v1, key-v2) or cryptographic agility (switching from AES-256-GCM to something else in the future). And don’t forget the audit requirement: you’ll need logs that show when and how each key was used.
  • Handle observability and audit logging: If your system is handling sensitive data under customer-supplied encryption, you’ll be expected to log who accessed what and when (including which key was used), store immutable audit logs for security reviews, and show compliance with frameworks like HIPAA, GDPR, FedRAMP, or SOC 2. This means:
    • Building centralized observability around encryption operations
    • Correlating usage with user activity (which user from which tenant triggered which key?)
    • Ensuring that your audit logs themselves are tamper-proof

To sum up, rolling your own BYOK support means:

  • Building an internal key orchestration system.
  • Maintaining multi-cloud SDKs.
  • Handling tenancy and access control at the encryption layer.
  • Supporting complex key lifecycle management.
  • Proving it all works through auditable logs.

It’s clear by now that BYOK is not a feature—it’s a system. And unless your app is literally a key management platform, it’s probably not where you want to invest your engineering hours.

What WorkOS Vault solves

Supporting BYOK securely and at scale isn’t just about encryption — it’s about building a reliable bridge between your app and keys you don’t own. That’s where WorkOS Vault comes in.

WorkOS Vault gives you a plug-and-play API and SDKs to support BYOK, without reinventing the cryptographic wheel. It abstracts the complexity of BYOK, providing:

  • A secure orchestration layer between your app and customer-managed keys.
  • A clean, cloud-native API surface.
  • Multi-tenant encryption key handling at scale.

Let’s break down what it handles for you—so you don’t have to build it.

1. Seamless integration with KMS providers

WorkOS Vault supports direct integration with the most common customer-managed key providers:

  • AWS Key Management Service (KMS)
  • Azure Key Vault
  • Google Cloud KMS

This means that regardless of how your customers manage their keys, you don’t need to write separate logic for each provider or juggle all these different SDKs and their edge cases.

2. Org-scoped key mapping

When encrypting data with Vault, a set of key-value metadata pairs called the key context is required. This determines which key or keys will be used to encrypt the data without needing to explicitly list IDs for the keys. Using an Organization ID as the key context will ensure that Vault uses key that is unique for that organization - {"organization_id": "organization_abc123"}.

And for organizations that have connected their KMS to Vault, a CMEK from their KMS will be used automatically when their organization id is in the key context.

From there, Vault ensures that every encryption and decryption operation for that customer uses the correct, customer-supplied key. You don’t have to manually handle customer-key lookups or enforce isolation—Vault does that for you, securely and reliably.

3. Secure runtime access with no key storage

Neither Vault nor your application ever holds customer encryption keys. Instead:

  • Vault uses the customer’s KMS to generate or decrypt a Data Encryption Key (DEK). The CMEK used by the KMS to generate a DEK is never shared with Vault or your application. Instead, the KMS returns both a plaintext and encrypted version of the DEK.
  • Your application uses the Data Encryption Key to encrypt any kind of customer sensitive data. The encrypted version of the DEK is stored with the encrypted customer data.
  • The plaintext DEK is discarded immediately after encryption or decryption

This significantly reduces your attack surface. Even if your app is compromised, the CMEK key material never resides in Vault or your environment.

4. Key rotation and revocation

When your customer rotates their key in their KMS, or updates its policy:

  • Vault automatically uses the latest active key for new encryption requests
  • Existing data can still be decrypted using previous key versions
  • If previous key versions are explicitly revoked, fails decryption securely

This is critical for BYOK compliance: if the customer decides to revoke access, Vault enforces it instantly—you don’t need to poll their KMS or manage revocation logic manually.

5. Built-in auditing and traceability

Every interaction with a customer-supplied key is logged by Vault, including:

  • Action
  • Timestamp
  • Object name
  • Actor
  • Source

These logs can be piped into your SIEM or used to satisfy compliance audits. You’ll have a full picture of who accessed what, and when—essential for meeting requirements under SOC 2, HIPAA, GDPR, and others.

How BYOK in WorkOS Vault works

It all starts with connecting the KMS you use (AWS, GCP Cloud, Azure Key Vault) with WorkOS Vault. You can do that using the Admin Portal, an out-of-the-box UI, maintained and hosted by WorkOS.

You can generate an Admin Portal URL in the WorkOS dashboard and share it with your customer’s IT admins. They will use the URL to configure the connection to their KMS, and after this is done, Vault will take care of securely interfacing with their KMS so your app’s data is encrypted and decrypted.

To generate the setup URL:

  1. Go to the WorkOS dashboard.
  2. Choose the customer’s organization.
  3. Click “Invite Admin”.
  4. Select the WorkOS Vault feature and click Next.
  5. Enter the email of the IT admin for the organization to automatically send them a setup link, or click “Copy setup link.”

Only one link can be active at a time. After creating the initial link, you can click the “Manage” button to revoke the existing link before creating a new one.

Once the IT admin clicks on the link, they will be asked to select the provider: AWS KMS, GCP Cloud KMS, or Azure Key Vault.

Once they select the provider, they have to follow a series of steps. The UI will guide them through with detailed instructions. The steps are:

  1. Create the key: The admin creates a customer-managed key.
  2. Delegate IAM access: The admin needs to specify the AWS accounts that can use this key and configure a provided Account ID.
  3. Confirm key policy: After the key is set up, the admin needs to confirm that the required key permissions exist.
  4. Finish key setup: After confirming the key policy, the admin needs to review the key setup.
  5. Locate key arn: After creating the key, the admin has to locate the key ARN value (i.e., the unique identifier for the key that looks like this: arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab) and provide it to WorkOS.

After this is done, the Admin Portal triggers WorkOS Vault to verify it can read the key from AWS KMS. Once verified, Vault will use the customers’ KMS to generate encrypted and decrypted versions of the data key. The decrypted version is used to encrypt/decrypt data, and the encrypted version is stored with the data. Then, when the data needs to be decrypted, WorkOS Vault sends the encrypted key to the KMS, and it decrypts it.

Who needs this?

Not every app needs BYOK. But if you're building for enterprises, it's probably just a matter of time.

Let’s see in which cases you need to have BYOK.

You're selling to security-conscious enterprises

Your customers are asking questions like:

  • "How do you encrypt our data?"
  • "Can we use our own KMS keys?"
  • "What happens if we revoke access to a key?"

If you're getting these in security reviews or RFPs, BYOK is on their checklist — and you need a credible answer that doesn’t involve building your own crypto infrastructure.

You're storing sensitive or regulated data

If your platform handles:

  • Personally Identifiable Information (PII)
  • Protected Health Information (PHI)
  • Financial records
  • Government data

...then BYOK isn’t just a nice-to-have — it's often a compliance requirement under frameworks like HIPAA, SOC 2, ISO 27001, or FedRAMP. Vault helps you implement BYOK in a way that aligns with these standards, with built-in auditability and revocation support.

You don’t want to build a crypto platform

Rolling your own BYOK implementation means:

  • Integrating with multiple cloud KMS providers
  • Managing key access policies and rotations
  • Building caching, fallback, and audit systems
  • Handling region availability and provider-specific quirks

Unless you’re a security company, that’s not your core competency. Vault lets you offload that complexity while still delivering a world-class encryption experience.

You want to close bigger deals, faster

Enterprise buyers are increasingly using BYOK as a litmus test for whether a SaaS platform is “enterprise-ready.” If you don’t offer it, you’ll slow down (or lose) deals. With Vault, you can say "yes" to BYOK today — and back it up with real infrastructure.

DIY vs. WorkOS Vault

If you DIY, you're signing up to build and maintain a secure encryption platform.

If you use Vault, you're just calling an API.

Feature / Concern DIY Approach WorkOS Vault
Multi-KMS integration Write adapters for AWS, Azure, GCP, etc. Unified API for all supported KMSs
Tenant → key mapping Manual lookup and key routing logic Built-in tenant-key association
Key lifecycle (rotation/revocation) You write all the handling logic Vault enforces rotation + revocation
Error handling + retries Custom logic for every KMS Handled internally by Vault
Audit logging Build your own event logging pipeline Included out of the box
No key storage in your infra Easy to mess up Vault never stores customer keys
Compliance readiness You document + implement everything Vault logs + design help satisfy SOC 2, HIPAA, etc.
Security knowledge required High (you're writing crypto-adjacent code) Low (Vault handles the heavy lifting)
Time to launch Weeks or months Hours or days

Conclusion

BYOK is an essential feature for any application handling sensitive data, especially when you're targeting enterprise customers or regulated industries. While building a DIY solution might seem appealing, the complexity, security risks, and ongoing maintenance quickly add up.

WorkOS Vault simplifies the entire BYOK process, handling everything from multi-cloud KMS integrations to key rotation and audit logging, leaving you free to focus on delivering great features to your users. By leveraging Vault, you can provide a robust, compliant, and secure BYOK experience — without reinventing the wheel.

So, save yourself the hassle, reduce operational risk, and get back to scaling your app with confidence.

This site uses cookies to improve your experience. Please accept the use of cookies on this site. You can review our cookie policy here and our privacy policy here. If you choose to refuse, functionality of this site will be limited.