mermaid to proverif

AI Community

Skill notes

When to Use

User asks to formally verify a cryptographic protocol described as a Mermaid sequenceDiagram User wants to generate a ProVerif model (.pv file) from a protocol diagram User wants to prove secrecy, authentication, or forward secrecy properties Input is the output of the crypto-protocol-diagram skill

When NOT to Use

No Mermaid sequenceDiagram exists yet — use crypto-protocol-diagram first to generate one User wants to verify properties of non-cryptographic systems (state machines, access control) User wants to run ProVerif on an existing .pv file — just run proverif model.pv directly

Rationalizations to Reject

Rationalization · Why It's Wrong · Required Action "Reachability queries are just busywork" · If events aren't reachable, all other query results are meaningless · Always add reachability queries first as a sanity check "Public channels are fine for all messages" · Private channels for internal state prevent false attacks · Use private channels for intra-process state threading "I'll skip the forward secrecy test" · Ephemeral keys demand forward secrecy verification · Add the ForwardSecrecyTest process whenever the diagram shows ephemeral keys

Step 1: Parse Participants and Channels

From the Mermaid diagram: Extract every participant or actor declaration. Each becomes a ProVerif process. Count message arrows (->>, -->>, -x, --x). Each distinct A ->> B: label creates a communication step on a channel.

Step 2: Inventory Cryptographic Operations

Walk through every Note over annotation and message label. Build a list of all distinct operations used. Map each to a ProVerif declaration category: Mermaid annotation · ProVerif category keygen() → sk, pk · New name (new sk), public key derived via function DH(sk_A, pk_B) · DH function or exp with group

Fluxly profile Runtime and permissions are inferred by Fluxly static checks, not author declarations or runtime test results.
Domain
AI
Author-declared agents
No explicit declaration found; this is not inferred or tested compatibility
Static check
88 / 100 · heuristic scan, not runtime safety proof
Runtime evidence
Not run; no isolated runtime test evidence is currently recorded
Author / version / license
@trailofbits · no license declared
Token usage
Lean
Setup complexity
Manual integration
External API key
Required · Vendor-specific
Operating systems
Unspecified (assume cross-platform)
Runtime requirements
No explicit requirements detected
Detected file/system behavior
  • Read-only
  • Write / modify
  • Shell exec
Network behavior
External requests
Install commands
None (reference only)

Heads up: Tool permissions are not declared; actual access depends on the runtime.

01
Step 1: Parse Participants and Channels

From the Mermaid diagram: Extract every `participant` or `actor` declaration. Each becomes a ProVerif process. Count message arrows (`->>`, `-->>`, `-x`, `--x`). Each distinct `A ->> B: label` creates a communication step on a channel.

02
Step 2: Inventory Cryptographic Operations

Walk through every `Note over` annotation and message label. Build a list of all distinct operations used. Map each to a ProVerif declaration category: Mermaid annotation · ProVerif category `keygen() → sk, pk` · New name (`new sk`), public key derived via function `DH(sk_A, pk_B)` · DH function or `exp` with group

03
Step 3: Declare Types, Functions, and Equations

Build the cryptographic preamble in this order: Types — declare custom types used to distinguish key material: Constants — for fixed strings used as domain separators or labels: Functions — constructors and destructors. Destructors use inline `reduc` so that the process aborts on verification or decryption failure:

04
Step 4: Identify and Declare Events

Events mark security-relevant moments in the protocol execution. Extract them by identifying: Begin events (`event beginRole(params)`): triggered immediately before a party sends a message that depends on a long-term identity commitment (e.g., right before sending a signed message or a MAC'd message).

05
Step 5: Formulate Security Queries

Write one query per security property. Choose from: Reachability (always add first — structural sanity check): Verify that the success events are actually reachable. If ProVerif reports any of these as `false`, the model has a structural bug (dead receive, type mismatch, impossible guard) and no other query result should be trusted. Once the model

06
Step 6: Write Participant Processes

Write one `let` process per participant. Structure each process to mirror the Mermaid diagram step-by-step, in order. Template for a two-party protocol: Rules for writing processes: Each `A ->> B: msg_contents` in the diagram becomes:

07
Step 7: Write Main Process and Finalize

The main process: Generates long-term keys with `new` Publishes public keys to the attacker via `out(c, pk(sk))` Runs participant processes in parallel under replication (`!`) to allow multiple sessions

08
Step 8: Verify and Deliver

Before writing the file: [ ] Every participant in the diagram has a matching `let` process [ ] Every `out(c, ...)` has a matching `in(c, ...)` on the other side with compatible types [ ] Every function used in a process is declared in the preamble

Discussion

Powered by GitHub Discussions. Sign in with GitHub to comment, react, or subscribe.