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
fileNamestringThe dataset file name (optionally with extension) the permit applies to.
encryptedKeyReadOnlySpan<byte>The 16-byte encrypted cell key (
EK).expiryDateOnlyThe mandatory licence expiry date.
editionNumberint?The edition number the permit applies to, if present.
issueDateDateOnly?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
Expiry
The licence expiry date (§15-7.4.4).
public DateOnly Expiry { get; }
Property Value
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
IssueDate
The dataset issue date, if declared.
public DateOnly? IssueDate { get; }
Property Value
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
datasetFileNamestringThe dataset file name (with or without extension).
Returns
- bool
trueif 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
fileNamestringThe dataset file name the permit applies to; omit the extension to cover every dataset with that base name.
cellKeyReadOnlySpan<byte>The 16-byte cell key the dataset was encrypted with.
hardwareIdHardwareIdThe hardware id of the system the permit is for.
expiryDateOnlyThe licence expiry date.
editionNumberint?The edition number the permit applies to, if any.
issueDateDateOnly?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
asOfDateOnlyThe date to evaluate against.
Returns
- bool
trueif the permit's expiry date is beforeasOf.