PostQuantum.DataProtection.Testing 0.1.0-preview.7

This is a prerelease version of PostQuantum.DataProtection.Testing.
dotnet add package PostQuantum.DataProtection.Testing --version 0.1.0-preview.7
                    
NuGet\Install-Package PostQuantum.DataProtection.Testing -Version 0.1.0-preview.7
                    
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.DataProtection.Testing" Version="0.1.0-preview.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PostQuantum.DataProtection.Testing" Version="0.1.0-preview.7" />
                    
Directory.Packages.props
<PackageReference Include="PostQuantum.DataProtection.Testing" />
                    
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.DataProtection.Testing --version 0.1.0-preview.7
                    
#r "nuget: PostQuantum.DataProtection.Testing, 0.1.0-preview.7"
                    
#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.DataProtection.Testing@0.1.0-preview.7
                    
#: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.DataProtection.Testing&version=0.1.0-preview.7&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=PostQuantum.DataProtection.Testing&version=0.1.0-preview.7&prerelease
                    
Install as a Cake Tool

PostQuantum.DataProtection.Testing

License: MIT

Test fakes for PostQuantum.DataProtection. Write unit tests against your own code that consumes the PQ data-protection chain, without standing up a real ML-KEM keypair, a real classical KEK, or a real file on disk.

⚠️ Preview (0.1.0-preview.4). Tracks the core PostQuantum.DataProtection preview cadence.

Install

dotnet add package PostQuantum.DataProtection.Testing --prerelease

Use it

using Microsoft.AspNetCore.DataProtection;
using Microsoft.Extensions.DependencyInjection;

[Fact]
public void My_service_protects_and_unprotects_round_trips()
{
    var services = new ServiceCollection();
    services.AddPostQuantumDataProtectionTesting();   // ← the one line
    using ServiceProvider sp = services.BuildServiceProvider();

    IDataProtectionProvider dp = sp.GetRequiredService<IDataProtectionProvider>();
    IDataProtector protector = dp.CreateProtector("my.purpose");

    string protectedToken = protector.Protect("hello");
    string roundtripped = protector.Unprotect(protectedToken);

    Assert.Equal("hello", roundtripped);
}

AddPostQuantumDataProtectionTesting() wires:

  • A LocalContentKeyProvider with a fixed test passphrase at the smallest Argon2id work factor.
  • A FakePostQuantumKeyStore (in-memory, no disk I/O).
  • A PostQuantumKeyManager bound to both.
  • AddDataProtection() configured with the PQ encryptor in Hybrid mode.

The chain generates a fresh ML-KEM-768 keypair on first use, wraps the secret key under the host KEK, and persists everything in memory only. Tests are isolated from each other because the service provider scopes the fakes.

When NOT to use this

  • End-to-end tests of the PQ chain itself. The core repo's tests/PostQuantum.DataProtection.Tests already does that; you don't need to.
  • Tests that pin file-format compatibility. Use FilePostQuantumKeyStore against a temp directory instead.
  • Tests that hit a real cloud Key Vault. Use the real PostQuantum.DataProtection.AzureKeyVault store against a test vault.

The fakes here are for your tests, against your code that consumes the abstraction. They are deliberately tiny and stateless.


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

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.1.0-preview.7 55 6/4/2026
0.1.0-preview.6 51 6/4/2026
0.1.0-preview.5 64 6/4/2026
0.1.0-preview.4 51 6/4/2026

0.1.0-preview.4: First public preview. Test fakes for PostQuantum.DataProtection. Ships FakePostQuantumKeyStore (in-memory IPostQuantumKeyStore) and a one-line DI helper (AddPostQuantumDataProtectionTesting) so consumer projects can write unit tests against their own code without standing up a real ML-KEM keypair, a real classical KEK, or a real file on disk.