Installer payload appended to the setup program: JSON manifest (components, files with size/SHA-256/offsets/mtime, shortcuts, file types) plus deflate or stored entries and a 64-byte footer with the manifest hash. The reader finds the footer before an Authenticode table, validates every offset, rejects unsafe paths and bounds inflation by the declared size; the writer is deterministic, deduplicates identical content and strips a signed stub. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
22 lines
839 B
C#
22 lines
839 B
C#
namespace Titano.Core.Packaging;
|
|
|
|
/// <summary>Why a TPK1 payload could not be read, written or extracted.</summary>
|
|
public enum PayloadError
|
|
{
|
|
/// <summary>The file carries no payload footer: not a packed installer, or its end was cut off.</summary>
|
|
NotFound,
|
|
|
|
/// <summary>Footer, manifest or entry data are inconsistent, truncated or fail their SHA-256.</summary>
|
|
Corrupt,
|
|
|
|
/// <summary>A path is absolute, escapes the target folder or uses a name Windows cannot store.</summary>
|
|
UnsafePath,
|
|
}
|
|
|
|
/// <summary>A payload problem with a machine-readable <see cref="Error"/> for exit codes and UI messages.</summary>
|
|
public sealed class PayloadException(PayloadError error, string message, Exception? innerException = null)
|
|
: Exception(message, innerException)
|
|
{
|
|
public PayloadError Error { get; } = error;
|
|
}
|