dotnet-cryptography

Implements correct System.Security.Cryptography primitives for hashing, encryption, signing, and key derivation in .NET.

1|Updated Jun 2, 2026
One-click install
npx skills add https://github.com/envoydev/claude-stack --skill dotnet-cryptography-envoydev
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dotnet-cryptography
Source: https://github.com/envoydev/claude-stack/tree/main/stack/skills/dotnet-cryptography
Command: npx skills add https://github.com/envoydev/claude-stack --skill dotnet-cryptography-envoydev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? .NET exposes correct cryptographic primitives that are easy to assemble incorrectly - wrong padding, reused nonces, fast hashes for passwords, and timing-leaking comparisons are common production bugs. This Skill encodes the single correct usage pattern for each primitive in System.Security.Cryptography so encryption, hashing, signing, and key derivation are done right the first time. ## Core Features & Use Cases - Primitive selection and correct usage: Covers SHA-256+ hashing, HMAC, PBKDF2 password hashing (600k+ iterations), AES-GCM authenticated encryption, RSA-OAEP, ECDsa/PSS signatures, and ECDH key agreement, each with its exact contract. - Dead-algorithm blocklist: Flags MD5, SHA-1, DES/3DES/RC4, AES-ECB, RSA PKCS#1 v1.5, and BinaryFormatter for replacement on sight. - Post-quantum opt-in: Documents the .NET 10 ML-KEM / ML-DSA primitives with IsSupported gating and hybrid classical+PQC migration strategy. - Use Case: When adding at-rest encryption to an ASP.NET service, use this Skill to implement AES-GCM with a fresh 12-byte nonce per message, a pinned 16-byte tag, and associated data binding - then prove it with a tamper test that must throw. ## Quick Start Use the dotnet-cryptography skill to add AES-GCM encryption with proper nonce and tag handling to my .NET 8 service.

Frequently Asked Questions about dotnet-cryptography

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I hash passwords in .NET?▼

Use PBKDF2 via Rfc2898DeriveBytes.Pbkdf2 with SHA-256, a per-user 16+ byte random salt, and 600,000+ iterations. Persist the algorithm, iteration count, salt, and digest together, and verify with a constant-time comparison. Argon2id is stronger but requires a third-party package.

How to encrypt data with AES-GCM in C#?▼

Construct AesGcm with the explicit tag-size overload, generate a fresh 12-byte nonce per encryption from RandomNumberGenerator, and store nonce, ciphertext, and 16-byte tag together. Never reuse a nonce under the same key - it breaks GCM's confidentiality and authenticity.

Does AesGcm work on .NET Framework 4.8?▼

No, AesGcm is a .NET Core 3.0+ type and does not compile on stock net48. Use a package like Microsoft.Bcl.Cryptography or a CNG P/Invoke, or fall back to AES-CBC plus HMAC with encrypt-then-MAC.

Why should I avoid MD5 and SHA-1 in .NET code?▼

MD5 and SHA-1 are broken for collision resistance and must be replaced with SHA-256 or stronger. The same blocklist covers DES, 3DES, RC4, AES-ECB, RSA PKCS#1 v1.5 padding, and BinaryFormatter, all of which appear in legacy code and tutorials.

When should I use post-quantum cryptography in .NET?▼

ML-KEM, ML-DSA, and SLH-DSA arrive in .NET 10 over platform crypto and are not on the .NET 8 floor. Gate every call on the static IsSupported property, keep a classical fallback, and prefer hybrid classical-plus-PQC schemes during migration.