Data Masking, Anonymization, and Pseudonymization
Key points
- Pseudonymized data remains personal data under GDPR because re identification is possible; anonymized data falls outside GDPR scope entirely
- GDPR recognizes pseudonymization as a safeguard for risk reduction (Recital 28), privacy by design (Article 25), and compatible processing (Article 6(4))
- Pseudonymization security depends on key protection, algorithm strength, salted hashes, and access control separation between key and data
- k anonymity ensures each quasi identifier combination appears k times; l diversity requires l distinct sensitive values per group; t closeness requires distributional similarity
- The motivated intruder test assesses re identification risk through singling out, linkability, and inference attacks
- Static masking creates permanent altered copies for non production use; dynamic masking applies reversible transformations at query time based on roles
- True anonymization is extremely difficult to achieve; organizations should test using formal re identification attack methods before claiming anonymity
Data Masking, Anonymization, and Pseudonymization
This lesson covers techniques for reducing the identifiability of personal data, a core privacy engineering skill tested extensively on the CDPSE exam.
Pseudonymization
Pseudonymization replaces directly identifying data with artificial identifiers (pseudonyms) such that the data can no longer be attributed to a specific individual without additional information held separately. Under GDPR, pseudonymized data remains personal data because re identification is possible using the separately stored key. GDPR explicitly recognizes pseudonymization as a safeguard that can reduce risks (Recital 28), support privacy by design (Article 25), enable compatible further processing (Article 6(4)), and justify certain processing activities.
Implementation approaches include: hash based pseudonymization (applying a keyed hash function to identifiers), tokenization (replacing identifiers with random tokens stored in a secure vault), and format preserving encryption (encrypting data while maintaining the original format for system compatibility).
The security of pseudonymization depends on: protection of the re identification key or vault, strength of the hash or encryption algorithm, use of salted hashes to prevent rainbow table attacks, and access controls ensuring the key and pseudonymized data cannot be accessed by the same role.
Anonymization
Anonymization irreversibly transforms data so that individuals can no longer be identified by any means. Truly anonymized data falls outside the scope of GDPR and other privacy regulations entirely. However, achieving genuine irreversibility is extremely difficult.
Generalization: Replacing precise values with broader categories (exact age becomes age range, specific address becomes city). k anonymity requires each combination of quasi identifiers to appear at least k times, ensuring each person is indistinguishable from k minus 1 others.
Suppression: Removing specific data values or entire fields. Useful for outlier records that would be uniquely identifiable even after generalization.
Perturbation: Adding random noise to data values while preserving aggregate statistical properties. Differential privacy is a formal perturbation framework with provable guarantees.
Data Swapping: Exchanging values of sensitive attributes between records within the same category, preserving distributions while breaking the link between individuals and their actual values.
Anonymization Quality Testing
The motivated intruder test assesses whether a reasonably resourced person with access to public data could re identify individuals. Formal testing includes: singling out (isolating individual records), linkability (connecting records across datasets using quasi identifiers), and inference (deducing sensitive attributes from remaining data). If any test reveals re identification potential, the data is not truly anonymous.
k anonymity vulnerabilities: homogeneity attack (all records in a group share the same sensitive value) and background knowledge attack (external information narrows the group). l diversity addresses homogeneity by requiring at least l distinct sensitive values per group. t closeness requires the distribution of sensitive values in each group to be close to the overall distribution.
Data Masking
Static Masking: Creates a permanently altered copy of data for non production environments. Production personal data is replaced with realistic fictitious values, maintaining structure and referential integrity for testing and development.
Dynamic Masking: Applies transformations at query time based on user roles, leaving stored data unchanged. An analyst querying a customer table might see the first three characters of a name with the rest masked, while an authorized administrator sees the full value.
For the exam, understand the key distinction: static masking is permanent and one way; dynamic masking is reversible and context dependent.
Practical Example
A research institution receives a dataset of 100,000 patient records with diagnoses, ages, zip codes, and genders. Applying k-anonymity with k=5: ages are generalized to 10-year ranges, zip codes are truncated to 3 digits, and records with unique combinations are suppressed. Testing reveals a homogeneity attack: one equivalence group has k=5 records but all share the same diagnosis (diabetes). Applying l-diversity with l=3 requires at least 3 distinct diagnoses per group, eliminating the homogeneity vulnerability. The institution documents the anonymization method, parameters, and test results for regulatory evidence.