Table of Contents

Class DataPermit

Namespace
EncDotNet.S100.ExchangeSets.Protection
Assembly
EncDotNet.S100.ExchangeSets.dll

A single datasetPermit record from a PERMIT.XML file: the wrapped (encrypted) cell key for one product file, together with the licensing metadata that scopes it.

public sealed class DataPermit
Inheritance
DataPermit
Inherited Members

Remarks

S-100 Edition 5.2.1 Part 15 §15-7.4.4. Permits are issued only for base datasets; the same key decrypts the matching incremental updates. The encrypted key is exactly one AES block and is unwrapped with the Data Client's hardware id.

Constructors

DataPermit(string, ReadOnlySpan<byte>, DateOnly, int?, DateOnly?)

Creates a data permit record.

public DataPermit(string fileName, ReadOnlySpan<byte> encryptedKey, DateOnly expiry, int? editionNumber = null, DateOnly? issueDate = null)

Parameters

fileName string

The dataset file name (optionally with extension) the permit applies to.

encryptedKey ReadOnlySpan<byte>

The 16-byte encrypted cell key (EK).

expiry DateOnly

The mandatory licence expiry date.

editionNumber int?

The edition number the permit applies to, if present.

issueDate DateOnly?

The dataset issue date, if present.

Properties

EditionNumber

The edition number the permit applies to, if declared.

public int? EditionNumber { get; }

Property Value

int?

EncryptedKey

The 16-byte encrypted cell key (EK, §15-7.4.4).

public ReadOnlySpan<byte> EncryptedKey { get; }

Property Value

ReadOnlySpan<byte>

Expiry

The licence expiry date (§15-7.4.4).

public DateOnly Expiry { get; }

Property Value

DateOnly

FileName

The dataset file name the permit applies to. When no file extension is present the permit applies to all datasets with this name regardless of extension (§15-7.4.4 NOTE).

public string FileName { get; }

Property Value

string

IssueDate

The dataset issue date, if declared.

public DateOnly? IssueDate { get; }

Property Value

DateOnly?

Methods

AppliesTo(string)

Indicates whether this permit applies to the dataset with the given file name. Matching is case-insensitive; a permit whose FileName carries no extension applies to any dataset with that base name regardless of extension (§15-7.4.4 NOTE).

public bool AppliesTo(string datasetFileName)

Parameters

datasetFileName string

The dataset file name (with or without extension).

Returns

bool

true if the permit applies to the dataset.

Create(string, ReadOnlySpan<byte>, HardwareId, DateOnly, int?, DateOnly?)

Issues a permit for one dataset by wrapping its cell key with the recipient system's hardware id (§15-7.4.4).

public static DataPermit Create(string fileName, ReadOnlySpan<byte> cellKey, HardwareId hardwareId, DateOnly expiry, int? editionNumber = null, DateOnly? issueDate = null)

Parameters

fileName string

The dataset file name the permit applies to; omit the extension to cover every dataset with that base name.

cellKey ReadOnlySpan<byte>

The 16-byte cell key the dataset was encrypted with.

hardwareId HardwareId

The hardware id of the system the permit is for.

expiry DateOnly

The licence expiry date.

editionNumber int?

The edition number the permit applies to, if any.

issueDate DateOnly?

The dataset issue date, for products without edition numbers.

Returns

DataPermit

The permit, carrying the wrapped key.

Remarks

This method is synchronous and CPU-bound.

IsExpired(DateOnly)

Indicates whether the permit has expired as of asOf.

public bool IsExpired(DateOnly asOf)

Parameters

asOf DateOnly

The date to evaluate against.

Returns

bool

true if the permit's expiry date is before asOf.