PostQuantum.DataProtection.Testing
0.1.0-preview.7
dotnet add package PostQuantum.DataProtection.Testing --version 0.1.0-preview.7
NuGet\Install-Package PostQuantum.DataProtection.Testing -Version 0.1.0-preview.7
<PackageReference Include="PostQuantum.DataProtection.Testing" Version="0.1.0-preview.7" />
<PackageVersion Include="PostQuantum.DataProtection.Testing" Version="0.1.0-preview.7" />
<PackageReference Include="PostQuantum.DataProtection.Testing" />
paket add PostQuantum.DataProtection.Testing --version 0.1.0-preview.7
#r "nuget: PostQuantum.DataProtection.Testing, 0.1.0-preview.7"
#:package PostQuantum.DataProtection.Testing@0.1.0-preview.7
#addin nuget:?package=PostQuantum.DataProtection.Testing&version=0.1.0-preview.7&prerelease
#tool nuget:?package=PostQuantum.DataProtection.Testing&version=0.1.0-preview.7&prerelease
PostQuantum.DataProtection.Testing
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 corePostQuantum.DataProtectionpreview 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
LocalContentKeyProviderwith a fixed test passphrase at the smallest Argon2id work factor. - A
FakePostQuantumKeyStore(in-memory, no disk I/O). - A
PostQuantumKeyManagerbound to both. AddDataProtection()configured with the PQ encryptor inHybridmode.
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.Testsalready does that; you don't need to. - Tests that pin file-format compatibility. Use
FilePostQuantumKeyStoreagainst a temp directory instead. - Tests that hit a real cloud Key Vault. Use the real
PostQuantum.DataProtection.AzureKeyVaultstore 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 | Versions 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. |
-
net10.0
- PostQuantum.DataProtection (>= 0.1.0-preview.7)
-
net8.0
- PostQuantum.DataProtection (>= 0.1.0-preview.7)
-
net9.0
- PostQuantum.DataProtection (>= 0.1.0-preview.7)
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.