SovereigntyKey control

Who holds the keys to your inference data

Learn what BYOK inference means for European data sovereignty, how to manage encryption keys, and why zero retention offers a simpler compliance path.

, AI Researcher10 min read
In this article8
  1. What does BYOK mean in AI?
  2. Integrating encryption: what is inference py?
  3. Regulatory drivers: BSI, NIS-2 and the CRA
  4. Sovereign infrastructure: Gaia-X and EuroHPC
  5. A BYOK inference example in practice
  6. And by inference: zero retention as an alternative
  7. Frequently asked questions
  8. Sources
An nCipher nShield F3 hardware security module PCI card
A hardware security module. BYOK moves the key material onto a device the customer, not the provider, controls. Photo: Alexander Klink, CC BY 3.0, via Wikimedia Commons

What does BYOK mean in AI?

In enterprise AI deployments, Bring Your Own Key (BYOK) refers to a cryptographic control model where the customer retains sole ownership and lifecycle management of the encryption keys used to protect data processed by an external machine learning platform. This architecture differs fundamentally from developer-facing API key routing, where a user merely passes an authentication token to route requests across third-party model providers. Cryptographic BYOK ensures that data at rest, data in transit, and staged prompt caches remain undecipherable to the hosting cloud provider without an explicit, audit-logged decryption grant from the customer's Key Management Service (KMS) or Hardware Security Module (HSM).

True BYOK architectures in AI rely on envelope encryption. In this two-tier model, the hosting infrastructure encrypts prompt payloads and generated tokens using a local Data Encryption Key (DEK). That DEK is subsequently encrypted under a Key Encryption Key (KEK), also known as the master key, which never leaves the customer's secure key management boundary. When an inference request arrives, the AI service requests a temporary DEK unwrap operation from the customer KMS. Revoking key access immediately renders all associated data stores, fine-tuned weights, and cached contextual embeddings unreadable, establishing a technical boundary for data sovereignty beyond purely contractual terms.

The financial rationale for enforcing strict cryptographic controls is substantial. According to data from the IBM Cost of a Data Breach Report, organizations that deploy robust encryption mitigate data breach costs by an average of $208,087 per incident[1]. In regulated environments such as European healthcare, banking, and public administration, BYOK transforms encryption from a passive security baseline into an enforceable operational control mechanism.

Control DimensionAPI Key Routing (Credential BYOK)Cryptographic BYOK (Envelope Encryption)
Primary FunctionAuthentication, quota routing, and billing isolationCryptographic isolation and customer-controlled access enforcement
Key Custody LocationStored in plaintext or reversibly hashed on the SaaS platformIsolated in customer Hardware Security Module (HSM) or dedicated KMS
Revocation ImpactBlocks incoming API calls but leaves stored data intactInstantly cryptographically shreds all encrypted data at rest and cached state
Data Breach MitigationZero impact on stored data exposure during server-side breachesCorrelates with an average breach cost reduction of $208,087

Integrating encryption: what is inference py?

In production machine learning pipelines, inference.py serves as the primary runtime execution script. Within containerized model serving engines such as TorchServe, Triton Inference Server, or custom vLLM wrappers, inference.py defines the entry points for initializing model weights, preprocessing raw inputs, executing the forward pass, and formatting the response payload. When an enterprise introduces customer-managed cryptography into the serving layer, this script orchestrates the handshake between incoming encrypted payloads and the target model architecture.

Implementing BYOK within inference.py requires integrating calls to an external Cryptographic Service Provider (CSP) or dedicated KMS before passing tensors to the accelerator memory. The script must retrieve the wrapped DEK from request headers, authenticate against the enterprise key vault using mutual TLS (mTLS) or short-lived identity tokens, obtain the decrypted DEK, decrypt the prompt payload into memory buffers, and immediately clear the plaintext key material from host RAM after tensor generation.

  1. Client-Side Envelope Encryption: The client encrypts prompt text using an ephemeral AES-GCM 256-bit DEK, wraps the DEK using the customer HSM public key, and attaches the ciphertext to the API payload.
  2. Inference Script Authentication: The inference.py script validates request signatures and calls the customer KMS to unwrap the DEK under strict identity policies.
  3. In-Memory Decryption: The payload is decrypted directly into volatile system RAM and loaded onto GPU High Bandwidth Memory (HBM) as tensor inputs for model execution.
  4. Post-Inference Memory Sanitization: The inference script executes explicit memory zeroing routines to eliminate residual plaintext tokens and symmetric keys before returning the encrypted response.

While this architecture provides verifiable control, it introduces measurable latency and operational complexity. Continuous round-trip KMS network calls add 15 to 80 milliseconds of time-to-first-token latency per request. Furthermore, hardware security modules enforce strict throughput throttling, meaning that high-volume batch workloads can quickly exhaust KMS cryptographic operation quotas unless token caching and session key derivation are carefully architected.

Regulatory drivers: BSI, NIS-2 and the CRA

European enterprises operate under a tightening framework of cybersecurity directives and technical guidelines that make customer-managed cryptographic controls an operational necessity. In August 2026 the German Federal Office for Information Security (BSI) released version 1.0 of Technical Guideline TR-03183, setting out its interpretation of cyber resilience requirements for manufacturers and products as a voluntary on-ramp to the European Cyber Resilience Act (CRA), which manufacturers must meet by 11 December 2027[2]. The guideline sets out a risk-based process covering vulnerability handling, appropriate protection levels, and continuous review across networked products with digital elements.

Simultaneously, the statutory registration deadline under the NIS-2 Directive has passed, requiring affected entities across critical and important sectors to register immediately with the BSI reporting portal and demonstrate state-of-the-art technical risk management. For organizations integrating generative AI into operational workflows, compliance requires demonstrating that data processing pipelines are protected against unauthorized third-party access and extraterritorial data demands.

Baseline security adoption in the wider ecosystem remains uneven. Empirical measurements published by the BSI within the Cyberdome project on 6 August 2026 revealed that only 1.8 percent of website operators in Germany provide a standard security.txt file for coordinated vulnerability disclosure[3]. This widespread gap in basic security hygiene accelerates regulatory scrutiny under the EU AI Act and NIS-2, compelling compliance officers to demand deterministic controls such as customer-managed keys and zero-retention architectures rather than relying on standard vendor assurances.

  • BSI TR-03183 (August 2026): Establishes baseline cybersecurity technical guidelines supporting Cyber Resilience Act conformity for connected products[2].
  • NIS-2 Directive Registration: Mandates immediate registration of critical entities with national authorities and enforces supply chain risk management obligations.
  • Cyberdome Security Findings (August 2026): Document that only 1.8 percent of German website operators maintain a standard security.txt disclosure mechanism, highlighting enterprise compliance risks[3].

Sovereign infrastructure: Gaia-X and EuroHPC

Securing AI workloads in Europe extends beyond application-level key management to the physical and organizational governance of compute infrastructure. The Gaia-X European association addresses this challenge through its Season 2.0 Trust Framework and Compliance Document 3.1.0, shifting compliance from static contractual paperwork into automated, machine-verifiable trust credentials[4]. Through accredited Digital Clearing Houses, Gaia-X enables enterprises to programmatically audit provider jurisdiction, data location, and cryptographic security levels before dispatching inference requests.

At the supercomputing tier, the European High Performance Computing Joint Undertaking (EuroHPC JU) provides sovereign compute capacity, with Council Regulation (EU) 2024/1732 amending its founding regulation to let it acquire and operate AI-optimised supercomputers for startups and the wider innovation community[5]. On that basis the EuroHPC JU selected the first seven AI Factory hosting sites in December 2024, in Finland, Germany, Greece, Italy, Luxembourg, Spain and Sweden, with the Spanish AI Factory built on an upgrade of the existing EuroHPC MareNostrum 5 system in Barcelona and the Finnish one located next to the LUMI supercomputer in Kajaani[6]. Over the 2021-2027 period, Commission, Member State and Associated Country investment in supercomputing infrastructure and AI Factories through the EuroHPC JU will reach EUR 10 billion[7].

These initiatives establish a verified physical foundation for European enterprises, ensuring that both training and large-scale inference run on infrastructure legally and operationally insulated from foreign extraterritorial jurisdictional reach.

Framework / InstitutionGovernance MechanismCore Security & Sovereignty Deliverable
Gaia-X Season 2.0Trust Framework & Compliance Document 3.1.0Automated machine-verifiable trust credentials and Digital Clearing Houses for real-time auditability
EuroHPC JUCouncil Regulation (EU) 2024/1732AI Factories deploying dedicated sovereign supercomputing clusters (LUMI, Leonardo, MareNostrum 5) under a EUR 10 billion EU and Member State investment for 2021-2027
BSI Technical GuidelinesTR-03183-1 & CSP SpecificationsStandardized cryptographic service provider APIs and Cyber Resilience Act technical baselines

A BYOK inference example in practice

To understand how BYOK operates during model serving, consider a regulated European financial institution deploying an open-weight 70B parameter language model on hosted cloud infrastructure. The enterprise maintains its master encryption keys inside an on-premises HSM located in Frankfurt, while inference compute is provisioned in a regional European data center. Physical data residency alone does not prevent unauthorized data access if the host operator retains root access to encryption keys.

When a customer prompt containing sensitive account transactions is dispatched, the client application encrypts the payload locally using an ephemeral DEK. The DEK is encrypted via the customer KMS and transmitted alongside the ciphertext. The hosted inference server authenticates with the customer KMS, which logs the exact timestamp and IP address before releasing an unwrap grant. The server executes model inference in volatile GPU memory and immediately discards the plaintext tokens.

Enterprise infrastructure governance is further reinforced by industry frameworks such as the CISPE (Cloud Infrastructure Services Providers in Europe) Data Protection Code of Conduct, the first pan-European sector-specific code for cloud infrastructure service providers under Article 40 GDPR to receive a green light from the European Data Protection Board[8]. Under the Code, providers of declared services will only access or use customer data to maintain or provide the service and will not use it for marketing or advertising purposes, while customers are given explicit options to select services that process data entirely within the European Economic Area. Evaluating these operational safeguards helps technical teams accurately assess their overall inference costs against regulatory exposure.

  1. Client Request Initiation: The enterprise client generates a local 256-bit symmetric key, encrypts prompt data, and queries the local HSM for a wrapped key package.
  2. Authenticated KMS Authorization: The inference runtime presents mutual TLS certificates to the enterprise HSM, which records an immutable access log entry prior to unwrapping.
  3. Volatile Computation: Tensors are loaded into GPU HBM for the forward pass without persisting any intermediate activation states to non-volatile disks.
  4. Encrypted Egress: Generated completion tokens are re-encrypted using the ephemeral session key before traversing the egress network boundary back to the client.

And by inference: zero retention as an alternative

While cryptographic BYOK offers verifiable mathematical control over data at rest, it introduces substantial friction into real-time AI workloads. BYOK does not eliminate the fundamental vulnerability of inference compute: during token generation, weights, prompts, and KV caches must exist in unencrypted plaintext within accelerator memory. An attacker with hypervisor-level or physical bus access during execution can theoretically inspect memory buffers regardless of whether the initial REST payload was wrapped in an HSM key. Furthermore, the round-trip latency overhead and KMS query fees can increase total cost of ownership significantly.

For cost-driven enterprise adopters seeking defensible sovereignty, a simpler and technically equivalent alternative is deploying private isolated endpoints backed by enforceable zero data retention policies. Under a verified zero data retention architecture, inference requests are processed strictly in volatile GPU memory, prompt caching to persistent disk is disabled, and logging pipelines discard input strings immediately upon socket closure. This removes data-at-rest exposure entirely, eliminating the need for complex envelope encryption pipelines.

A team that wants that isolation without running a key-management stack has two published routes at Lyceum: serverless inference, where prompts and completions are processed in GPU memory and never written to persistent storage, with prompt caching held in GPU memory per session rather than in a database; and on-demand GPU VMs with full root access, billed per second with no minimum, where the workload runs on the team's own instance. Lyceum asserts that zero-retention position itself rather than holding a third-party attestation for it, offers an Article 28 Data Processing Agreement on request, and states data residency per model, so the region behind a given model can be confirmed before it goes live. For a buyer weighing customer-managed keys, that removes the data-at-rest exposure BYOK is meant to cover without the key-management overhead.

Frequently asked questions

What does BYOK mean in AI?

Bring Your Own Key (BYOK) is a cryptographic model where the customer generates and manages their own encryption keys for data processed in the cloud. In AI, this ensures the infrastructure provider cannot decrypt prompts or training data without the customer's active authorization, mitigating unauthorized access risks.

Does BYOK guarantee EU data sovereignty?

No. While BYOK secures data at rest and in transit, providers subject to foreign jurisdictions can still be compelled to hand over encrypted data. True sovereignty requires European residency and frameworks like Gaia-X, which enforces compliance through its 3.1.0 trust document, independent of foreign reach.

What is the CISPE Code of Conduct?

The CISPE Data Protection Code of Conduct is an EDPB-approved framework that ensures cloud infrastructure services comply with the GDPR. It guarantees that participating providers will not access or use customer data for their own purposes, a critical requirement for enterprise AI inference.

How does inference py handle encryption?

An inference.py script acts as the API client connecting an enterprise application to an AI model. In a BYOK setup, this script integrates with a hardware security module or key management service to encrypt prompts via envelope encryption before they are transmitted to the host provider.

Do zero retention policies replace BYOK?

Zero data retention is an alternative approach to data security. Instead of relying on the customer to manage complex encryption keys, the AI provider guarantees that prompts and outputs are processed exclusively in GPU memory and immediately discarded, eliminating the risk of data exposure at rest.

Sources

  1. datafence.ai
  2. heise.de
  3. heise.de
  4. gaia-x.eu
  5. eur-lex.europa.eu
  6. eurohpc-ju.europa.eu
  7. digital-strategy.ec.europa.eu
  8. codeofconduct.cloud

Rankings and scores on Optinest cannot be bought — no commercial relationship changes how a provider is assessed. How we score

Related reading

All Sovereignty →

Data residency is not data sovereignty

Discover the limits of data residency for AI inference in Europe. Learn how jurisdiction, operational control, and data retention impact true sovereignty.

A tape library aisle in the CERN computer centre