> ## 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: Key

> Signatures, models and behavior for SKM.V3.Methods.Key in the .NET SDK 4.0.54.

Methods that perform operations on a license key. A complete list
can be found here: [Key](/api-reference/generated/Key)

**Namespace:** `SKM.V3.Methods`\
**Version:** 4.0.54. Both packages; all six documented target frameworks.

<CodeGroup>
  ```csharp C# theme={null}
  public static class Key
  ```

  ```vb VB.NET theme={null}
  Public Module Key
  ```
</CodeGroup>

These methods return a result object. Check `Result == ResultType.Success` before using its data. In version 4.0.54, handled request and JSON errors normally return `ResultType.Error` with a diagnostic `Message`. A non-null result alone does not mean the request succeeded. See [Request Errors](/libraries/dotnet-reference/settings#request-errors).

## Signed Activation Example

Use `SKM.V3`, `SKM.V3.Methods` and `SKM.V3.Models` (with `using` in C# or `Imports` in VB.NET). Replace the demonstration product ID `3349`, license key and credential placeholders with your own values. The access token needs the **Activate permission**. This example checks the API result and signature; see the FAQ below for the other license checks.

<CodeGroup>
  ```csharp C# theme={null}
  string accessToken = "YOUR_ACCESS_TOKEN";
  string rsaPublicKey = "YOUR_RSA_PUBLIC_KEY";
  string machineCode = Helpers.GetMachineCodePI();

  var response = Key.Activate(accessToken, 3349, "ICVLD-VVSZR-ZTICT-YKGXL", machineCode);
  if (response == null || response.Result == ResultType.Error)
  {
      Console.WriteLine(response == null ? "No response." : response.Message);
  }
  else
  {
      var license = LicenseKey.FromResponse(rsaPublicKey, response);
      Console.WriteLine(license == null ? "Signature verification failed." : "Signature verified.");
  }
  ```

  ```vb VB.NET theme={null}
  Dim accessToken As String = "YOUR_ACCESS_TOKEN"
  Dim rsaPublicKey As String = "YOUR_RSA_PUBLIC_KEY"
  Dim machineCode As String = Helpers.GetMachineCodePI()

  Dim response = Key.Activate(accessToken, 3349, "ICVLD-VVSZR-ZTICT-YKGXL", machineCode)
  If response Is Nothing OrElse response.Result = ResultType.Error Then
      Console.WriteLine(If(response Is Nothing, "No response.", response.Message))
  Else
      Dim license = LicenseKey.FromResponse(rsaPublicKey, response)
      Console.WriteLine(If(license Is Nothing, "Signature verification failed.", "Signature verified."))
  End If
  ```
</CodeGroup>

## Methods

<a id="activate-0eb84d49fd" />

### Activate(string, ActivateModel)

Activates a license. Depending on the license settings, this can register a machine, start a trial, or acquire or renew a floating seat.

<CodeGroup>
  ```csharp C# theme={null}
  public static KeyInfoResult Activate(string token, ActivateModel parameters)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function Activate(token As String, parameters As ActivateModel) As KeyInfoResult
  ```
</CodeGroup>

[Web API Reference](/api-reference/generated/Activate)

**Parameters**

| Name | Type | Description |
| - | - | - |
| `token` | `string` | The access token. Read more at [Auth](/api-reference/generated/Auth) |
| `parameters` | [`ActivateModel`](/libraries/dotnet-reference/models/activate-model) | The parameters that the method needs. |

**Returns:** [`KeyInfoResult`](/libraries/dotnet-reference/models/key-info-result). The API response. Check `Result` and `Message` before using the returned data.

**Checks:** The SDK does not verify the returned license signature in this call. Verify the response using the corresponding signature helper.

The access token needs the **Activate permission**. The SDK requests model version 3. When `OSInfo` is null, it attempts to collect OS information; use an empty string to prevent that automatic collection.

<a id="activate-e4c219c1ea" />

### Activate(string, int, string, string, bool, int, int, string, string, string)

Activates a license. Depending on the license settings, this can register a machine, start a trial, or acquire or renew a floating seat.

<CodeGroup>
  ```csharp C# theme={null}
  public static RawResponse Activate(string token, int productId, string key, string machineCode = "", bool metadata = false, int floatingTimeInterval = 0, int maxOverdraft = 0, string OSInfo = null, string friendlyName = "", string LicenseServerUrl = null)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function Activate(token As String, productId As Integer, key As String, Optional machineCode As String = "", Optional metadata As Boolean = False, Optional floatingTimeInterval As Integer = 0, Optional maxOverdraft As Integer = 0, Optional OSInfo As String = Nothing, Optional friendlyName As String = "", Optional LicenseServerUrl As String = Nothing) As RawResponse
  ```
</CodeGroup>

[Web API Reference](/api-reference/generated/Activate)

**Parameters**

| Name | Type | Description |
| - | - | - |
| `token` | `string` | The access token with the permission required by this API method. |
| `productId` | `int` | The product ID. |
| `key` | `string` | The license-key string. |
| `machineCode` | `string` | The machine or process identifier used for this activation. |
| `metadata` | `bool` | Whether to request metadata with the response. |
| `floatingTimeInterval` | `int` | The floating-seat interval, in seconds. Zero leaves floating activation disabled for this request. |
| `maxOverdraft` | `int` | Additional floating seats allowed above the configured limit. Defaults to zero. |
| `OSInfo` | `string` | OS information to send. Null allows automatic collection; an empty string prevents it. |
| `friendlyName` | `string` | An optional display name for the activation. |
| `LicenseServerUrl` | `string` | An optional License Server base URL. |

**Returns:** [`RawResponse`](/libraries/dotnet-reference/models/raw-response). A signed `RawResponse`. Pass it to [`FromResponse(string, RawResponse)`](/libraries/dotnet-reference/license-key#from-response-654142ab2a) to verify and decode the license.

**Checks:** The SDK does not verify the returned license signature in this call. Verify the response using the corresponding signature helper.

This overload requests signing with `SignMethod.StringSign` and model version 3. The access token needs the **Activate permission**. `metadata` defaults to false; metadata is not verified by `LicenseKey.FromResponse`. An empty `OSInfo` prevents automatic OS information collection.

<a id="add-feature-8b2d71bd87" />

### AddFeature(string, FeatureModel)

This method will change a given feature to be true (in a license).
If the key algorithm in the product is SKGL, the key string
will be changed if necessary. Otherwise, if SKM15 is used,
the key will stay the same.
If the key is changed, the new key will be stored in the message.

<CodeGroup>
  ```csharp C# theme={null}
  public static BasicResult AddFeature(string token, FeatureModel parameters)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function AddFeature(token As String, parameters As FeatureModel) As BasicResult
  ```
</CodeGroup>

[Web API Reference](/api-reference/generated/AddFeature)

**Parameters**

| Name | Type | Description |
| - | - | - |
| `token` | `string` | The access token. Read more at [Auth](/api-reference/generated/Auth) |
| `parameters` | [`FeatureModel`](/libraries/dotnet-reference/models/feature-model) | The parameters that the method needs. |

**Returns:** [`BasicResult`](/libraries/dotnet-reference/models/basic-result). The API response. Check `Result` and `Message` before using the returned data.

Handled client failures are returned as a non-null result with [`Error`](/libraries/dotnet-reference/models/result-type#error-04457454a8).
Always inspect Result before treating the response as successful.

<a id="block-key-55989bb165" />

### BlockKey(string, KeyLockModel)

This method will block a specific license key to ensure that the key cannot be
accessible by most of the methods in the Web API (activation, validation,
optional field, and deactivation).Note, blocking the key will still allow you
to access the key in Web API 3, unless otherwise stated for a given Web API 3 method.
To do the reverse, please see [`UnblockKey(string, KeyLockModel)`](/libraries/dotnet-reference/methods/key#unblock-key-50cf3aa32e).

<CodeGroup>
  ```csharp C# theme={null}
  public static BasicResult BlockKey(string token, KeyLockModel parameters)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function BlockKey(token As String, parameters As KeyLockModel) As BasicResult
  ```
</CodeGroup>

[Web API Reference](/api-reference/generated/BlockKey)

**Parameters**

| Name | Type | Description |
| - | - | - |
| `token` | `string` | The access token ([https://app.cryptolens.io/User/AccessToken#/](https://app.cryptolens.io/User/AccessToken#/)) with Block key permission. |
| `parameters` | [`KeyLockModel`](/libraries/dotnet-reference/models/key-lock-model) | The parameters that the method needs. |

**Returns:** [`BasicResult`](/libraries/dotnet-reference/models/basic-result). The API response. Check `Result` and `Message` before using the returned data.

Handled client failures are returned as a non-null result with [`Error`](/libraries/dotnet-reference/models/result-type#error-04457454a8).
Always inspect Result before treating the response as successful.

<a id="change-customer-86706ec468" />

### ChangeCustomer(string, ChangeCustomerModel)

This method will change the customer associated with a license.
If the customer is not specified (for example, if CustomerId=0) or
the customer with the provided ID does not exist, any customer that
was previously associated with the license will be dissociated.

<CodeGroup>
  ```csharp C# theme={null}
  public static BasicResult ChangeCustomer(string token, ChangeCustomerModel parameters)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function ChangeCustomer(token As String, parameters As ChangeCustomerModel) As BasicResult
  ```
</CodeGroup>

[Web API Reference](/api-reference/generated/ChangeCustomer)

**Parameters**

| Name | Type | Description |
| - | - | - |
| `token` | `string` | The access token ([https://app.cryptolens.io/User/AccessToken#/](https://app.cryptolens.io/User/AccessToken#/)) with Change Customer permission. |
| `parameters` | [`ChangeCustomerModel`](/libraries/dotnet-reference/models/change-customer-model) | The parameters that the method needs. |

**Returns:** [`BasicResult`](/libraries/dotnet-reference/models/basic-result). The API response. Check `Result` and `Message` before using the returned data.

<a id="change-notes-02e3c7142c" />

### ChangeNotes(string, ChangeNotesModel)

This method will change the content of the notes field of a given license key.

<CodeGroup>
  ```csharp C# theme={null}
  public static BasicResult ChangeNotes(string token, ChangeNotesModel parameters)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function ChangeNotes(token As String, parameters As ChangeNotesModel) As BasicResult
  ```
</CodeGroup>

[Web API Reference](/api-reference/generated/ChangeNotes)

**Parameters**

| Name | Type | Description |
| - | - | - |
| `token` | `string` | The access token ([https://app.cryptolens.io/User/AccessToken#/](https://app.cryptolens.io/User/AccessToken#/)) with Change Notes permission. |
| `parameters` | [`ChangeNotesModel`](/libraries/dotnet-reference/models/change-notes-model) | The parameters that the method needs. |

**Returns:** [`BasicResult`](/libraries/dotnet-reference/models/basic-result). The API response. Check `Result` and `Message` before using the returned data.

<a id="change-reseller-26bee15d34" />

### ChangeReseller(string, ChangeResellerModel)

This method will change the reseller of a license.
If the reseller is not specified (for example, if ResellerId=0)
or the reseller with the provided ID does not exist, any reseller
that was previously associated with the license will be dissociated.

<CodeGroup>
  ```csharp C# theme={null}
  public static BasicResult ChangeReseller(string token, ChangeResellerModel parameters)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function ChangeReseller(token As String, parameters As ChangeResellerModel) As BasicResult
  ```
</CodeGroup>

[Web API Reference](/api-reference/generated/ChangeReseller)

**Parameters**

| Name | Type | Description |
| - | - | - |
| `token` | `string` | The access token ([https://app.cryptolens.io/User/AccessToken#/](https://app.cryptolens.io/User/AccessToken#/)) with Change Reseller permission. |
| `parameters` | [`ChangeResellerModel`](/libraries/dotnet-reference/models/change-reseller-model) | The parameters that the method needs. |

**Returns:** [`BasicResult`](/libraries/dotnet-reference/models/basic-result). The API response. Check `Result` and `Message` before using the returned data.

<a id="create-key-4082be0b70" />

### CreateKey(string, CreateKeyModel)

This method will create a new license key, which is the same as GenerateKey in Web API 2.

<CodeGroup>
  ```csharp C# theme={null}
  public static CreateKeyResult CreateKey(string token, CreateKeyModel parameters)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function CreateKey(token As String, parameters As CreateKeyModel) As CreateKeyResult
  ```
</CodeGroup>

[Web API Reference](/api-reference/generated/CreateKey)

**Parameters**

| Name | Type | Description |
| - | - | - |
| `token` | `string` | Details such as access token and Version. |
| `parameters` | [`CreateKeyModel`](/libraries/dotnet-reference/models/create-key-model) | The parameters that the method needs. |

**Returns:** [`CreateKeyResult`](/libraries/dotnet-reference/models/create-key-result). The API response. Check `Result` and `Message` before using the returned data.

Handled client failures are returned as a non-null result with [`Error`](/libraries/dotnet-reference/models/result-type#error-04457454a8).
Always inspect Result before treating the response as successful.

<a id="create-trial-key-0c9de7ee94" />

### CreateTrialKey(string, CreateTrialKeyModel)

Creates a trial license for the supplied product and machine code.

<CodeGroup>
  ```csharp C# theme={null}
  public static CreateKeyResult CreateTrialKey(string token, CreateTrialKeyModel parameters)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function CreateTrialKey(token As String, parameters As CreateTrialKeyModel) As CreateKeyResult
  ```
</CodeGroup>

[Web API Reference](/api-reference/generated/CreateTrialKey)

**Parameters**

| Name | Type | Description |
| - | - | - |
| `token` | `string` | The access token with the permission required by this API method. |
| `parameters` | [`CreateTrialKeyModel`](/libraries/dotnet-reference/models/create-trial-key-model) | The request model. Its properties are listed on the linked model page. |

**Returns:** [`CreateKeyResult`](/libraries/dotnet-reference/models/create-key-result). The API response. Check `Result` and `Message` before using the returned data.

<a id="deactivate-9d1100e31a" />

### Deactivate(string, DeactivateModel)

Releases an activation for the supplied machine code.

<CodeGroup>
  ```csharp C# theme={null}
  public static BasicResult Deactivate(string token, DeactivateModel parameters)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function Deactivate(token As String, parameters As DeactivateModel) As BasicResult
  ```
</CodeGroup>

[Web API Reference](/api-reference/generated/Deactivate)

**Parameters**

| Name | Type | Description |
| - | - | - |
| `token` | `string` | The access token. Read more at [Auth](/api-reference/generated/Auth) |
| `parameters` | [`DeactivateModel`](/libraries/dotnet-reference/models/deactivate-model) | The parameters that the method needs. |

**Returns:** [`BasicResult`](/libraries/dotnet-reference/models/basic-result). The API response. Check `Result` and `Message` before using the returned data.

The access token needs the **Deactivate permission**. One access token can have both Activate and Deactivate permissions. Set `DeactivateModel.Floating=true` when releasing a floating activation.

<a id="extend-license-61f0998fc3" />

### ExtendLicense(string, ExtendLicenseModel)

Extends the license using the period supplied in ExtendLicenseModel.

<CodeGroup>
  ```csharp C# theme={null}
  public static BasicResult ExtendLicense(string token, ExtendLicenseModel parameters)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function ExtendLicense(token As String, parameters As ExtendLicenseModel) As BasicResult
  ```
</CodeGroup>

[Web API Reference](/api-reference/generated/ExtendLicense)

**Parameters**

| Name | Type | Description |
| - | - | - |
| `token` | `string` | The access token with the permission required by this API method. |
| `parameters` | [`ExtendLicenseModel`](/libraries/dotnet-reference/models/extend-license-model) | The request model. Its properties are listed on the linked model page. |

**Returns:** [`BasicResult`](/libraries/dotnet-reference/models/basic-result). The API response. Check `Result` and `Message` before using the returned data.

<a id="get-key-3d8e65fdd6" />

### GetKey(string, KeyInfoModel)

Retrieves license information without registering a machine or renewing a floating seat.

<CodeGroup>
  ```csharp C# theme={null}
  public static KeyInfoResult GetKey(string token, KeyInfoModel parameters)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function GetKey(token As String, parameters As KeyInfoModel) As KeyInfoResult
  ```
</CodeGroup>

[Web API Reference](/api-reference/generated/GetKey)

**Parameters**

| Name | Type | Description |
| - | - | - |
| `token` | `string` | Details such as access token and Version. |
| `parameters` | [`KeyInfoModel`](/libraries/dotnet-reference/models/key-info-model) | The parameters that the method needs. |

**Returns:** [`KeyInfoResult`](/libraries/dotnet-reference/models/key-info-result). The API response. Check `Result` and `Message` before using the returned data.

**Checks:** The SDK does not verify the returned license signature in this call.

The access token needs the **GetKey permission**. A successful lookup can return a blocked license. Check the fields your application relies on; retrieval success alone is not license validation.

<a id="get-key-476221e06f" />

### GetKey(string, int, string, bool, string)

Retrieves license information without registering a machine or renewing a floating seat.

<CodeGroup>
  ```csharp C# theme={null}
  public static RawResponse GetKey(string token, int productId, string key, bool metadata = false, string LicenseServerUrl = null)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function GetKey(token As String, productId As Integer, key As String, Optional metadata As Boolean = False, Optional LicenseServerUrl As String = Nothing) As RawResponse
  ```
</CodeGroup>

[Web API Reference](/api-reference/generated/GetKey)

**Parameters**

| Name | Type | Description |
| - | - | - |
| `token` | `string` | The access token with the permission required by this API method. |
| `productId` | `int` | The product ID. |
| `key` | `string` | The license-key string. |
| `metadata` | `bool` | Whether to request metadata with the response. |
| `LicenseServerUrl` | `string` | An optional License Server base URL. |

**Returns:** [`RawResponse`](/libraries/dotnet-reference/models/raw-response). A signed `RawResponse`. Use [`FromResponse(string, RawResponse)`](/libraries/dotnet-reference/license-key#from-response-654142ab2a) to verify and decode it.

**Checks:** The SDK does not verify the returned license signature in this call.

This overload requests `Sign=true`, `SignMethod.StringSign` and model version 3. It does not acquire or renew a floating seat.

<a id="machine-lock-limit-8909bf2f09" />

### MachineLockLimit(string, MachineLockLimit)

This method will change the maximum number of machine codes that a license key can have.

<CodeGroup>
  ```csharp C# theme={null}
  public static BasicResult MachineLockLimit(string token, MachineLockLimit parameters)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function MachineLockLimit(token As String, parameters As MachineLockLimit) As BasicResult
  ```
</CodeGroup>

[Web API Reference](/api-reference/generated/MachineLockLimit)

**Parameters**

| Name | Type | Description |
| - | - | - |
| `token` | `string` | Details such as access token and Version. |
| `parameters` | [`MachineLockLimit`](/libraries/dotnet-reference/models/machine-lock-limit) | The parameters that the method needs. |

**Returns:** [`BasicResult`](/libraries/dotnet-reference/models/basic-result). The API response. Check `Result` and `Message` before using the returned data.

Handled client failures are returned as a non-null result with [`Error`](/libraries/dotnet-reference/models/result-type#error-04457454a8).
Always inspect Result before treating the response as successful.

<a id="remove-feature-2fc5f267fa" />

### RemoveFeature(string, FeatureModel)

Disables the selected feature, from F1 through F8, on a license.

<CodeGroup>
  ```csharp C# theme={null}
  public static BasicResult RemoveFeature(string token, FeatureModel parameters)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function RemoveFeature(token As String, parameters As FeatureModel) As BasicResult
  ```
</CodeGroup>

[Web API Reference](/api-reference/generated/RemoveFeature)

**Parameters**

| Name | Type | Description |
| - | - | - |
| `token` | `string` | The access token with the permission required by this API method. |
| `parameters` | [`FeatureModel`](/libraries/dotnet-reference/models/feature-model) | The request model. Its properties are listed on the linked model page. |

**Returns:** [`BasicResult`](/libraries/dotnet-reference/models/basic-result). The API response. Check `Result` and `Message` before using the returned data.

<a id="unblock-key-50cf3aa32e" />

### UnblockKey(string, KeyLockModel)

This method will unblock a specific license key to ensure that the key can be
accessible by most of the methods in the Web API (activation, validation,
optional field, and deactivation). To do the reverse, please see [`BlockKey(string, KeyLockModel)`](/libraries/dotnet-reference/methods/key#block-key-55989bb165).

<CodeGroup>
  ```csharp C# theme={null}
  public static BasicResult UnblockKey(string token, KeyLockModel parameters)
  ```

  ```vb VB.NET theme={null}
  Public Shared Function UnblockKey(token As String, parameters As KeyLockModel) As BasicResult
  ```
</CodeGroup>

[Web API Reference](/api-reference/generated/UnblockKey)

**Parameters**

| Name | Type | Description |
| - | - | - |
| `token` | `string` | The access token ([https://app.cryptolens.io/User/AccessToken#/](https://app.cryptolens.io/User/AccessToken#/)) with Unblock key permission. |
| `parameters` | [`KeyLockModel`](/libraries/dotnet-reference/models/key-lock-model) | The parameters that the method needs. |

**Returns:** [`BasicResult`](/libraries/dotnet-reference/models/basic-result). The API response. Check `Result` and `Message` before using the returned data.

Handled client failures are returned as a non-null result with [`Error`](/libraries/dotnet-reference/models/result-type#error-04457454a8).
Always inspect Result before treating the response as successful.

## FAQ

<AccordionGroup>
  <Accordion title="Does Activate Verify the Signature Automatically?" id="automatic-signature">
    No. Both `Activate` overloads return the API response without verifying its signature. The overload returning `RawResponse` requests signing automatically; pass the response to `LicenseKey.FromResponse` with your RSA public key. With `ActivateModel`, set `Sign=true` and use the signature helpers on the returned `LicenseKey`.

    Verification of a signature is separate from your product, expiry, feature and machine checks. The [Key Verification FAQ](/examples/key-verification#faq) explains these checks.
  </Accordion>

  <Accordion title="Can I Activate and Deactivate With the Same Access Token?" id="activate-and-deactivate">
    Yes. Give the access token both the **Activate permission** and the **Deactivate permission**. Activate alone does not grant Deactivate. For a floating seat, call Deactivate with the same process ID and `Floating=true`. See [Floating Licenses](/licensing-models/floating).
  </Accordion>

  <Accordion title="Does GetKey Renew a Floating Seat?" id="getkey-floating">
    No. Use Activate to acquire or renew a floating seat, reusing the same process ID. GetKey retrieves license information without renewing the seat. `maxOverdraft` defaults to `0`; set a positive value only when you want to allow extra seats. A failed renewal does not extend the last confirmed seat window.
  </Accordion>
</AccordionGroup>

[.NET SDK Reference](/libraries/dotnet-api) · [Reviewed Source Revision](https://github.com/Cryptolens/cryptolens-dotnet/tree/30aaf399ba53d9a111bee896c35bf557fa219394)


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