Pattern 2: Encrypting General PII
Beyond payment data, many other fields are considered Personally Identifiable Information (PII) under regulations like GDPR and CCPA. This pattern shows how to apply the same "Encrypt, Preserve, Delete" logic to common PII like email addresses and Social Security Numbers.
The Pattern
For any PII field:
- Encrypt the full value using a dedicated
PII_ENCRYPTION_KEY. - Extract a non-sensitive, analytics-safe portion (e.g., the email domain or the last 4 digits of an ID).
- Delete the original plaintext field.
Implementation
Add this logic to the same mapping processor used for payment data.
-
Start with your Pipeline: Open the
encrypt-card.yamlfile from Step 1. -
Inspect the maintained mapping: Review the selected fields, key lookup, and plaintext removal in the linked reference before adapting the processor.
See the complete configuration for the maintained encryption mapping and its ciphertext fields.
Note: Use the key variable names from the configuration you are adapting.
Verification
When you run your data through the updated pipeline, the customer object will now be protected. The ssn and email fields will be gone, replaced by their encrypted versions and their analytics-safe derivatives. This same pattern can be extended to any number of PII fields, such as phone numbers, names, or addresses.