skills/cryptographic-action-pattern/SKILL.md
Base security pattern for integrating cryptographic primitives into software systems. Use when implementing encryption, digital signatures, MACs, or any cryptographic operations. Provides guidance on library selection, key usage, configuration protection, and designing for cryptographic agility. Foundation pattern for Encryption, Digital signature, and MAC patterns.
npx skillsauth add igbuend/grimbard cryptographic-action-patternInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This pattern encapsulates the common considerations for integrating cryptographic primitives into a system. It acts as a foundation for specific patterns like Encryption, Digital Signature, and Message Authentication Code (MAC).
This pattern does not directly address a specific security problem but provides essential guidance for correctly applying cryptographic solutions. Proper implementation of cryptographic actions is crucial—incorrect usage can nullify all security guarantees.
| Role | Type | Responsibility | |------|------|----------------| | Entity | Entity | Wants to perform one or more cryptographic actions | | Cryptographer | Cryptographic Primitive | Library that provides cryptographic actions |
Entity → [crypto_action(input, keyInfo, config)] → Cryptographer
Cryptographer → [output] → Entity
One should always use existing, well-known libraries when integrating cryptography into a system.
Never attempt to:
Before selecting a library:
A cryptographic key should never be used for multiple purposes.
Examples of violations:
Why this matters:
Over time, vulnerabilities in ciphers or implementations will be discovered, and processing power will increase. Software should be designed to allow:
Recommended approach: Provide an API abstraction layer around the cryptography library. This abstraction:
If Entity provides configuration to Cryptographer:
In some cases, configuration may reveal information about:
Consider additional measures to keep configuration confidential when warranted.
This pattern is specialized by:
Each implementation provides specific considerations for that cryptographic action.
Pointers to cryptographic libraries can be found in:
development
Security anti-pattern for Cross-Site Scripting vulnerabilities (CWE-79). Use when generating or reviewing code that renders HTML, handles user input in web pages, uses innerHTML/document.write, or builds dynamic web content. Covers Reflected, Stored, and DOM-based XSS. AI code has 86% XSS failure rate.
development
Security anti-pattern for XPath injection vulnerabilities (CWE-643). Use when generating or reviewing code that queries XML documents, constructs XPath expressions, or handles user input in XML operations. Detects unescaped quotes and special characters in XPath queries.
development
Security anti-pattern for weak password hashing (CWE-327, CWE-759). Use when generating or reviewing code that stores or verifies user passwords. Detects use of MD5, SHA1, SHA256 without salt, or missing password hashing entirely. Recommends bcrypt, Argon2, or scrypt.
development
Security anti-pattern for weak encryption (CWE-326, CWE-327). Use when generating or reviewing code that encrypts data, handles encryption keys, or uses cryptographic modes. Detects DES, ECB mode, static IVs, and custom crypto implementations.