PostQuantum.Hybrid.TestingSupport 1.1.1

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

PostQuantum.Hybrid.TestingSupport

Test helpers for projects that consume PostQuantum.Hybrid.

Install

dotnet add package PostQuantum.Hybrid.TestingSupport

What's in the box

API Use
HybridTestKeys.SharedKemPair / SharedSignaturePair Lazily-cached, process-wide key pair. Skips the 300 ms keygen cost when many tests need a key pair but don't care which one.
HybridTestKeys.GenerateFresh*KeyPair() Fresh key pair per call. Use when each test must have its own.
HybridTamper.FlipBit(bytes, byteIndex, bitIndex) Returns a copy of bytes with the specified bit flipped — exact-position tamper injection.
HybridTamper.FlipRandomBit(bytes, seed) Deterministically pseudorandom single-bit flip from a seed.
HybridTamper.TruncateBy(bytes, count) / ExtendBy(bytes, count) Length-tamper helpers.
FakeHybridKemKeyProvider(pair) / FakeHybridSignatureKeyProvider(pair) Minimal IHybridKemKeyProvider / IHybridSignatureKeyProvider implementations for unit tests that wire through the PostQuantum.Hybrid.AspNetCore abstractions without spinning a real host.

Quick start

using PostQuantum.Hybrid;
using PostQuantum.Hybrid.TestingSupport;
using Xunit;

public class MyEnvelopeTests
{
    [Fact]
    public void RoundTrips()
    {
        var pair = HybridTestKeys.SharedKemPair;
        using var enc = HybridKem.Encapsulate(pair.PublicKey);
        var dec = HybridKem.Decapsulate(pair.PrivateKey, enc.Ciphertext);
        Assert.Equal(enc.SharedSecret, dec);
    }

    [Fact]
    public void Decapsulate_TamperedCiphertext_ProducesDifferentSecret()
    {
        var pair = HybridTestKeys.SharedKemPair;
        using var enc = HybridKem.Encapsulate(pair.PublicKey);

        var tampered = HybridTamper.FlipBit(enc.Ciphertext.ToBytes(), byteIndex: 50, bitIndex: 0);
        var ct = HybridKemCiphertext.FromBytes(tampered);

        var dec = HybridKem.Decapsulate(pair.PrivateKey, ct);
        Assert.NotEqual(enc.SharedSecret, dec);
    }
}

Notes on shared keys

HybridTestKeys.SharedKemPair and SharedSignaturePair cache one key pair per process. They are safe to use across parallel xUnit tests because key generation is one-shot and the resulting key pair is immutable.

Do not use the shared keys in tests that mutate or dispose them. If you need to dispose, generate a fresh pair instead.

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 was computed.  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
1.1.1 36 6/10/2026
1.1.0 42 6/10/2026
1.0.1 95 6/8/2026
1.0.0 85 6/7/2026