Privacy-Enhancing Technologies and Anonymization Questions
Technical safeguards that reduce identifiability: anonymization, pseudonymization, tokenization, differential privacy, and related privacy-enhancing technologies. Covers the difference between anonymized and pseudonymized data, re-identification risk, and when each technique is appropriate. Includes evaluating the privacy-utility tradeoff of a given technical control.
Critically evaluate the practicality of using fully homomorphic encryption (FHE) for on-device privacy-preserving computation on smartphones. Discuss computation and memory costs, battery impact, latency, key sizes, security parameter selection, and how FHE compares to secure enclaves, SMPC, and federated learning for typical on-device use-cases.
Sample Answer
Brief verdict
FHE is cryptographically attractive for smartphone privacy but today is practical only for limited on‑device tasks (small linear algebra, encrypted inference with tight batching). Full general‑purpose on‑device FHE is constrained by CPU, memory, energy, and latency.
Computation & latency
- Real cost: homomorphic ops are typically 10^3–10^6× slower than native arithmetic depending on scheme and operation; bootstrapping can cost tens of milliseconds to seconds on mobile CPU unless heavily optimized.
- Workarounds: use leveled FHE (avoid bootstrapping), CKKS for approximate ML inference, aggressive SIMD batching to amortize cost.
Memory & ciphertext expansion
- Ciphertext expansion: one ciphertext often tens to hundreds of KB; large keying material (secret/public/evk/rlk) ranges from hundreds of KB to multiple MB.
- Mobile consequence: RAM pressure, cache misses; memory swaps increase energy and latency.
Battery impact
- High CPU cycles and memory traffic translate to substantial battery drain; sustained FHE workloads will noticeably reduce battery life compared to plaintext or TEE approaches.
Key sizes & security parameters
- Choose λ (security level) 128+; parameters (poly degree N, modulus Q) determine noise budget and ciphertext size. Higher security → larger N/Q → heavier cost.
- For CKKS/BFV on mobile, practical configuration targets N=2^12–2^15 with careful Q-chain; validate against latest cryptanalytic recommendations.
Comparisons
- Secure enclaves (TEE): orders of magnitude faster, minimal ciphertext expansion, low energy; but expose side‑channel and trust/attestation concerns on some vendors.
- SMPC: avoids large ciphertexts but requires interactive protocols and network rounds—poor for offline local-only scenarios; good when multiple non‑colluding parties are available.
- Federated learning: reduces raw-data export and centralizes heavy crypto on server; weaker per‑example confidentiality and needs secure aggregation + DP for stronger privacy.
Practical guidance
- Use hybrid designs: TEE for latency‑sensitive tasks; FHE for server-side encrypted processing; CKKS for constrained on‑device inference when accuracy allows.
- Optimize: quantize models, pack inputs, precompute keys, offload bootstrapping to cloud, leverage NEON/SIMD or specialized crypto accelerators.
- Threat model first: choose FHE only when adversary model requires zero‑trust processing without a TEE or interactive parties.
Overall: FHE is maturing and valuable for specific on‑device primitives, but for broad smartphone deployment, hybrids and careful parameter/architecture choices are essential.
Compare secure multiparty computation (SMPC), federated learning (FL), and homomorphic encryption (HE) regarding threat models, communication and computation costs, latency, and appropriate mobile use-cases. For Apple-style privacy constraints, give concrete examples where each approach would be the preferred choice and why.
Sample Answer
Threat model & guarantees
- SMPC: Assumes multiple non-colluding parties; provides distributed computation without revealing inputs; resists honest-but-curious and with protocol variants, malicious adversaries (with higher cost).
- FL: Server-orchestrated; clients keep local data, share model updates; threats: model inversion, poisoning, curious server. Needs secure aggregation/DP for stronger privacy.
- HE: Single server computes on encrypted data; guarantees confidentiality against server (semantic security) but not integrity or side-channels.
Communication, computation, latency
- SMPC: High round complexity and bandwidth (pairwise shares, synchronization); heavy crypto ops but parallelizable; moderate-to-high latency — bad for interactive mobile real-time.
- FL: Low per-round comm (model deltas), modest CPU on device for training; many rounds → higher cumulative cost but tolerant of intermittent mobile connectivity; latency per round low.
- HE: Client does expensive encryptions; server computes on ciphertexts (more CPU than plaintext); single-round queries possible → low latency for one-shot ops but high compute and larger ciphertext sizes.
Mobile-appropriate use-cases (Apple-style constraints: local-first, minimal telemetry, no raw data off-device)
- SMPC — preferred when multiple devices jointly compute aggregate statistics without trusting any aggregator. Example: collaborative contact tracing within a cohort where no central party should learn individual exposures; use threshold SMPC to produce cohort-level risk score.
- FL — preferred for on-device model personalization where raw data never leaves the device. Example: keyboard next-word model updated via secure aggregation; low comm, preserves UX, combine with differential privacy to meet Apple-style telemetry limits.
- HE — preferred when a client must outsource a single private query to a cloud service without revealing input. Example: encrypted image search: device encrypts feature vector with leveled HE, cloud returns encrypted scores for local decryption — aligns with Apple constraint of no raw uploads.
Why choose one over another (cryptographer’s view)
- Use SMPC when decentralization and joint-secret computation are primary and collusion assumptions hold.
- Use FL when scale and intermittent connectivity matter and only model updates (not inputs) can be exposed.
- Use HE when protecting inputs from a single powerful server is required and one-shot queries justify heavy crypto.
Trade-offs: combine techniques (HE+SMPC, FL+secure aggregation+DP) to get complementary guarantees while balancing mobile CPU, bandwidth, and latency.
Implement a simplified secure aggregation prototype in Python using additive secret sharing. Description: simulate N clients each holding a small integer; each client splits its value into N additive shares modulo a prime, distributes shares to a set of aggregators (simulated locally), and the aggregators combine shares to recover only the sum. Include code for share generation, distribution simulation, and final aggregation. Also simulate one client dropout and show how you would handle missing shares to still compute the sum if possible.
Sample Answer
Brief approach (role perspective)
I implement a minimal additive-secret-sharing prototype in Python: N clients each split their integer v_i into N modular additive shares (mod prime p) and send share j to aggregator j. Aggregators sum received shares; combined sums reveal only the global sum. To simulate one-client dropout I include a simple "backup" mechanism (trusted helper) that can supply a missing client's value so aggregation proceeds — I note trade-offs and how a real cryptographic system would use threshold schemes (e.g., Shamir) or pairwise masks to avoid a trusted backup.
Code (runnable prototype):
import random
# Parameters
N = 5 # number of clients and aggregators
p = 97 # prime modulus > max possible sum
clients = [12, 7, 20, 3, 9] # client integer values
def make_shares(v, N, p):
# generate N-1 random shares, final share makes sum == v (mod p)
shares = [random.randrange(p) for _ in range(N-1)]
last = (v - sum(shares)) % p
shares.append(last)
return shares
# Each client generates shares and "sends" share j to aggregator j
all_shares = [make_shares(v, N, p) for v in clients]
# Simulate distribution: aggregator_receive[j] collects shares intended for j
def distribute(all_shares, drop_client=None):
aggregators = [0]*N
received = [[None]*N for _ in range(N)] # received[client][agg] = share or None
for i, shares in enumerate(all_shares):
if i == drop_client:
# simulate dropout: client i sends nothing
continue
for j, s in enumerate(shares):
aggregators[j] = (aggregators[j] + s) % p
received[i][j] = s
return aggregators, received
# Honest run (no dropout)
agg_sums, _ = distribute(all_shares, drop_client=None)
# Combine aggregator sums to get total sum modulo p
recovered_total = sum(agg_sums) % p
true_total = sum(clients) % p
print("True total mod p:", true_total)
print("Recovered total (no dropout):", recovered_total)
# Simulate dropout of client k
k = 2 # client index that drops
agg_sums_drop, received = distribute(all_shares, drop_client=k)
partial_recovered = sum(agg_sums_drop) % p
print("\nAfter dropout (no recovery):", partial_recovered,
" (missing client index {})".format(k))
# Simple backup mechanism: trusted helper storing (encrypted/offline) original v_k
# In prototype we just use the original value to restore correctness.
# In production, replace with threshold-reconstruction (Shamir) or pairwise masks.
backup_helper = {i: clients[i] for i in range(N)} # trusted backup
if k in backup_helper:
# aggregators add missing client's value (as a single item mod p)
recovered_with_backup = (partial_recovered + backup_helper[k]) % p
print("Recovered with trusted backup:", recovered_with_backup)
else:
print("Cannot recover: missing client's value not available.")
Explanation, complexity, and security notes
- Why this works: additive shares s_i1..s_iN satisfy sum_j s_ij = v_i (mod p). Aggregators sum per-column; final sum over aggregators equals sum_i v_i (mod p), but individual v_i remain hidden from any single aggregator (assuming not colluding).
- Complexity: share generation O(N) per client, communication O(N^2) shares total, aggregation O(N).
- Dropout handling: prototype uses a trusted backup to supply the missing v_k. This is insecure if backup is compromised. Practical secure-aggregation avoids a single trusted party by:
- Using Shamir secret sharing (threshold reconstruction) so t-of-N reconstructs missing contributions, or
- Using pairwise random masks between clients whose masks cancel in aggregate; masking + broadcast of unmasking shares can tolerate dropouts without revealing per-client values.
- Trade-offs: backup is simplest but trust-heavy. Shamir adds polynomial interpolation cost but provides threshold guarantees. Pairwise masks require O(N^2) pairwise comms but are used in many practical federated-secure-aggregation systems.
This prototype demonstrates mechanics; for production replace the backup with threshold secret sharing or robust masking and add authentication, integrity checks, and secure channels.
Design a secure aggregation protocol for computing population statistics from millions of devices where devices frequently drop out or are offline. Combine secure aggregation primitives, differential privacy, and fault tolerance: specify ephemeral key management for aggregation rounds, dropout handling strategies, and how to ensure no single server learns individual reports.
Sample Answer
High-level goal
Compute population sums/statistics at scale while (1) no single party learns individual reports, (2) resilience to frequent dropouts, and (3) differential-privacy (DP) guarantees.
Architecture
- Two non-colluding servers (Aggregator A, Helper B). Optionally extend to k-server MPC or addhomomorphic encryption (HE) fallback.
- Millions of devices (clients) participate in time-bounded aggregation rounds.
Cryptographic primitives
- Ephemeral X25519 keypairs per client per round, certified by device key; signatures (Ed25519) to prevent injection.
- Shamir secret sharing (threshold t) for mask seeds; Feldman VSS to make shares verifiable.
- PRG (e.g., HKDF-SHA256) to expand seeds into pairwise masks.
- Authenticated encryption (AEAD) for uplinks.
- Optional Paillier/CKKS HE for heavy statistics.
Ephemeral key management
- Each client generates ephemeral X25519 keypair per round, signs public key, and publishes to directory via server(s).
- Clients establish shared secrets with a small subset (O(log n)) of peers or with servers: compute pairwise seed = HKDF(shared_secret || round_id).
- Seed split into Shamir shares; shares sent to servers so servers can reconstruct cancellation seeds only if enough clients completed (protects privacy when clients drop).
Masking & upload
- Client computes report r.
- Client generates PRG masks:
- Pairwise masks with selected peers: mask_ij = PRG(seed_ij).
- Local random mask from own seed.
- Client sends masked_report = AEAD( r + sum(pairwise masks) + local_mask, metadata ) to Aggregator A; sends shares and commitments to Helper B (and A as needed).
Dropout tolerance
- Use threshold Shamir shares for local_mask seeds: if client drops, servers cannot reconstruct that client's mask unless they collect >= t shares — prevents leakage.
- For pairwise masks, design symmetric cancellation: when both clients i and j complete, their masks cancel (mask_ij + mask_ji = 0). If j drops, servers reconstruct j's share only if allowed by threshold to cancel its contribution; otherwise treat i's pairwise masks as random noise that cancels in expectation across population.
- Aggregation proceeds with dynamic participant set; servers reconstruct only aggregate cancellation masks using collected shares; clients that drop before commit are excluded via commitment checks.
Preventing single-server knowledge
- No server ever receives enough information alone to unmask an individual:
- Mask seeds are split across servers.
- Aggregator A only sees masked reports and commitments.
- Helper B holds shares/commitments but not ciphertexts.
- Reconstruction of masks requires both servers to cooperate (and they are assumed non-colluding). For higher assurance, use MPC among k servers and require threshold for collusion.
Differential privacy
- Distributed noise generation: servers jointly sample DP noise (Gaussian or discrete Laplace) via secure two-party sampling (seeded CSPRNG with joint seed derived via Diffie-Hellman and VSS). No single server learns the noise seed.
- Noise is added post-unmasking to the aggregate to provide (ε,δ)-DP. Calibrate noise to worst-case participation; use privacy amplification by subsampling when participation is random.
Scalability & performance
- Amortize pairwise masks by using small-degree peer graphs (each client masks with O(log n) neighbors) and rely on graph connectivity for cancellation; or use star topology to servers with seeds per client to reduce O(n^2).
- Use batching, compression, and PRG expansion to limit bandwidth.
- Use asynchronous rounds with timeouts and efficient share-repair protocols to handle churn.
Security properties & analysis
- Confidentiality: Individual r is masked by at least one secret share unknown to any single server; VSS prevents equivocation.
- Integrity: Signatures + commitments + AEAD prevent forgery and tampering.
- Robustness: Shamir threshold allows dropout reconciliation; clients that drop before share distribution are excluded.
- DP: Distributed noise prevents servers or adversary learning true aggregate within ε,δ.
Trade-offs
- Two-server model is efficient but trusts non-collusion. k-server MPC removes that but costs communication.
- HE avoids pairwise masking but is heavier and less robust to dropouts without MPC.
This design balances provable cryptographic secrecy, dropout resilience via threshold sharing and mask cancellation, and rigorous DP via distributed noise — suitable for a cryptographer to implement and analyze formally.
Describe the key ideas behind federated learning and how it enables on-device model training without centralizing raw user data. Explain the typical aggregation steps, how updates are protected in transit, and list potential privacy pitfalls a cryptographer should consider (e.g., model inversion, poisoning, and client-level privacy).
Sample Answer
Brief summary of federated learning (FL)
FL trains models across many devices by keeping raw data local. Devices compute local model updates (e.g., gradient or weight deltas) and send only updates to a central coordinator; the coordinator aggregates updates into a global model and sends the new model back.
Typical aggregation steps
- Server broadcasts current global model to selected clients.
- Each client computes local training update (epochs on local data) → produces delta or gradient.
- Clients optionally compress/quantize updates and authenticate them.
- Server runs aggregation (common: FedAvg — weighted average of deltas by client sample counts), updates global model, and repeats.
Protecting updates in transit and during aggregation
- Standard transport confidentiality/integrity: mutual TLS + client auth.
- Secure aggregation (MPC-style): clients secret-share encrypted updates so server learns only the aggregated sum, not individual contributions.
- Homomorphic encryption: clients encrypt updates; server aggregates ciphertexts and decrypts aggregate with threshold key.
- Authenticated signatures to prevent tampering/Sybil.
- Use differential privacy (DP) at client or server to add calibrated noise before release.
Privacy pitfalls a cryptographer must consider
- Model inversion / reconstruction: gradients can leak training examples; per-update DP or gradient clipping helps.
- Membership inference: attacker can test whether a user’s data influenced model — mitigated by DP.
- Poisoning and backdoor attacks: malicious clients send crafted updates; defenses include robust aggregation (median, trimmed mean), anomaly detection, and secure attestation.
- Client-level privacy vs. record-level: protecting a client's entire dataset requires stronger DP (higher noise).
- Collusion and threshold attacks: colluding server+clients can break MPC assumptions; must model adversary capabilities.
- Side-channels and metadata leaks: selection patterns, update sizes, timing can leak information.
- Trade-offs: DP/cryptographic protections reduce utility and increase compute/communication; choose mechanisms matching threat model and performance budget.
As a cryptographer, design protocols with explicit adversary models, combine cryptographic secure-aggregation with calibrated DP, and validate robustness against poisoning and reconstruction attacks.
Unlock Full Question Bank
Get access to all 8 Privacy-Enhancing Technologies and Anonymization interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.