Secure credit card store
Updated: Oct 23

Scenario: Credit card information is stored in a 3rd party gateway service to meet pci-dss compliance requirements. Besides cost at scale, it was limiting the user experience to present the card information in innovative ways.
The Ask: An inhouse secure store that can
integrate easily with existing apps and services
scale to support millions of customers with API operations at p99 less than 100ms
flexible to secure data beyond cards
support PCI DSS compliant and non-compliant clients
Solution: The solution is built using lightweight secure libraries and keys are managed in AWS KMS
Single-use tokens are provided to retrieve PANs for short duration
Provides masked/truncated data for PANs to display in apps
Multi-tenant store to isolate PANs by any combination of client or group
Expired PANs are deleted on a scheduled maintenance cycle
Audit trail of every API call with latency and customer id
Communication
between servers is via grpc and protobuf is the in-memory data format
The data is secured with the following design principles
Card data is isolated from the token and key handling system. Separate databases are deployed
Keys are rotated by lifetime and number of cards encrypted, so any exposure of a single key limits the number of cards affected
Keys and unencrypted data are never stored on a disk
Card data and keys when needed are held in memory in encrypted form for short durations
Sensitive info is never written to logs
A design view of the system

The solution delivered card retrieval at a p99 of 50ms and card additions at p99 of 100ms, delivered from 2 cores and 2GB RAM in a cluster mode of load balancer and distributed cache, under a sustained load of 100rps for 10 mins.