PDComm.License
Class
Installs and inspects the PDComm license of the SECS/GEM native library.
public static class LicenseStarting new SECS/GEM communication requires a license that grants the module: creating an HSMS endpoint, starting a stopped one, creating or starting a SECS-I endpoint (secs-gem), and creating or replacing a GEM300 capability catalog (gem300). Without one these calls throw PdcommException with PdcommStatus.LicenseRequired. Endpoints that are already running are never stopped.
The library merges every license source: text passed to License.Install, the PDCOMM_LICENSE (text) and PDCOMM_LICENSE_FILE (path) environment variables, a pdcomm.license file next to the application or the native library, and the user and system configuration directories. SECS/GEM runtime licenses are bound to host ids; read this machine's id with License.HostId.
The installed text belongs to the SECS/GEM library only. All members are thread-safe.
PDComm.PdcommRuntime.Initialize(args[0]);
PDComm.License.Install(File.ReadAllText("pdcomm.license"));
Console.WriteLine(PDComm.License.HostId());
Console.WriteLine(PDComm.License.Status().GetProperty("modules").GetProperty("secs-gem").GetProperty("state"));Members
HostId
Method
Gets this machine's host id, PDH1-XXXX-XXXX-XXXX-XXXX, which SECS/GEM runtime licenses list.
public static string HostId()Returns
The host id.
Notes
- Throws
NotSupportedException: The loaded native library does not export the license API. - Throws
PdcommException:PdcommStatus.IoErrorwhen the operating-system machine id cannot be read.
Install
Method
Installs license text, replacing text installed earlier through this method.
public static void Install(string text)Parameters
| Name | Description |
|---|---|
text | License text with one or more -----BEGIN PDCOMM LICENSE----- blocks, at most 1 MiB of UTF-8. An empty string removes the installed text. |
Notes
- Throws
ArgumentNullException:textisnull. - Throws
NotSupportedException: The loaded native library does not export the license API. - Throws
PdcommException:PdcommStatus.InvalidDatawhen no block has a valid signature (the earlier installation is kept), orPdcommStatus.InvalidArgumentwhen the text is larger than 1 MiB.
Status
Method
Gets the license status of the SECS/GEM library.
public static JsonElement Status()Returns
A JSON object with build_date, host_id, program, the license sources found, every license block in licenses with its verification result, and per module in modules its state (licensed, evaluation, missing, expired, not-yet-valid, updates-expired, program-mismatch or host-mismatch), granted and days_left.
Notes
- Throws
NotSupportedException: The loaded native library does not export the license API. - Throws
PdcommException: The library could not report its status.