Microsoft Is Using AI Agents to Mathematically Prove Its Encryption Code Has No Flaws

The team behind Windows and Azure's cryptography library isn't just testing the code. They're proving it correct, for every possible input, using formal mathematical proofs written partly by AI.

AI2Day NewsdeskAI-assistedPublished Updated Editor: Lee Brown3 min read
Illustration: a server motherboard UEFI firmware chip under cool blue rack
Illustration made with AI. Not a photograph of the events described.
Share

Key points

  • Microsoft's SymCrypt library, the cryptography engine used in Windows and Azure, is being formally verified using Rust, Lean, and Aeneas as of mid-2024.
  • The first verified algorithms released are SHA-3, a standard for creating digital fingerprints of data, and ML-KEM, a post-quantum encryption scheme designed to resist attacks from future quantum computers.
  • AI agents, software that carries out multi-step tasks on its own, are writing mathematical proof steps that human engineers then review independently.
  • Microsoft has open-sourced the verified code and proofs in a public SymCrypt branch, letting outside researchers inspect everything side by side.
  • Future algorithms planned for the same treatment include AES-GCM, FrodoKEM, and ML-DSA.

Cryptographic code is notoriously unforgiving. One missed bounds check, meaning a failure to confirm that a number stays within a safe range, can crack open security that looks sound on the surface. Testing catches many bugs. It doesn't catch all of them.

Microsoft Research has been working on a different approach: proving the code is correct, mathematically, before it ships.

The project centres on SymCrypt, Microsoft's open-source cryptographic library that runs inside Windows and Azure Linux. Engineers write new cryptographic algorithms in Rust, a language that rules out whole families of memory-safety errors by design. They then run those programs through a tool called Aeneas, which translates the code into a form that a proof assistant called Lean can reason about.

Lean isn't a chatbot. It's a formal proof framework, software that checks mathematical arguments the way a calculator checks arithmetic, except it checks proofs and never makes arithmetic mistakes.

The goal is a theorem: for every valid input, this implementation returns exactly the result the published standard says it should. Not usually. Always.

The verified ML-KEM and SHA-3 code is already running in insider builds of Windows, so this isn't a research prototype sitting in a lab.

How does AI fit into a mathematical proof?

Writing formal proofs is slow. That's where AI agents come in.

Agents handle repetitive middle steps, drafting proof fragments that connect intermediate results. Human engineers focus on the parts requiring real judgment: checking that the formal specification matches what the published standard says and reviewing the high-level properties the code must satisfy. The proof-checking itself is fully automated and deterministic. The machine either accepts the proof or rejects it. There's no room for the agent to bluff.

Microsoft describes this as a clean split: agents write, humans review, the proof checker decides.

Our 15 July story on Microsoft's record 570-flaw security patch showed the company using AI to find bugs at scale. This project runs the other direction: using AI to prove, before release, that certain bugs cannot exist.

Should you worry about the gaps?

The first release covers two algorithms. Windows and Azure rely on many more, and the roadmap for AES-GCM, FrodoKEM, and ML-DSA has no public completion date. Formal verification is also only as trustworthy as the specification it proves the code against. If the spec misreads the standard, the proof is airtight and still wrong. Microsoft's methodology runs the Lean spec against official test vectors precisely to catch that kind of error, but it's a step humans have to get right before the machine can help.

For anyone whose files, logins, or cloud workloads sit on Microsoft infrastructure, the practical meaning is real: the encryption underneath is being held to a stricter standard than testing alone can provide. The open-sourced branch lets outside researchers verify that claim rather than take Microsoft's word for it.

Watch for: formally verified builds reaching stable Windows releases, and whether other cryptography libraries adopt similar AI-assisted proof workflows.

© 2026 AI2Day