Convenience features are methods and properties of the ISlasconeClientV2 interface that operate locally. They do not make SLASCONE API calls and do not change client configuration.
They provide utility functions for offline license handling, file signature verification, release compliance checks, HTTPS diagnostics, and locally stored session data.
FILE AND OFFLINE LICENSE HANDLING
The following methods help you validate, read, and use locally stored license or activation files.
IsFileSignatureValid
Validates the digital signature of a SLASCONE-signed XML document, such as an offline license file or an activation file.
bool IsFileSignatureValid(string licenseFilePath)
Parameters
| Parameter | Type | Description |
|---|---|---|
licenseFilePath | string | The file path to the signed XML document to validate. |
Returns
true if the signature is valid and the document has not been tampered with; otherwise, false. The method also returns false if an exception occurs during validation.
Remarks
- Requires a signature key to be configured beforehand via
SetSignatureCertificate,SetSignaturePublicKeyXml,SetSignaturePublicKey, orSetSignatureSymmetricKey, depending on the selectedSetSignatureValidationMode. - The method loads the XML document from the file system and verifies the signature using the configured validation mode.
- Exceptions during validation are caught and result in a
falsereturn value.
ReadLicenseFile
Reads and deserializes an offline license XML document into a LicenseInfoDto object.
LicenseInfoDto ReadLicenseFile(string licenseFilePath)
Parameters
| Parameter | Type | Description |
|---|---|---|
licenseFilePath | string | The file path to the offline license XML document. |
Returns
A LicenseInfoDto object containing the license information from the XML file, including license metadata, customer information, product and edition information, validity information, software release limitations, features, limitations, variables, constrained variables, and license users.
Remarks
- This method does not verify the digital signature. Use
IsFileSignatureValidbefore calling this method to verify the document's integrity. - The
Is_license_expiredandIs_license_validflags are computed based onDateTime.UtcNowat the time of the call.
ReadActivationFile
Reads and deserializes an offline activation XML document into an ActivationDto object.
ActivationDto ReadActivationFile(string activationFilePath)
Parameters
| Parameter | Type | Description |
|---|---|---|
activationFilePath | string | The file path to the activation XML document. |
Returns
An ActivationDto object containing the activation data from the XML file.
Remarks
- This method does not verify the digital signature. Use
IsFileSignatureValidbefore calling this method to verify the file's integrity. - The XML document is loaded and deserialized using
XmlSerializer.
GetOfflineLicense
Reads the temporarily stored offline license information from the configured application data folder or custom storage strategy.
ApiResponse<LicenseInfoDto> GetOfflineLicense()
Parameters
None.
Returns
An ApiResponse<LicenseInfoDto> containing the cached license information if the offline license could be read successfully.
StatusCodeis200if the offline license was read successfully.Resultcontains the cachedLicenseInfoDto.- A status code other than
200, or an error, indicates that the offline license could not be read, for example because no app data folder is configured, the file was not found, or signature validation failed.
Remarks
- Requires prior configuration of either an app data folder via
SetAppDataFolderor a custom storage strategy viaSetOfflineDataStorageStrategy. - Offline license data is written automatically during successful
AddHeartbeatAsyncor license activation calls. - If signature validation is configured, the offline license signature is verified when reading.
- This is the primary method for supporting temporary offline scenarios where the application cannot reach the SLASCONE backend.
RELEASE COMPLIANCE
IsReleaseCompliant
Checks whether a given software release version is compliant with the license's software release limitation.
bool IsReleaseCompliant(LicenseInfoDto licenseInfo, string release)
Parameters
| Parameter | Type | Description |
|---|---|---|
licenseInfo | LicenseInfoDto | The license information object containing the software release limitation to check against. This is typically obtained from a heartbeat response, license activation, or offline license. |
release | string | The software release version string to check, for example "2.1.0". |
Returns
true if the release is compliant with the license. This means the release version is less than or equal to the license's software release limitation. Otherwise, returns false.
Remarks
- If the license has no software release limitation, the method returns
true. - Version comparison is performed using semantic version ordering.
- Throws
ArgumentExceptionif thereleaseparameter is not a valid version string.
HTTPS DIAGNOSTICS
HttpsChainOfTrust
Returns information about the certificate chain of trust of the HTTPS connection used for the last API call.
IEnumerable<CertificateInfoDto> HttpsChainOfTrust { get; }Returns
A collection of CertificateInfoDto objects.
| Property | Type | Description |
|---|---|---|
Name | string | The name of the certificate. |
Subject | string | The subject of the certificate. |
Issuer | string | The issuer of the certificate. |
NotBefore | DateTime | The start of the certificate's validity period. |
NotAfter | DateTime | The end of the certificate's validity period. |
SerialNumber | string | The serial number of the certificate. |
Thumbprint | string | The thumbprint of the certificate. |
Remarks
- Recording must be enabled first by calling
SetCheckHttpsCertificate(true). - At least one API call must be made after enabling certificate recording.
- Recording is performed only once, on the next API call after activation, to avoid performance overhead.
- This property is useful for diagnostics and for verifying that the HTTPS connection to the SLASCONE backend uses the expected certificates.
LOCAL SESSION STATUS
Session.TryGetSessionStatus
Checks the locally stored session status for a given license. This method is accessible through the Session property of ISlasconeClientV2.
bool TryGetSessionStatus(Guid licenseId, out Guid sessionId, out SessionStatusDto sessionStatus)
Parameters
| Parameter | Type | Description |
|---|---|---|
licenseId | Guid | The ID of the license to check the session status for. |
sessionId | out Guid | When the method returns true, contains the session ID. Set to Guid.Empty if no valid session exists. |
sessionStatus | out SessionStatusDto | When the method returns true, contains the session status details. |
Returns
true if a valid, non-expired session exists for the given license; otherwise, false.
SessionStatusDto Properties
| Property | Type | Description |
|---|---|---|
Is_session_valid | bool | Whether the session is valid. |
Session_valid_until | DateTimeOffset? | The UTC date and time until which the session is valid. |
Session_created_date | DateTimeOffset? | The UTC date and time when the session was created. |
Session_modified_date | DateTimeOffset? | The UTC date and time when the session was last modified. |
Max_open_session_count | int | The maximum number of concurrent open sessions allowed. |
Max_active_client_count | int | The maximum number of active clients allowed. |
Remarks
- This method reads session data from local storage without making an API call.
- A session is considered valid only if a stored session exists, the session is marked as valid, the stored license ID matches the provided
licenseId, andSession_valid_untilis in the future. - Session data is written automatically during provisioning API calls that involve sessions, such as
OpenSessionAsync.
Comments
0 comments
Article is closed for comments.