Pamoja.Security
0.1.17
dotnet add package Pamoja.Security --version 0.1.17
NuGet\Install-Package Pamoja.Security -Version 0.1.17
<PackageReference Include="Pamoja.Security" Version="0.1.17" />
<PackageVersion Include="Pamoja.Security" Version="0.1.17" />
<PackageReference Include="Pamoja.Security" />
paket add Pamoja.Security --version 0.1.17
#r "nuget: Pamoja.Security, 0.1.17"
#:package Pamoja.Security@0.1.17
#addin nuget:?package=Pamoja.Security&version=0.1.17
#tool nuget:?package=Pamoja.Security&version=0.1.17
Pamoja.Security
ed25519 device identity: sign a reading and verify it, so a gateway can prove it is authentic. One capability of pamoja, one memory-safe Rust core with bindings for TypeScript, Python, and C#.
Install
dotnet add package Pamoja.Security
using Pamoja.Security;
This pulls in Pamoja.Native, the compiled engine. dotnet add package Pamoja is the whole framework in one package.
Example
The guide project's example, spliced here as it ran in CI.
From bindings/dotnet/samples/Pamoja.Guides/SecurityGuide.cs:
// The seed is provisioned into the device once and never leaves it. A real one
// comes from the factory or a secure element; any 32 bytes stand in here.
byte[] seed = new byte[DeviceIdentity.KeyLength];
Array.Fill(seed, (byte)7);
using var device = new DeviceIdentity(seed);
// Only the 32-byte public key travels to the gateway. Its fingerprint is the short
// form an operator reads off a screen to tell one device from another.
byte[] gatewayKey = device.PublicKey;
Console.WriteLine($"device {DeviceIdentity.FingerprintOf(gatewayKey)}");
// Signing is deterministic, so the same reading always produces the same 64 bytes
// and there is no randomness to get wrong on a microcontroller.
const string reading = "meter-4 1182.750 kWh";
byte[] signature = device.Sign(reading);
Console.WriteLine(DeviceIdentity.Verify(gatewayKey, reading, signature)
? $"accepted {reading}"
: "rejected a reading the device really did sign, which should never happen");
// A digit changed in transit no longer matches what was signed.
const string edited = "meter-4 1082.750 kWh";
Console.WriteLine(DeviceIdentity.Verify(gatewayKey, edited, signature)
? "accepted an edited reading, which should never happen"
: $"rejected {edited}");
// Nor does the same reading offered under another device's key.
byte[] impostorSeed = new byte[DeviceIdentity.KeyLength];
Array.Fill(impostorSeed, (byte)90);
using var impostor = new DeviceIdentity(impostorSeed);
Console.WriteLine(DeviceIdentity.Verify(impostor.PublicKey, reading, signature)
? "accepted an impostor, which should never happen"
: "rejected a signature offered under another device's key");
The same capability in every language
| Language | Package | Reference |
|---|---|---|
| Rust | pamoja-security |
reference, docs.rs, install |
| TypeScript | @pamoja/security |
reference, install |
| Python | pamoja-security |
reference, install |
| C# | Pamoja.Security |
reference, install |
Documentation
Pamoja.Securityreference, every type in this namespace.- The Device identity guide, with the same example in Rust, TypeScript, and Python.
- Every capability, and the install page.
License
MIT
| 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
- Pamoja.Native (>= 0.1.17)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Pamoja.Security:
| Package | Downloads |
|---|---|
|
Pamoja.Audit
A tamper-evident, hash-chained log; altering, reordering, or dropping a record breaks verification. |
|
|
Pamoja
The whole pamoja framework in one package: every capability of one memory-safe Rust core, behind an idiomatic C# facade, for IoT, robotics, and drones. |
|
|
Pamoja.Update
Signed firmware manifests, streaming image verification, and A/B slots that fall back on their own. |
GitHub repositories
This package is not used by any popular GitHub repositories.