AI & personal dataUpdated 22 November 20269 min read

Encryption, Masking and Tokenisation for AI Pipelines Under DPDP

Rule 6(1)(a) names encryption, obfuscation, masking and virtual tokens as minimum safeguards. Here is how to apply each one to prompts, embeddings, training sets and model gateways.

By Suhas Bhairav · Reviewed against the DPDP Rules, 2025 (G.S.R. 846(E), 13 Nov 2025)

Governing rule
Rule 6(1)(a), DPDP Rules 2025
Named techniques
Encryption, obfuscation, masking, virtual tokens
In force from
13 May 2027
Maximum penalty
Up to ₹250 crore (security safeguards)
Applies to processors
Yes — fiduciary must cover processing on its behalf
Anonymisation standard in DPDP
None defined

Quick answer

Rule 6(1)(a) of the DPDP Rules, 2025 requires, at minimum, appropriate data security measures such as encryption, obfuscation, masking or virtual tokens mapped to personal data. For AI pipelines that means encrypting stores, masking identifiers before prompts reach a model, tokenising values with a separate vault, and keeping re-identification under access control. It applies from 13 May 2027.

  • Rule 6(1)(a) lists encryption, obfuscation, masking and virtual tokens as examples of minimum security measures, applicable from 13 May 2027.
  • Masked or tokenised data is still personal data under DPDP if the fiduciary can re-identify the individual.
  • Mask before the model: redact identifiers at the gateway, not after the response is logged.
  • Keep the token vault and its keys in a separate trust boundary from the AI workload.
  • Failure to take reasonable security safeguards carries a penalty of up to ₹250 crore per instance.

Who this is for: ML platform engineers, Security architects, Teams building LLM gateways, Data engineering teams, CTOs of AI startups

What does Rule 6(1)(a) require for AI pipelines?

Section 8(5) of the DPDP Act requires every Data Fiduciary to protect personal data in its possession or control, including processing by its Data Processors, by taking reasonable security safeguards to prevent a personal data breach. Rule 6(1) sets the minimum content of those safeguards.

Rule 6(1)(a) is the data-layer requirement: "appropriate data security measures, such as securing of personal data through encryption, obfuscation, masking or the use of virtual tokens mapped to that personal data."

Three things follow for AI systems:

  • The list is illustrative, not exhaustive. "Such as" means you choose the appropriate technique for each data flow and must be able to justify it.
  • It covers processing on your behalf. Data sent to a hosted model, a vector DB service or a labelling vendor is still within your obligation.
  • It sits alongside the other limbs. Access control (Rule 6(1)(b)), logs and monitoring (6(1)(c)), backups (6(1)(d)), one-year log retention (6(1)(e)), processor contract clauses (6(1)(f)) and organisational measures (6(1)(g)) complete the picture.

Rule 6 applies from 13 May 2027. Failure to take reasonable security safeguards is the highest penalty band in the Act, up to ₹250 crore per instance.

Which technique fits which AI data flow?

Each technique protects against a different threat. Pick per flow, not per company.

TechniqueWhat it doesBest AI useReversible?
EncryptionRenders data unreadable without a keyVector DB volumes, object storage, backups, logs at rest, TLS in transitYes, with key
MaskingReplaces values with placeholders like [EMAIL]Prompts to third-party models, trace logs, eval setsNo
Tokenisation (virtual tokens)Swaps values for random tokens; mapping kept in a vaultPrompts needing re-hydration, analytics joins, training dataYes, via vault
ObfuscationGeneralises or perturbs values (age bands, coarse location)Feature stores, analytics, recommendation featuresUsually no

A typical LLM request uses several at once: TLS to the gateway, tokenisation of names and account numbers before the model call, masking in the trace log, and encryption of the stored conversation.

Note that DPDP defines personal data by identifiability. Tokenised data with a vault you control remains personal data; it is a security safeguard, not an exit from the Act. See what counts as personal data.

The model gateway pattern: mask before the model

The most effective single control is a model gateway that every LLM call passes through.

  1. Detect. Run deterministic detectors (regex for PAN, Aadhaar-format numbers, phone, email, IFSC, card numbers with Luhn checks) plus an NER model for names and addresses. Deterministic rules catch structured identifiers reliably; NER catches the long tail.
  2. Tokenise. Replace each detected value with a stable, typed token such as <PERSON_7f3a> or <PHONE_19c2>. Store the mapping in a vault keyed by request ID with a short TTL.
  3. Call the model. The provider sees typed placeholders. Most models handle these well if the system prompt explains them.
  4. Re-hydrate. On the response path, swap tokens back for authorised display, and only where the user is entitled to see the value.
  5. Log the masked version. Traces store the tokenised prompt and response, never the re-hydrated text.

Design notes:

  • Use per-tenant token namespaces so tokens cannot be joined across customers.
  • Keep the vault in a separate service with its own IAM role; the AI workload can request detokenisation only for the current session.
  • Fail closed: if the detector times out, block or downgrade to a local model rather than sending raw text.

Embeddings, vector stores and training data

Embeddings

Embed masked text where retrieval quality allows. Names and phone numbers rarely improve semantic search; product, issue and policy terms do. Keep raw identifiers in a separate, access-controlled metadata store linked by chunk ID, so the vector index alone does not expose them.

Encrypt the vector DB at rest with customer-managed keys where the service supports them, and restrict who can run unfiltered similarity queries — an embedding index is a search engine over your customers.

Training and fine-tuning sets

  • Tokenise or mask before data leaves the production boundary for a training environment.
  • Prefer irreversible masking for training sets; you rarely need to re-identify a training example.
  • Keep lineage so an erased person can still be removed (see erasure in LLMs).
  • Test for memorisation: prompt the fine-tuned model with partial records and check whether it completes real identifiers.

Analytics and features

Use obfuscation — age bands, pin-code prefixes, bucketed spend — for recommendation and risk features. It reduces breach impact and supports the data minimisation that consent under section 6 already demands.

Key management and re-identification controls

Encryption and tokenisation are only as strong as the key and vault controls around them.

  • Separate duties. The team that operates the AI workload should not administer the KMS keys or the token vault.
  • Envelope encryption. Use per-tenant data keys wrapped by a master key in a managed KMS or HSM; rotate on a schedule and on staff exit.
  • Scoped detokenisation. Grant detokenise rights per purpose (support agent viewing one ticket) rather than bulk export.
  • Log every detokenisation. Rule 6(1)(c) requires visibility on access to personal data through logs, monitoring and review. Detokenisation events are the highest-value access log you have.
  • Retain those logs. Rule 6(1)(e) and Rule 8(3) require relevant logs to be kept for one year. See one-year log retention.
  • Breach posture. If ciphertext leaks but keys are intact, that is still a personal data breach event to assess; Rule 7 has no materiality threshold. Strong encryption mainly changes the "likely consequences" you report.

For CERT-In purposes, keep ICT logs for the 180-day rolling window within India as the April 2022 Directions require; see CERT-In rules for AI systems.

Common mistakes

  • Masking only the output log. If raw text reaches the third-party model, masking the log afterwards does not reduce the exposure that matters.
  • Calling tokenised data "anonymised". DPDP has no anonymisation safe harbour; if you can reverse the token, the data is personal data.
  • One vault key for everything. A single compromised credential re-identifies every tenant.
  • Regex-only detection. Structured IDs are caught, but free-text names, addresses and medical details slip through. Combine rules with NER and test recall on real samples.
  • Re-hydrating into logs. Debug middleware that logs the final rendered response undoes the gateway.
  • Ignoring tool calls. Agents fetch CRM records and pass them back into context. Tool outputs need the same masking as user input — see AI agents and personal data.
  • No contract clause. Rule 6(1)(f) expects processor contracts to provide for reasonable security safeguards; write masking and retention expectations into the vendor agreement.

Further reading on suhasbhairav.com

Before 13 May 2027

Compliance checklist

  1. Route every LLM call through a gateway

    Centralise detection, tokenisation, logging and provider selection in one service so no team calls a model directly.

    Rule 6(1)(a)

  2. Combine deterministic detectors with NER

    Use regex and checksum rules for structured identifiers and an NER model for names and addresses; measure recall.

    Rule 6(1)(a)

  3. Store token mappings in a separate vault

    Isolate the vault and its keys from the AI workload with distinct IAM roles and short-lived mappings.

    Rule 6(1)(b)

  4. Log masked prompts only

    Write tokenised prompts and responses to traces; never log re-hydrated text.

    Rule 6(1)(c)

  5. Encrypt vector stores and backups

    Enable encryption at rest with managed or customer keys and rotate on a schedule.

    Rule 6(1)(a), 6(1)(d)

  6. Mask training and eval datasets

    Apply irreversible masking before data leaves production for training, and test fine-tuned models for memorisation.

    Rule 6(1)(a)

  7. Log and review detokenisation events

    Treat every detokenise call as an access event and keep it for at least one year.

    Rule 6(1)(c), 6(1)(e)

  8. Write masking duties into processor contracts

    Require vendors to apply agreed safeguards and retention settings.

    Rule 6(1)(f)

Key dates

  1. DPDP Rules notified

  2. Rule 6 security safeguards become enforceable

Answers

Frequently asked questions

Is masked data still personal data under the DPDP Act?

Irreversibly masked data that no longer relates to an identifiable individual falls outside the Act's definition of personal data. Tokenised or pseudonymised data that you can re-identify through a vault or lookup table remains personal data. Masking and tokenisation are security safeguards under Rule 6(1)(a), not a way to exit the Act.

Does Rule 6 require encryption?

Rule 6(1)(a) requires appropriate data security measures and gives encryption, obfuscation, masking and virtual tokens as examples. It does not mandate one technique for every case, but for stores of personal data at rest and in transit, encryption is the baseline any reviewer will expect, and you should be ready to justify any exception.

Can I send customer data to a foreign LLM API if I mask it first?

DPDP takes a negative-list approach to transfers under section 16, so transfers are allowed unless the destination is restricted, subject to Rule 15 requirements and stricter sectoral rules. Masking before the call is still the strongest safeguard because it limits what the provider ever sees, and it reduces breach impact.

What is a virtual token under the DPDP Rules?

Rule 6(1)(a) refers to the use of virtual tokens mapped to personal data. In engineering terms this is tokenisation: replacing a real value with a random substitute and keeping the mapping in a secured vault. Only authorised processes can map the token back to the original value.

Should I embed raw text or masked text in my vector database?

Embed masked text wherever retrieval quality holds up, which it usually does because identifiers add little semantic value. Keep identifiers in a separate access-controlled metadata store linked by chunk ID. This limits exposure if the index is queried without authorisation and simplifies erasure.

What is the penalty for weak encryption or masking under DPDP?

Failure to take reasonable security safeguards to prevent a personal data breach carries a penalty of up to ₹250 crore per instance under the Act's Schedule. The Board decides the amount after inquiry, considering factors such as the nature, gravity and duration of the breach, the type of data and mitigation steps.

Legal references and sources

  • Digital Personal Data Protection Rules, 2025 — Rule 6(1)(a)–(g) (official text)
  • Digital Personal Data Protection Act, 2023 — Section 8(5) (official text)
  • Digital Personal Data Protection Act, 2023 — Schedule (penalties) (official text)

This guide explains the law for engineering and business teams. It is not legal advice; confirm how it applies to your organisation with qualified counsel, and check the Gazette for later notifications or amendments.

About the author

Suhas Bhairav

Suhas Bhairav

Systems architect and applied AI practitioner who designs production AI systems for Indian and global companies, with a focus on privacy-by-design under the DPDP Act and the EU AI Act.