Table of Contents

Class PdfByteRange

Namespace
SimpleSign.Pdf
Assembly
SimpleSign.Pdf.dll

The four byte ranges that define a PDF digital signature's covered area.

public sealed class PdfByteRange
Inheritance
PdfByteRange
Inherited Members

Properties

ContentsLength

Number of bytes of actual CMS data (half the hex character count).

public int ContentsLength { get; }

Property Value

int

ContentsOffset

Byte offset where the /Contents hex value starts (first byte of the hex string, after the opening <).

public long ContentsOffset { get; }

Property Value

long

IsValid

Indicates whether the byte range values are logically consistent.

public bool IsValid { get; }

Property Value

bool

Length1

Length of the first range (bytes before the /Contents hex string).

public long Length1 { get; init; }

Property Value

long

Length2

Length of the second range (bytes from /Contents end to end of file).

public long Length2 { get; init; }

Property Value

long

Offset1

Start offset of the first range (always 0 for PAdES).

public long Offset1 { get; init; }

Property Value

long

Offset2

Start offset of the second range (byte after the closing > of /Contents).

public long Offset2 { get; init; }

Property Value

long

Methods

CoversEntireFile(long)

Checks whether this ByteRange covers a specific file revision end-to-end, i.e., starts at offset 0 and extends to the given file/revision length with no gaps other than the /Contents hex placeholder. ISO 32000-1 §12.8.2.2: The first range starts at 0 and the second range ends at EOF.

public bool CoversEntireFile(long fileLength)

Parameters

fileLength long

Total file or revision length in bytes.

Returns

bool

True if the ByteRange covers the full file with no unexpected gaps.