Saltar al contenido principal
Back to blog
PrivacySecurity

Practical Cryptography for AI in Municipalities: MPC and HE Step by Step

September 19, 20264 min readOptimTech
Share:

Why consider MPC and HE in local government

Municipalities handle sensitive data (recipients of grants, tax files, fines) and at the same time need to collaborate across entities to detect fraud, optimize resources or train models. Cryptographic techniques like secure multi-party computation (MPC) and homomorphic encryption (HE) make it possible to run analyses and computations on data without exposing the original information. Applied with practical criteria, they reduce privacy risks and enable inter-municipal collaboration without large-scale transfers of personal data.

Brief technical explanation for managers

  • MPC: multiple parties perform a joint computation over their private data and obtain the result without revealing individual inputs. Useful for aggregated statistics, collaborative scoring or pattern detection.
  • HE: allows operations on encrypted data; a server can apply models or aggregations without decrypting the data. It’s appropriate when you outsource inferences to a provider but want to guarantee confidentiality.

Neither technique is a "magic wand": they involve computational costs and specific data-flow design.

Concrete municipal use cases

  • Collaborative detection of grant fraud: several municipalities run an MPC routine to identify beneficiaries with anomalous patterns without exchanging full histories.
  • Enriching citizen service models: a municipality uses HE so a provider can run inferences on encrypted citizen data and return results without accessing raw data.
  • Inter-administrative statistics: compute aggregated indicators (e.g., co-financing or service usage) via MPC to meet transparency goals without disclosing personal records.

Legal and security requirements you should consider

  • GDPR: even if data remain encrypted, it’s still necessary to clarify who is responsible (controller/processor) and establish the legal bases. Always perform a Data Protection Impact Assessment (DPIA) when processing is large-scale or sensitive.
  • ENS (Royal Decree 311/2022): any solution must meet the security requirements applicable to information processing, including access controls, key management and traceability.
  • Public procurement: draft tender specifications that require tests of technical conformity (performance, response times), portability measures and exit and audit clauses.

Practical limitations and how to mitigate them

  • Performance: HE and MPC are slower than cleartext operations. Mitigation: apply these techniques only in critical phases (e.g., final scoring) and combine them with hybrid pipelines (local cleartext preprocessing + confidential computation).
  • Implementation complexity: integrate proven libraries (SEAL, PALISADE, MP-SPDZ) and consider providers with experience in public sector environments. Avoid closed solutions that cannot be audited.
  • Accuracy and functionality: some operations (divisions, non-linear functions) are costly in HE. Design compatible algorithms or use acceptable mathematical approximations for the objective.

Procurement and technical evaluation process (practical)

  • Define the use case with success metrics: maximum latency, cost per query, false positive/negative rates.
  • Request reproducible tests: a PoC with synthetic or anonymized data that includes timings, resource consumption and security logs.
  • Require ENS compliance and GDPR documentation: data-flow diagrams, roles, processing agreements and a preliminary DPIA.
  • Include independent audit and rights to verify code/algorithms where possible.

Operational checklist to launch a pilot (5 steps)

  1. Identify a high-benefit, low-risk case (e.g., inter-municipal statistics on non-sensitive indicators).
  2. Conduct a DPIA and define legal roles between entities.
  3. Prepare synthetic data and performance tests (stress test).
  4. Run a technical PoC with defined metrics and ENS/GDPR evaluation.
  5. Review results, define a scaling plan and contract clauses (SLAs, audits, portability).

Governance best practices

  • Document decisions: model cards, data sheets and processing records tied to the project.
  • Maintain human oversight: cryptographic outputs should be reviewed by responsible units and legal teams.
  • Plan for operational continuity: define a fallback if performance falls short.
  • Training: educate technical teams and procurement officers on the limits and guarantees of cryptography.

Pilot example (operational summary)

Goal: compute an aggregated fraud-risk index for grants across three municipalities in 3 months.

  • Week 1–2: define metrics, legal roles and DPIA.
  • Week 3–6: prepare synthetic data and ENS environment (keys, access).
  • Week 7–10: PoC with MPC to compute indices; measure latency and accuracy.
  • Week 11–12: external audit and scaling decision.

Conclusion and recommended action

Cryptographic techniques (MPC and HE) make it possible to advance collaborative analyses without moving personal data, but they require technical design, a DPIA and ENS compliance. Immediate action: choose a low-risk pilot case — inter-municipal statistics or non-determinative scoring — and launch a 3-month PoC with a DPIA and performance tests. A well-defined pilot will give you the evidence needed to negotiate contractual requirements and assess safe scaling to other areas. If you need an implementation framework or diagnostic, tools like OptimGov Ready can be integrated as initial support in the evaluation phase.