Uniform.Matrix.Protocol.Crypto 0.1.2

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

Uniform.Matrix.Protocol.Crypto

Matrix end-to-end encryption in pure .NET: Olm and Megolm, device keys, cross-signing, secret storage, server-side key backup with a recovery key, key requests between own devices, and emoji (SAS) verification. No native libraries; the curves come from BouncyCastle.

dotnet add package Uniform.Matrix.Protocol.Crypto

Encrypt a room

OlmMachine does the protocol work for one device. It talks to the server through IKeyTransport; Uniform.Matrix.Client has MatrixKeyTransport over a logged-in MatrixClient.

using Uniform.Matrix.Protocol.Crypto;

using OlmMachine machine = await OlmMachine.CreateAsync(new MatrixKeyTransport(client), new InMemoryCryptoStore(), client.UserId!, client.DeviceId!, pickleKey);
await machine.UploadInitialKeysAsync();

// Every sync goes through the machine: to-device messages, device lists, one-time key counts
await machine.ReceiveSyncAsync(sync);

// Send encrypted, and decrypt what arrives
EncryptedContent content = await machine.EncryptRoomEventAsync(roomId, EventTypes.RoomMessage, new MessageContent { MessageType = MessageTypes.Text, Body = "secret" }, memberIds);
await client.SendEventAsync(roomId, EventTypes.RoomEncrypted, content);
RoomEventDecryption result = await machine.DecryptRoomEventAsync(roomId, clientEvent);

SetUpRecoveryAsync creates cross-signing keys, a key backup and the recovery key; RecoverAsync restores them on a new login. RequestVerificationAsync, AcceptVerificationAsync and ConfirmVerificationAsync run emoji verification.

Olm and Megolm directly

using MegolmOutboundSession outbound = MegolmOutboundSession.Create();
using MegolmInboundSession inbound = MegolmInboundSession.FromSessionKey(outbound.SessionKey);

string ciphertext = outbound.Encrypt("hello");
MegolmPlaintext plaintext = inbound.Decrypt(ciphertext);
Console.WriteLine(plaintext.Text); // hello

OlmAccount and OlmSession cover Olm. Pickles use vodozemac's format, so state moves between the two implementations.

Notes

  • The Olm and Megolm code is a C# port of vodozemac 0.11.1, and is tested against vodozemac itself. Unlike vodozemac, it has not been audited, and .NET cannot guarantee constant-time code or wipe all secrets from memory.
  • Licensed MIT AND Apache-2.0: the vodozemac-derived files stay under the Apache License 2.0, whose text and the notices are included in the package.

About

Part of Uniform.Matrix, a pure .NET implementation of the Matrix specification. Version 0.1 is an early pre-release: APIs may still change.

Product Compatible and additional computed target framework versions.
.NET 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 (2)

Showing the top 2 NuGet packages that depend on Uniform.Matrix.Protocol.Crypto:

Package Downloads
Uniform.Matrix.Client

Matrix client engine with local SQLite storage: session, sync, outbox, media cache, encryption and room state.

Uniform.Matrix.Protocol.Server

Matrix homeserver building blocks: room versions, event format, content hashes, signing, redaction and authorization rules.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.2 0 10/27/2026
0.1.0 29 10/26/2026
0.1.0-alpha.1 27 10/26/2026