> ## Documentation Index
> Fetch the complete documentation index at: https://help.cryptolens.io/llms.txt
> Use this file to discover all available pages before exploring further.

# .NET SDK Settings and Compatibility

> Package differences, request settings and compatibility for .NET SDK 4.0.54.

## Packages and Frameworks

This reference covers version **4.0.54** of `Cryptolens.Licensing` and `Cryptolens.Licensing.CrossPlatform`.

| Package | Intended Use |
| - | - |
| `Cryptolens.Licensing` | Includes the older Windows helpers that use `System.Management`. |
| `Cryptolens.Licensing.CrossPlatform` | Omits those helpers. Use this package for Linux, macOS and Unity/Mono. |

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](/libraries/dotnet-reference/methods/helpers). 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

| Setting | Default | Effect |
| - | - | - |
| `RequestModel.LicenseServerUrl` | `null` | Sends requests to the hosted API. Set a base URL, such as `http://localhost:8080`, to use a [License Server](/feature/license-server/index). The SDK appends `/api/`; do not include that suffix or a trailing slash. |
| `SKM.V3.Methods.Helpers.WindowsOnly` | `false` | Skips operating-system detection in the older machine-code helper and assumes Windows. This is a compatibility workaround, not a general requirement on Windows. |
| `SKM.V3.Internal.HelperMethods.KeepAlive` | `true` | Reuses HTTP connections. Set it to `false` if persistent connections cause problems in the host application. It is a process-wide setting. |
| `WebRequest.DefaultWebProxy` | Supplied by the .NET runtime and host configuration | Used for requests. The SDK assigns the current user's default credentials to the proxy. The older `HelperMethods.proxy` field is not read by the request code in 4.0.54. |

`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.

<a id="request-errors" />

## 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](/examples/offline-verification).

This error behavior applies to the standard result types derived from [BasicResult](/libraries/dotnet-reference/models/basic-result). 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](/libraries/dotnet-reference/extension-methods#has-valid-signature-20d1135b86) 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](/libraries/dotnet-reference/license-key#from-response-654142ab2a), 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](/getting-started/unity#license-key-verification). 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](/libraries/dotnet-reference/methods/key).

`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](/libraries/dotnet-reference/extension-methods) and the [Key Verification FAQ](/examples/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

<AccordionGroup>
  <Accordion title="Can One Access Token Activate and Deactivate Licenses?" id="activate-and-deactivate">
    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](/getting-started/access-token).
  </Accordion>

  <Accordion title="Does a Signed License Include Signed Metadata?" id="signed-metadata">
    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](/libraries/dotnet-reference/models/raw-response).
  </Accordion>
</AccordionGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.