मुख्य सामग्री पर जाएँ
Skillpedia
सिक्योरिटी8.0k · #12726

crypto-protocol-diagram

यह क्या करती है

यह स्किल सुरक्षित संचार प्रोटोकॉल के सोर्स कोड, मानक दस्तावेज़ या फ़ॉर्मल मॉडल को पढ़कर उसे मैसेज फ़्लो डायग्राम में बदलती है। यह हैंडशेक या की-एक्सचेंज समझने वाले इंजीनियरों और सुरक्षा रिव्यूअर्स के लिए है।

कब इस्तेमाल करें

  • ✓जब आपको हैंडशेक, की-एक्सचेंज या दूसरे बहु-पक्षीय क्रिप्टो फ़्लो का डायग्राम बनाना है।
  • ✓जब आपके पास RFC या पेपर है जो प्रोटोकॉल बताता है और आप उसका मैसेज क्रम दर्शाना चाहते हैं।
  • ✓जब आपके पास ProVerif या Tamarin मॉडल है और आप उसका पढ़ने योग्य डायग्राम चाहते हैं।

Skill का लिंक

https://github.com/trailofbits/skills/blob/main/plugins/trailmark/skills/crypto-protocol-diagram/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/trailofbits/skills/blob/main/plugins/trailmark/skills/crypto-protocol-diagram/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“क्या आप इस की-एक्सचेंज कोड के मैसेज चरणों का डायग्राम बना सकते हैं?”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

यह पता लगाती है कि कौन किसे क्या भेजता है और हर बिंदु पर कौन-सा एन्क्रिप्शन या साइनिंग चरण होता है, फिर एक Mermaid sequence डायग्राम और एक सादा टेक्स्ट संस्करण लिखती है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

Crypto Protocol Diagram

Produces a Mermaid sequenceDiagram (written to file) and an ASCII sequence diagram (printed inline) from either:

  • Source code implementing a cryptographic protocol, or
  • A specification — RFC, academic paper, pseudocode, informal prose, ProVerif (.pv), or Tamarin (.spthy) model.

Tools used: Read, Write, Grep, Glob, Bash, WebFetch (for URL specs).

Unlike the diagramming-code skill (which visualizes code structure), this skill extracts protocol semantics: who sends what to whom, what cryptographic transformations occur at each step, and what protocol phases exist.

For call graphs, class hierarchies, or module dependency maps, use the diagramming-code skill instead.

When to Use

  • User asks to diagram, visualize, or extract a cryptographic protocol
  • Input is source code implementing a handshake, key exchange, or multi-party protocol
  • Input is an RFC, academic paper, pseudocode, or formal model (ProVerif/Tamarin)
  • User names a specific protocol (TLS, Noise, Signal, X3DH, FROST)

When NOT to Use

  • User wants a call graph, class hierarchy, or module dependency map — use diagramming-code
  • User wants to formally verify a protocol — use mermaid-to-proverif (after generating the diagram)
  • Input has no cryptographic protocol semantics (no parties, no message exchange)

Rationalizations to Reject

Rationalization Why It's Wrong Required Action
"The protocol is simple, I can diagram from memory" Memory-based diagrams miss steps and invert arrows Read the source or spec systematically
"I'll skip the spec path since code exists" Code may diverge from the spec — both paths catch different bugs When both exist, run spec workflow first, then annotate code divergences
"Crypto annotations are optional decoration" Without crypto annotations, the diagram is just a message flow — useless for security review Annotate every cryptographic operation
"The abort path is obvious, no need for alt blocks" Implicit abort handling hides missing error checks Show every abort/error path with alt blocks
"I don't need to check the examples first" The examples define the expected output quality bar Study the relevant example before working on unfamiliar input
"ProVerif/Tamarin models are code, not specs" Formal models are specifications — they describe intended behavior, not implementation Use the spec workflow (S1–S5) for .pv and .spthy files

Workflow

Protocol Diagram Progress:
- [ ] Step 0: Determine input type (code / spec / both)
- [ ] Step 1 (code) or S1–S5 (spec): Extract protocol structure
- [ ] Step 6: Generate sequenceDiagram
- [ ] Step 7: Verify and deliver

Step 0: Determine Input Type

Before doing anything else, classify the input:

Signal Input type
Source file extensions (.py, .rs, .go, .ts, .js, .cpp, .c) Code
Function/class definitions, import statements Code
RFC-style section headers (§, Section X.Y, MUST/SHALL keywords) Spec
Algorithm/Protocol/Figure labels, mathematical notation Spec
ProVerif file (.pv) with process, let, in/out Spec
Tamarin file (.spthy) with rule, --[...]-> Spec
Plain prose or numbered steps describing a protocol Spec
Both source files and a spec document Both (annotate divergences with ⚠️)
  • Code only → skip to Step 1 below
  • Spec only → skip to Spec Workflow (S1–S5) below
  • Both → run Spec Workflow first, then use the code-reading steps to verify the implementation against the spec diagram and annotate any divergences with ⚠️
  • Ambiguous → ask the user: "Is this a source code file, a specification document, or both?"

Step 1: Locate Protocol Entry Points

Grep for function names, type names, and comments that reveal the protocol:

# Find handshake, session, round, phase entry points
rg -l "handshake|session_init|round[_0-9]|setup|keygen|send_msg|recv_msg" {targetDir}

# Find crypto primitives in use
rg "sign|verify|encrypt|decrypt|dh|ecdh|kdf|hkdf|hmac|hash|commit|reveal|share" \
    {targetDir} --type-add 'src:*.{py,rs,go,ts,js,cpp,c}' -t src -l

Start reading from the highest-level orchestration function — the one that calls into handshake phases or the main protocol loop.

Step 2: Identify Par

अक्सर पूछे जाने वाले सवाल

कौन-से इनपुट फ़ॉर्मैट काम करते हैं?

सोर्स कोड, RFCs, अकादमिक पेपर, pseudocode, सादा गद्य, और ProVerif या Tamarin मॉडल फ़ाइलें, सब काम करते हैं।

क्या डायग्राम मैसेज के साथ क्रिप्टो चरण भी दिखाता है?

हाँ। हर चरण में साइनिंग या की डेरिवेशन जैसा क्रिप्टो ऑपरेशन शामिल हो सकता है।

क्या यह कोड स्ट्रक्चर डायग्राम जैसा ही है?

नहीं। यह प्रोटोकॉल मैसेज दिखाता है, फ़ंक्शन कॉल या क्लास की बनावट नहीं।

जानकारी

लेखक का मूल विवरण

Extracts protocol message flow from source code, RFCs, academic papers, pseudocode, informal prose, ProVerif (.pv), or Tamarin (.spthy) models and generates Mermaid sequenceDiagrams with cryptographic annotations. Use when diagramming a crypto protocol, visualizing a handshake or key exchange flow, extracting message flow from a spec or RFC, diagramming a ProVerif or Tamarin model, or drawing sequence diagrams for TLS, Noise, Signal, X3DH, Double Ratchet, FROST, DH, or ECDH protocols.

repo: trailofbits/skills

लोकप्रियता

GitHub स्टार
8.0k
रैंकिंग में स्थान
#12726
लाइसेंस
CC-BY-SA-4.0
अपडेट की गई
2/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

audit-context-building

8.0k

यह आपके एजेंट को सुरक्षा जाँच से पहले किसी अनजान कोड को समझने में मदद करती है, हर फ़ंक्शन की मान्यताएँ और निर्भरताएँ नक्शे में दिखाकर।

कोडिंगसिक्योरिटी

algorand-vulnerability-scanner

8.0k

यह आपके एजेंट को Algorand कॉन्ट्रैक्ट्स में 11 आम सुरक्षा समस्याएँ जाँचने में मदद करती है, जैसे रीकीइंग हमले और बिना जाँची फ़ीस।

कोडिंगसिक्योरिटी

audit-prep-assistant

8.0k

यह आपके एजेंट को बाहरी सुरक्षा समीक्षा के लिए कोड तैयार करने में मदद करती है, जैसे स्टैटिक एनालिसिस, टेस्ट कवरेज और दस्तावेज़ीकरण।

कोडिंगसिक्योरिटी

cairo-vulnerability-scanner

8.0k

यह आपके एजेंट को StarkNet के Cairo कॉन्ट्रैक्ट्स में 6 गंभीर समस्याएँ जाँचने में मदद करती है, जैसे ओवरफ़्लो और सिग्नेचर रीप्ले।

कोडिंगसिक्योरिटी

मिलती-जुलती skills