Say you have joined the payments team of an online grocery business in Nagpur, and your lead asks whether the order database “should use tokens or encryption for card numbers”. Both words get used loosely, so let us pin them down, because the choice affects architecture, audit effort and what a breach looks like.
Two different ideas
Encryption transforms data using an algorithm and a key. Anyone holding the key can reverse it. The encrypted value is mathematically derived from the card number, so the protection is only as good as your key management: who can use the key, where it lives, how it rotates.
Tokenisation replaces the card number with a substitute value, the token, that has no mathematical relationship to the original. The mapping between token and real number is stored in a separate, tightly protected system, the token vault, or is managed by a payment network or provider. Steal a token and you have a meaningless string. There is nothing to decrypt, because the relationship exists only as a database entry elsewhere.
A useful picture: encryption is a locked box you carry around with the key kept somewhere. Tokenisation is a cloakroom ticket. Losing the ticket gives a thief nothing unless they can also walk up to the counter and get the coat.
Why PCI DSS makes this matter
The Payment Card Industry Data Security Standard applies to any system that stores, processes or transmits cardholder data, and to systems connected to them. The more of your environment touches real card numbers, the larger your assessment scope, with more controls, more evidence and more cost. The primary account number (PAN) must be protected wherever stored, and the standard sets out rules about rendering it unreadable.
Here the two approaches diverge. If your order database, analytics warehouse and customer-support tool hold only tokens issued by a provider, those systems typically fall outside the heaviest parts of the scope, provided the tokens cannot be turned back into card numbers by you. If instead you store encrypted card numbers, those systems still hold cardholder data in protected form, and the keys and processes around them remain in scope. Exactly how a given assessor treats a design depends on the details, so confirm with your Qualified Security Assessor instead of relying on a blog summary, mine included.
What happens in a breach
Walk through two stories. In the first, an attacker dumps your order database. If it holds encrypted PANs, the attacker’s next question is where the key is. Often it sits on the same application server or in a configuration the web app can read, since the app needs to decrypt for refunds. That is a common weakness: the application that must use the key can be tricked into using it.
In the second, the dump contains tokens. The attacker can try to use them against your own application, say by triggering charges through your payment interface, so access control still matters. But they cannot take the data to another merchant. Tokens are usually bound to the merchant, and often to the specific use.
Tokenisation in India
This is not only a compliance preference here. Under Reserve Bank of India rules on card-on-file tokenisation, which came into force on 1 October 2022, merchants and payment aggregators generally may not store actual card details. Stored cards are instead represented by tokens created through the card networks and the issuing bank, with the customer’s consent. Your grocery app’s “saved card” is therefore a token issued by the network, specific to your merchant and device context. A merchant who needs to repeat a charge sends the token; the network resolves it. Check current RBI circulars for exceptions and the latest requirements, because details have been updated since.
When encryption is still right
Tokenisation is not always possible or better. Encryption wins when:
- The data has no external vault to defer to, and you need to recover originals frequently in large volumes, such as bulk file or backup protection.
- You are protecting free-form or varied data such as documents, whole database volumes or data in transit, where a one-to-one substitute does not fit.
- You want to avoid a central lookup service that becomes a performance bottleneck or single point of failure.
Tokenisation brings its own costs. The vault is a high-value target and must be available, backed up and access-controlled. Every detokenisation request is a privileged action that needs logging and tight authorisation. A poorly designed scheme that derives tokens from the PAN with a weak method defeats the purpose, since card numbers have a limited format and a small effective space, which makes naive hashing of them a poor substitute for a real token.
The hybrid in between
Some systems need a value that looks like a card number, for instance legacy software that validates length and format. Format-preserving encryption, standardised in NIST SP 800-38G, produces ciphertext of the same shape. It is still encryption, with a key to protect, and it is not the same as a token in how scope is judged. Other products use vaultless tokenisation derived cryptographically; these sit somewhere between the two and deserve careful reading of how they are assessed.
Two further points belong on any design review. Never store the card verification code after authorisation, whichever protection you use; the standard forbids it. And mask the number on screens and in logs, showing for example only the last four digits, because logs are where unprotected PANs most often turn up by accident.
So, back to the lead’s question. For the grocery business: use the network and provider tokens for stored cards, keep real numbers out of your own systems entirely, and reserve encryption for the data you genuinely cannot avoid holding. The best protection for a card number is not to have it.
Figures and names in the examples are illustrative.
Leave a Reply