BlueHeighliner.Msmt
0.3.0
dotnet add package BlueHeighliner.Msmt --version 0.3.0
NuGet\Install-Package BlueHeighliner.Msmt -Version 0.3.0
<PackageReference Include="BlueHeighliner.Msmt" Version="0.3.0" />
<PackageVersion Include="BlueHeighliner.Msmt" Version="0.3.0" />
<PackageReference Include="BlueHeighliner.Msmt" />
paket add BlueHeighliner.Msmt --version 0.3.0
#r "nuget: BlueHeighliner.Msmt, 0.3.0"
#:package BlueHeighliner.Msmt@0.3.0
#addin nuget:?package=BlueHeighliner.Msmt&version=0.3.0
#tool nuget:?package=BlueHeighliner.Msmt&version=0.3.0
Msmt
A C# implementation of the Mercury Secure Message Transport (MSMT) standard - an open, standards-based interface for secure message transport over IP networks, defined by MITRE's Mercury Secure Message Transport Interface Control Document (ICD). MSMT is a fixed, narrowly pinned configuration of TLS 1.3 paired with a thin, standardized message-framing API; this library implements that interface end to end on top of BouncyCastle's TLS engine.
Installing
dotnet add package BlueHeighliner.Msmt
Getting started
A peer sends messages directly to targets and receives them directly from targets, in message mode or message-with-rekeying mode:
using BlueHeighliner.Msmt;
MsmtCredentials credentials = MsmtCredentials.FromPemFiles("identity.pem", "identity.key", "ca.pem");
// RequireFullyQualifiedHostname is disabled here only because this example connects by loopback IP
// address rather than a real DNS hostname; leave it enabled (the default) whenever a hostname is used.
IMsmtMessagePeer peer = new IMsmtMessagePeer.Factory().Create(new MsmtMessagePeerOptions { Credentials = credentials, RequireFullyQualifiedHostname = false });
// The handler owns payload and must dispose it; responder is null because this message never requested an acknowledgement.
peer.Receiver = (source, identity, payload, responder) =>
{
using (payload)
{
Console.WriteLine(Encoding.UTF8.GetString(payload.Memory.Span));
}
};
peer.StartListener(port: 5000);
peer.Send(new MsmtTarget { Host = "127.0.0.1", Port = 5000 }, "hello"u8.ToArray());
A session peer listens for and opens session connections, which are bidirectional: both sides send and receive over the same connection object.
IMsmtSessionPeer listening = new IMsmtSessionPeer.Factory().Create(new MsmtSessionPeerOptions { Credentials = credentials, RequireFullyQualifiedHostname = false });
listening.Receiver = (connection, payload, responder) =>
{
Console.WriteLine($"got {payload.Memory.Length} bytes");
payload.Dispose();
responder?.Accept(); // non-null only for a message sent with Request, which must be answered, once
};
listening.Connected.Subscribe(connection => connection.Send("welcome"u8.ToArray())); // the listening side can send too
listening.StartListener(port: 5000);
IMsmtSessionPeer connecting = new IMsmtSessionPeer.Factory().Create(new MsmtSessionPeerOptions { Credentials = credentials });
connecting.Receiver = (connection, payload, responder) =>
{
Console.WriteLine("connecting side got a message");
payload.Dispose();
responder?.Accept();
};
IMsmtConnection connection = connecting.Connect(new MsmtNameTarget { Host = "127.0.0.1", Port = 5000, ServerName = "127.0.0.1" });
await connection.Wait(); // still Connecting until this resolves
MsmtResponse response = await connection.Request("hello"u8.ToArray());
Documentation
| File | Covers |
|---|---|
| Docs/Api.md | The public API's design and flow: IMsmtMessagePeer and IMsmtSessionPeer with its connections |
| Docs/Usage.md | Usage examples for common scenarios |
| Docs/Architecture.md | The high-level design decisions behind the library |
| Docs/Components/ | Design/implementation detail for individual complex components, one file each |
| Docs/ICD.md | Full Markdown transcription of the Mercury Secure Message Transport Interface Control Document (v1.2) |
| Docs/Project.md | This repository's own tooling and workflow: Scripts/, publishing, CI |
| Product | Versions 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. |
-
net10.0
- BouncyCastle.Cryptography (>= 2.6.2)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on BlueHeighliner.Msmt:
| Package | Downloads |
|---|---|
|
BlueHeighliner.Comlink
A peer-to-peer messaging engine built on the Mercury Secure Message Transport (MSMT) protocol, with a built-in Avalonia desktop GUI. Avalonia is a required dependency of this package, not optional — it can be run headless (no window shown), but the GUI layer and its dependencies are always present. |
GitHub repositories
This package is not used by any popular GitHub repositories.