PostQuantum.Hybrid.AspNetCore
1.1.1
dotnet add package PostQuantum.Hybrid.AspNetCore --version 1.1.1
NuGet\Install-Package PostQuantum.Hybrid.AspNetCore -Version 1.1.1
<PackageReference Include="PostQuantum.Hybrid.AspNetCore" Version="1.1.1" />
<PackageVersion Include="PostQuantum.Hybrid.AspNetCore" Version="1.1.1" />
<PackageReference Include="PostQuantum.Hybrid.AspNetCore" />
paket add PostQuantum.Hybrid.AspNetCore --version 1.1.1
#r "nuget: PostQuantum.Hybrid.AspNetCore, 1.1.1"
#:package PostQuantum.Hybrid.AspNetCore@1.1.1
#addin nuget:?package=PostQuantum.Hybrid.AspNetCore&version=1.1.1
#tool nuget:?package=PostQuantum.Hybrid.AspNetCore&version=1.1.1
PostQuantum.Hybrid.AspNetCore
ASP.NET Core dependency-injection extensions for PostQuantum.Hybrid.
Lets you load hybrid KEM and signature keys from configuration and inject them into your controllers and services without writing boilerplate.
▶ Live demo — https://demo.pqhybrid.systemslibrarian.dev — the
WebApiDemosample built on this package, deployed to Azure Container Apps with Swagger UI at the root. Hit/seal,/sign, and the public-key endpoints in your browser, no install. First request after idle cold-starts in ~1 min (scale-to-zero).
Install
dotnet add package PostQuantum.Hybrid.AspNetCore
Quick start
using PostQuantum.Hybrid.AspNetCore;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddPostQuantumHybrid(builder.Configuration.GetSection("Crypto"));
var app = builder.Build();
app.MapGet("/sign", (IHybridSignatureKeyProvider keys, string message) =>
{
var bytes = System.Text.Encoding.UTF8.GetBytes(message);
var sig = PostQuantum.Hybrid.HybridSignature.Sign(keys.PrivateKey, bytes);
return Convert.ToBase64String(sig);
});
app.Run();
appsettings.json
{
"Crypto": {
// KEM key pair — both halves required.
"KemPublicKeyPath": "/run/secrets/hybrid-kem.pub.pem",
"KemPrivateKeyPath": "/run/secrets/hybrid-kem.priv.pem",
// Signature key pair — both halves required.
"SignaturePublicKeyPath": "/run/secrets/hybrid-sig.pub.pem",
"SignaturePrivateKeyPath": "/run/secrets/hybrid-sig.priv.pem"
}
}
Each key half accepts either inline PEM (*KeyPem) or a file path
(*KeyPath); if both are supplied, the inline PEM wins.
You can omit a family entirely if your app doesn't need it (e.g. only-sign apps don't need KEM keys); the corresponding provider will throw on first use rather than at startup.
What you get
| Service | Purpose |
|---|---|
IHybridKemKeyProvider |
Long-lived recipient KEM key for decapsulation. |
IHybridSignatureKeyProvider |
Long-lived signing key + public key. |
HybridCryptoOptions |
Strongly-typed configuration. |
Both providers are registered as singletons. The underlying private keys are disposed when the host shuts down.
Security guidance
- Never commit
KemPrivateKeyPem/SignaturePrivateKeyPemto source control. UseKemPrivateKeyPath/SignaturePrivateKeyPathpointing at a secret-managed file, or load from a real secret store (Azure Key Vault, AWS Secrets Manager, HashiCorp Vault). - Use file permissions on the key file (
chmod 600on Linux; a restricted NTFS ACL on Windows). - Rotate keys. Loading the key is one-shot; rotation requires
restarting the host. For zero-downtime rotation, implement a custom
IHybridKeyProviderthat watches its source.
For more, see the parent library's SECURITY.md and HARDENING-CHECKLIST.md.
| 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 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. |
-
net10.0
- Microsoft.AspNetCore.DataProtection.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.2)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Options (>= 8.0.2)
- PostQuantum.Hybrid (>= 1.1.1)
-
net8.0
- Microsoft.AspNetCore.DataProtection.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.2)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Options (>= 8.0.2)
- PostQuantum.Hybrid (>= 1.1.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.