Class Update
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
StructureVersion
The manifest structure version this build writes.
public const byte StructureVersion = 1
Field Value
Methods
DecodeManifest(ReadOnlySpan<byte>)
Reads a manifest body back from its bytes.
public static Manifest DecodeManifest(ReadOnlySpan<byte> bytes)
Parameters
bytesReadOnlySpan<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
manifestManifestThe 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
envelopeReadOnlySpan<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
imageReadOnlySpan<byte>The complete image the release carries.
Returns
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
envelopeReadOnlySpan<byte>The signed delegation envelope.
anchorPublicKeyReadOnlySpan<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
delegationDelegationThe statement to sign.
anchorDeviceIdentityThe 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
manifestManifestWhat the release says about itself.
authorDeviceIdentityThe 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
envelopeReadOnlySpan<byte>The signed envelope.
publicKeyReadOnlySpan<byte>The key expected to have signed it.
Returns
- Manifest
The verified manifest.
Exceptions
- PamojaException
The signature is not from that key.