Table of Contents

Class Update

Namespace
Pamoja.Update
Assembly
Pamoja.Update.dll

Signing releases and checking the ones that arrive.

public static class Update
Inheritance
Update
Inherited Members

Fields

FormatRaw

The payload format meaning the payload is the image itself.

public const byte FormatRaw = 1

Field Value

byte

StructureVersion

The manifest structure version this build writes.

public const byte StructureVersion = 1

Field Value

byte

Methods

DecodeManifest(ReadOnlySpan<byte>)

Reads a manifest body back from its bytes.

public static Manifest DecodeManifest(ReadOnlySpan<byte> bytes)

Parameters

bytes ReadOnlySpan<byte>

The encoded manifest body.

Returns

Manifest

The manifest.

Remarks

This reads what a manifest claims; it proves nothing about who wrote it. Use VerifyEnvelope(ReadOnlySpan<byte>, ReadOnlySpan<byte>) to read one whose signature was checked.

Exceptions

PamojaException

The bytes are not a well-formed manifest.

EncodeManifest(Manifest)

Encodes the body of a manifest, which is what a signature covers.

public static byte[] EncodeManifest(Manifest manifest)

Parameters

manifest Manifest

The manifest to encode.

Returns

byte[]

The encoded body.

Exceptions

PamojaException

The manifest could not be encoded.

EnvelopeBody(ReadOnlySpan<byte>)

Copies out the signed body of an envelope, unchecked.

public static byte[] EnvelopeBody(ReadOnlySpan<byte> envelope)

Parameters

envelope ReadOnlySpan<byte>

The signed envelope.

Returns

byte[]

The signed body.

Remarks

This is what a gateway relays onward unchanged.

Exceptions

PamojaException

The envelope is malformed.

ImageDigest(ReadOnlySpan<byte>)

Hashes a complete image, for a publisher filling in a manifest.

public static byte[] ImageDigest(ReadOnlySpan<byte> image)

Parameters

image ReadOnlySpan<byte>

The complete image the release carries.

Returns

byte[]

The 32-byte digest to put in a Manifest.

Remarks

The manifest commits to a SHA-256 over the image, and this is that hash, so a publisher does not need a hashing library of its own just to name the image it is releasing.

Exceptions

PamojaException

The native call failed.

OpenDelegation(ReadOnlySpan<byte>, ReadOnlySpan<byte>)

Opens a signed delegation against the anchor that signed it.

public static Delegation OpenDelegation(ReadOnlySpan<byte> envelope, ReadOnlySpan<byte> anchorPublicKey)

Parameters

envelope ReadOnlySpan<byte>

The signed delegation envelope.

anchorPublicKey ReadOnlySpan<byte>

The anchor key.

Returns

Delegation

The verified delegation.

Exceptions

PamojaException

The delegation is not from the anchor.

SignDelegation(Delegation, DeviceIdentity)

Signs a delegation, naming a release key the anchor stands behind.

public static byte[] SignDelegation(Delegation delegation, DeviceIdentity anchor)

Parameters

delegation Delegation

The statement to sign.

anchor DeviceIdentity

The anchor identity, the root of the trust.

Returns

byte[]

The signed delegation envelope.

Remarks

Keeping the anchor offline and rotating a release key under it is the arrangement to prefer, because the key that signs day to day is the one most likely to be stolen.

Exceptions

PamojaException

The delegation could not be signed.

SignManifest(Manifest, DeviceIdentity)

Signs a manifest into the envelope offered to a device.

public static byte[] SignManifest(Manifest manifest, DeviceIdentity author)

Parameters

manifest Manifest

What the release says about itself.

author DeviceIdentity

The identity signing the release.

Returns

byte[]

The signed envelope.

Exceptions

PamojaException

The manifest could not be signed.

VerifyEnvelope(ReadOnlySpan<byte>, ReadOnlySpan<byte>)

Verifies an envelope and reads the manifest inside it.

public static Manifest VerifyEnvelope(ReadOnlySpan<byte> envelope, ReadOnlySpan<byte> publicKey)

Parameters

envelope ReadOnlySpan<byte>

The signed envelope.

publicKey ReadOnlySpan<byte>

The key expected to have signed it.

Returns

Manifest

The verified manifest.

Exceptions

PamojaException

The signature is not from that key.