Skip to main content

Packages and Frameworks

This reference covers version 4.0.54 of Cryptolens.Licensing and Cryptolens.Licensing.CrossPlatform. Both projects declare .NET Framework 3.5, 4.6, 4.7, 4.7.1, 4.8 and .NET Standard 2.0. Member pages show when a method is absent from a particular build. An available method may still need operating-system facilities, permissions or commands to work. For new integrations, use GetMachineCodePI. Its parameterless overload uses version 1. Keep the same machine-code algorithm for activation and later checks. GetMachineCode(platformIndependent: false) uses the older Windows path in the standard package; the cross-platform package forces platformIndependent to true. GetMachineCodePI explicitly selects the platform-independent path in both packages.

Request Settings

KeepAlive is a supported connection setting despite its namespace. Other internal transport helpers are not part of this reference. A custom build with the KeepAliveDisabled symbol must also set KeepAlive=false; otherwise requests throw an ArgumentException before being sent. Request models are ordinary .NET objects. Unless a property says otherwise, a new object’s strings, lists and nullable values start as null, numeric values start as 0, and Boolean values start as false. A [DefaultValue(...)] attribute describes a value; it does not initialize a property. These object defaults are separate from server defaults. Optional method-argument defaults are shown in each signature.

Request Errors

In 4.0.54, the standard API methods return a result with Result=ResultType.Error and a diagnostic Message for handled connection, HTTP, empty-response and JSON errors. Check both fields before reading the response data. Older descriptions that say every connection failure returns null do not describe this version. Keep a null check when using code across SDK versions. An error result does not by itself identify a connectivity problem: the server can also reject a request because of its permissions or license state. Do not use an old cached license to override an explicit rejection. See Offline Verification. This error behavior applies to the standard result types derived from BasicResult. Local file and signature helpers have their own return conventions, documented on their pages. Invalid arguments, platform failures and fatal runtime errors can still throw.

Signing and License Checks

Key.Activate and Key.GetKey return API results without verifying their signatures. With the overloads that take ActivateModel or KeyInfoModel, set Sign=true (the default is false). Use HasValidSignature to check the returned license, for example result.LicenseKey.HasValidSignature(RSAPubKey).IsValid(). This returns true when the signature is valid. The newer overloads returning RawResponse request signing automatically. Pass that response and your RSA public key to LicenseKey.FromResponse, which verifies the signature and returns a LicenseKey. You do not need to repeat the signature check on the same response. For Unity/Mono, we recommend using this newer overload with Cryptolens.Licensing.CrossPlatform, as shown in the Unity tutorial. Signature verification with the model overload can fail on some platforms. The newer format lets the SDK verify the original signed data before converting it to a LicenseKey, without having to reconstruct the signed data from the object’s properties. You can use the newer overload in other .NET applications too, particularly if signature verification with the model overload fails on your target runtime. See the activation example. IsValid() without an RSA public key only checks whether its input is non-null. It is commonly used at the end of a chain of checks; it does not add those checks itself. See ExtensionMethods and the Key Verification FAQ.

Trimming and Native AOT

Both packages warn with CRYPTOLENS001 when publishing with PublishTrimmed=true or PublishAot=true. Version 4.0.54 does not support trimming or Native AOT. Set both publishing properties to false in the effective project or publish profile. CryptolensSuppressTrimAotWarning=true suppresses the warning; it does not make these modes supported.

FAQ

Yes. Select both the Activate permission and the Deactivate permission. Add the Get Key permission only if the application calls GetKey. Each method still checks its own permission. See the access-token guide.
No. RawResponse.Signature covers the encoded license data, not the separate Metadata object. Metadata can help display usage information, but verifying the license signature does not authenticate those separate values. See RawResponse.