PostQuantum.Hybrid.Analyzers
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package PostQuantum.Hybrid.Analyzers --version 1.0.0
NuGet\Install-Package PostQuantum.Hybrid.Analyzers -Version 1.0.0
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.0.0"> <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.0.0" />
<PackageReference Include="PostQuantum.Hybrid.Analyzers"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
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.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: PostQuantum.Hybrid.Analyzers, 1.0.0"
#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.0.0
#: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.0.0
#tool nuget:?package=PostQuantum.Hybrid.Analyzers&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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.
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.