Class PermitFile
- Namespace
- EncDotNet.S100.ExchangeSets.Protection
- Assembly
- EncDotNet.S100.ExchangeSets.dll
A parsed PERMIT.XML file: the licensing document a Data Server issues to a Data Client conveying the (encrypted) cell keys for the products it has licensed.
public sealed class PermitFile
- Inheritance
-
PermitFile
- Inherited Members
Remarks
S-100 Edition 5.2.1 Part 15 §15-7.4. A permit file is a sequence of one or
more header/products pairs (each pair, modelled here as a
PermitGroup, may address a different end-user system). Each
products section groups datasetPermit records by product
specification id (for example S-101).
Parsing is namespace-tolerant: it reads by local element name so both the
http://www.iho.int/s100/se/5.0 and 5.1 schema namespaces are
accepted. The accompanying PERMIT.SIGN signature file (§15-7.4.5) is
not processed by this reader.
Properties
Groups
The header/products groups contained in the permit file.
public IReadOnlyList<PermitGroup> Groups { get; }
Property Value
IsAuthenticated
Whether the permit was authenticated using its mandatory
PERMIT.SIGN file.
public bool IsAuthenticated { get; }
Property Value
Remarks
S-100 Edition 5.2.1 Part 15 §15-7.4.5.
Methods
Create(IEnumerable<PermitGroup>)
Creates a permit file to issue, from its header/products groups.
public static PermitFile Create(IEnumerable<PermitGroup> groups)
Parameters
groupsIEnumerable<PermitGroup>The groups, each addressed to one end-user system.
Returns
- PermitFile
An unauthenticated permit file; write it with PermitFileWriter.
Read(Stream)
Reads and parses a permit file from a stream.
public static PermitFile Read(Stream stream)
Parameters
streamStreamA stream positioned at the start of the PERMIT.XML content.
Returns
- PermitFile
The parsed permit file.
Remarks
This parses permit metadata for inspection only. The returned permit is not authenticated and cannot be used with PermitKeyProvider. Use AuthenticateAsync(Stream, Stream?, string, TrustAnchorOptions, CancellationToken) before decrypting permit keys.
Read(string)
Reads and parses a permit file from a path on disk.
public static PermitFile Read(string path)
Parameters
pathstringThe path to the PERMIT.XML file.
Returns
- PermitFile
The parsed permit file.
Remarks
This parses permit metadata for inspection only. The returned permit is not authenticated and cannot be used with PermitKeyProvider. Use AuthenticateAsync(Stream, Stream?, string, TrustAnchorOptions, CancellationToken) before decrypting permit keys.
TryGetPermit(string, out DataPermit?, string?)
Finds the permit that applies to the given dataset file name, optionally restricting the search to a single product specification id.
public bool TryGetPermit(string datasetFileName, out DataPermit? permit, string? productId = null)
Parameters
datasetFileNamestringThe dataset file name (with or without extension).
permitDataPermitThe matching permit, if found.
productIdstringAn optional product id (e.g.
S-101) to restrict the search.
Returns
- bool
trueif a matching permit was found.