Class AuditLog
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. The index is part of what is signed, which is what makes a record removed from the end detectable too.
Constructors
AuditLog(DeviceIdentity)
Creates a log that signs with a device identity, starting empty.
public AuditLog(DeviceIdentity identity)
Parameters
identityDeviceIdentityThe 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
payloadReadOnlySpan<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
identityDeviceIdentityThe identity whose signature each record carries.
lastAuditEntryThe final record of the existing log.
Returns
- AuditLog
The log, positioned after
last.
Exceptions
- PamojaException
The native log could not be created.