Table of Contents

Class AuditLog

Namespace
Pamoja.Audit
Assembly
Pamoja.Audit.dll

A log that signs what it is given and chains it onto what came before.

public sealed class AuditLog : IDisposable
Inheritance
AuditLog
Implements
Inherited Members

Remarks

A log that can be edited after the fact proves nothing. Each record here is signed and carries the hash of the one before it, so altering a record, dropping one, or reordering two breaks the chain at that point and at every point after it. A chain cut short at the end is still a valid chain, so to catch that, compare its last index and digest with the ones the device last reported.

Constructors

AuditLog(DeviceIdentity)

Creates a log that signs with a device identity, starting empty.

public AuditLog(DeviceIdentity identity)

Parameters

identity DeviceIdentity

The identity whose signature each record carries.

Exceptions

PamojaException

The native log could not be created.

Methods

Append(ReadOnlySpan<byte>)

Appends a payload, signing it and chaining it onto the last record.

public AuditEntry Append(ReadOnlySpan<byte> payload)

Parameters

payload ReadOnlySpan<byte>

The record to store.

Returns

AuditEntry

The new entry.

Exceptions

PamojaException

The native call failed.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Resume(DeviceIdentity, AuditEntry)

Creates a log carrying on from the last record of an existing one.

public static AuditLog Resume(DeviceIdentity identity, AuditEntry last)

Parameters

identity DeviceIdentity

The identity whose signature each record carries.

last AuditEntry

The final record of the existing log.

Returns

AuditLog

The log, positioned after last.

Exceptions

PamojaException

The native log could not be created.