PostQuantum.FileEncryption.Analyzers 1.6.0

Requires NuGet 6.0.0 or higher.

dotnet add package PostQuantum.FileEncryption.Analyzers --version 1.6.0
                    
NuGet\Install-Package PostQuantum.FileEncryption.Analyzers -Version 1.6.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.FileEncryption.Analyzers" Version="1.6.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.FileEncryption.Analyzers" Version="1.6.0" />
                    
Directory.Packages.props
<PackageReference Include="PostQuantum.FileEncryption.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.FileEncryption.Analyzers --version 1.6.0
                    
#r "nuget: PostQuantum.FileEncryption.Analyzers, 1.6.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.FileEncryption.Analyzers@1.6.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.FileEncryption.Analyzers&version=1.6.0
                    
Install as a Cake Addin
#tool nuget:?package=PostQuantum.FileEncryption.Analyzers&version=1.6.0
                    
Install as a Cake Tool

PostQuantum.FileEncryption.Analyzers

Roslyn analyzers that catch dangerous misuse of the PostQuantum.FileEncryption family at compile time — in the IDE, before the mistake ships.

Real-world encryption failures overwhelmingly come from misuse, not broken primitives. The library's API is fail-closed by design; these rules extend that discipline to the calling code.

dotnet add package PostQuantum.FileEncryption.Analyzers --version 1.6.0

A development-only dependency: nothing is added to your runtime output or your users' dependency graph.

The rules

Rule Severity What it catches
PQFE101 Warning A compile-time-constant passphrase (literal or const) passed to any encrypt/decrypt/export API. A passphrase in source ships with every binary and lives in source control forever — the encryption then protects nothing against anyone who has either.
PQFE102 Warning Raw private-key bytes written to diskFile.WriteAllBytes(path, key.Export()). ExportEncrypted exists for exactly this job: an authenticated, Argon2id-hardened key file that fails closed on a wrong passphrase or tampering. Public keys are exempt (they're public).
PQFE103 Warning A discarded encrypt/decrypt/sign/verify task. Unlike the compiler's CS4014, this fires in synchronous methods too. A discarded task means the operation — and its authentication — may never complete, and its failure is never observed. An explicit _ = discard is treated as deliberate and not flagged.
PQFE104 Warning A silently swallowed fail-closed exception — an empty catch (PqDecryptionException) / PqSignatureException / PqEncryptionException block. These exceptions are the library's signal that data is inauthentic or forged; an empty catch turns that hard stop into silent success. Probing with catch (PqFormatException) ("is this even a container?") is legitimate and exempt.

Every rule links to the long-form reasoning in docs/ANTI-PATTERNS.md.

Design principles

  • High confidence over high coverage. Each rule fires only on shapes that are almost certainly wrong; a quiet analyzer that is trusted beats a chatty one that gets disabled.
  • Escape hatches are explicit. #pragma warning disable PQFE10x (or an _ = discard for PQFE103) records the decision in the code, where a reviewer can see it.
  • No runtime opinions. The analyzers never change behavior; the library's fail-closed contract is enforced by the library itself. These rules just move the feedback earlier.

The rule IDs live in the PQFE1xx range; PQFE0xx is reserved for the library's own [Obsolete] diagnostics.

To God be the glory — 1 Corinthians 10:31.

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.6.0 297 7/11/2026
1.5.0 317 7/2/2026

1.5.0 — first release of the analyzer package, versioned in lockstep with the PostQuantum.FileEncryption family. Rules PQFE101–PQFE104: hard-coded passphrases, raw private-key bytes written to disk, discarded encrypt/decrypt/sign/verify tasks, and silently swallowed fail-closed exceptions. See the package README and docs/ANTI-PATTERNS.md for the reasoning behind each rule.