Krysalis 0.1.0
dotnet add package Krysalis --version 0.1.0
NuGet\Install-Package Krysalis -Version 0.1.0
<PackageReference Include="Krysalis" Version="0.1.0" />
<PackageVersion Include="Krysalis" Version="0.1.0" />
<PackageReference Include="Krysalis" />
paket add Krysalis --version 0.1.0
#r "nuget: Krysalis, 0.1.0"
#:package Krysalis@0.1.0
#addin nuget:?package=Krysalis&version=0.1.0
#tool nuget:?package=Krysalis&version=0.1.0
krysalis-csharp
C# / .NET bindings for krysalis — a general-purpose end-to-end encryption library. Seal and open arbitrary data (blobs, files, database records, API payloads) with a single, composable API.
Built with P/Invoke (LibraryImport) over the krysalis C ABI. Targets .NET 8+.
Prerequisites
- .NET 8 SDK or later
- The compiled
libkrysalisnative library (see Setup)
Setup
Download pre-built native library
bash scripts/setup-native.sh # downloads v0.1.0 by default
KRYSALIS_VERSION=v0.2.0 bash scripts/setup-native.sh # specific version
The script downloads libkrysalis.so (Linux) or libkrysalis.dylib (macOS) from the
krysalis releases into native/.
Build from source
If no release is available for your platform:
git clone https://github.com/Pirand92/krysalis.git krysalis-src
cargo build -p krysalis-ffi --release --manifest-path krysalis-src/Cargo.toml
mkdir -p native && cp krysalis-src/target/release/libkrysalis.so native/
Quick start
using Krysalis;
// Generate a key pair — always dispose to zero the secret key
using var kp = EncryptionKeyPair.Generate();
// Encrypt
byte[] plaintext = System.Text.Encoding.UTF8.GetBytes("hello, world");
byte[] sealed = BlobContext.Seal(plaintext, kp.PublicKey);
// Decrypt
byte[] recovered = BlobContext.Open(sealed, kp.SecretKey);
Console.WriteLine(System.Text.Encoding.UTF8.GetString(recovered)); // hello, world
Multi-recipient encryption
using var alice = EncryptionKeyPair.Generate();
using var bob = EncryptionKeyPair.Generate();
var recipients = new[] { alice.PublicKey.ToArray(), bob.PublicKey.ToArray() };
byte[] multi = BlobContext.SealForMany("group secret"u8.ToArray(), recipients);
// Both can decrypt independently
byte[] a = BlobContext.OpenMulti(multi, alice.SecretKey);
byte[] b = BlobContext.OpenMulti(multi, bob.SecretKey);
API Reference
EncryptionKeyPair — IDisposable
| Member | Description |
|---|---|
EncryptionKeyPair.Generate() |
Generate a new X25519 key pair |
ReadOnlySpan<byte> PublicKey |
32-byte public key (safe to share) |
ReadOnlySpan<byte> SecretKey |
32-byte secret key — throws ObjectDisposedException after Dispose() |
byte[] Fingerprint() |
SHA-256 fingerprint of the public key |
void Dispose() |
Zeros the secret key from managed memory |
BlobContext — static API
| Method | Description |
|---|---|
Seal(plaintext, recipientPublicKey) |
Encrypt for one recipient |
Open(sealedBytes, secretKey) |
Decrypt |
SealForMany(plaintext, recipientKeys[]) |
Encrypt for N recipients (KEM+DEM) |
OpenMulti(multiSealedBytes, secretKey) |
Decrypt a multi-recipient blob |
All methods throw KrysalisException on cryptographic failure. Open and OpenMulti zero the secret-key copy in a finally block.
Development
# 1. Get the native library
bash scripts/setup-native.sh
# 2. Run all tests
dotnet test Krysalis.sln
# 3. Build the library
dotnet build Krysalis/Krysalis.csproj -c Release
Tests are in Krysalis.Tests/BlobContextTests.cs.
License
Licensed under either of MIT or Apache 2.0, at your option.
| 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 was computed. 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. |
-
net8.0
- 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 |
|---|---|---|
| 0.1.0 | 53 | 6/6/2026 |