PostQuantum.Hybrid.Analyzers 1.1.1

dotnet add package PostQuantum.Hybrid.Analyzers --version 1.1.1
                    
NuGet\Install-Package PostQuantum.Hybrid.Analyzers -Version 1.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PostQuantum.Hybrid.Analyzers" Version="1.1.1">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PostQuantum.Hybrid.Analyzers" Version="1.1.1" />
                    
Directory.Packages.props
<PackageReference Include="PostQuantum.Hybrid.Analyzers">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PostQuantum.Hybrid.Analyzers --version 1.1.1
                    
#r "nuget: PostQuantum.Hybrid.Analyzers, 1.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PostQuantum.Hybrid.Analyzers@1.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PostQuantum.Hybrid.Analyzers&version=1.1.1
                    
Install as a Cake Addin
#tool nuget:?package=PostQuantum.Hybrid.Analyzers&version=1.1.1
                    
Install as a Cake Tool

PostQuantum.Hybrid.Analyzers

Roslyn analyzers that detect common misuse patterns of PostQuantum.Hybrid at build time.

Install

dotnet add package PostQuantum.Hybrid.Analyzers

The analyzers run automatically inside the .NET build; no further wiring is required.

Rules

ID Severity What it flags
PQH001 Warning HybridKemKeyPair, HybridKemPrivateKey, HybridSignatureKeyPair, HybridSignaturePrivateKey, or HybridKemEncapsulationResult created without using and without an explicit Dispose() call before the variable goes out of scope.
PQH002 Warning HybridKemEncapsulationResult.SharedSecret passed directly as the first argument to AesGcm/AesCcm/ChaCha20Poly1305/HMACSHA* instead of being fed through HKDF.Expand first.
PQH003 Warning HybridKem.Decapsulate(...) called earlier in a method body than HybridSignature.Verify(...). Verification must precede decapsulation in sign-then-encrypt flows.
PQH004 Warning HybridSignature.Verify(...) called with its bool return value discarded. Ignoring the return is equivalent to skipping signature verification.
PQH005 Warning AesGcm.Encrypt / .Decrypt called without associatedData inside a method body that also calls HybridKem.Encapsulate / .Decapsulate. Bind the KEM ciphertext as associatedData.

Suggestions welcome via GitHub issues.

Auto-fixes (code-fix providers)

Every rule ships an IDE code-fix provider so the squiggly carries a 1-keystroke "Quick Actions" remedy in VS / Rider / VS Code:

ID Code fix
PQH001 Wrap the declaration in using
PQH002 Wrap .SharedSecret in HKDF.DeriveKey(SHA256, secret, 32, salt: null, info: /* TODO */)
PQH003 Move the verify guard statement above the Decapsulate call
PQH004 Wrap the call in if (!HybridSignature.Verify(...)) throw new CryptographicException("...");
PQH005 Add an associatedData argument bound to the in-scope KEM ciphertext (TODO placeholder if none found)

Examples

PQH001

// ❌ Flagged
var pair = HybridKem.GenerateKeyPair();

// ✅ OK
using var pair = HybridKem.GenerateKeyPair();

PQH004

// ❌ Flagged (ignored bool return)
HybridSignature.Verify(pub, msg, sig);

// ❌ Flagged (explicitly discarded)
_ = HybridSignature.Verify(pub, msg, sig);

// ✅ OK
if (!HybridSignature.Verify(pub, msg, sig))
{
    throw new CryptographicException("Signature failed.");
}

Suppressing a warning

Use a standard pragma or [SuppressMessage] attribute if you have a legitimate reason:

#pragma warning disable PQH001
var pair = HybridKem.GenerateKeyPair();
// ... transferred to long-lived storage that disposes elsewhere
#pragma warning restore PQH001
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.1 101 6/10/2026
1.1.0 93 6/10/2026
1.0.1 105 6/8/2026
1.0.0 89 6/7/2026