.. _licensing:

=========
Licensing 
=========

|product-name| uses software protection to protect id3's intellectual property.
To work, the |product-name| libraries require a license key, which must be installed on the target system before starting your application.

The trial version of the SDK is a full version time-limited (60 days).
A developer license is required to develop an application based on |product-name|.
A runtime license is required to deploy an application based on |product-name|.

.. _license_types:

License types
=================

The following licenses are available: 

.. list-table:: 
  :width: 100%
  :widths: 20 80
  :header-rows: 1

  * - License
    - Description
     
  * - Perpetual license
    - 
      | The perpetual license authorizes to use the product indefinitely with the payment of a single fee.
        The license is bound to a device and never expires.
      | No internet connection required.

  * - Temporary license
    - | The temporary license expires after a fixed number of days following its activation.
      | No internet connection required.

  * - Online license
    - | The online license requires a regular internet connection to work.
      | A mechanism allows the software to run offline during a grace period (generally 30 days).

.. note:: Temporary licenses may be extended on request. Please contact our sales department for a license extension.


.. _dongle_license:

Dongle license
--------------
For Windows applications, a license can be installed on a standard USB key.

.. warning:: A dongle license is linked to the serial number of the USB key, so once a license is installed on that particular dongle, it cannot be transferred to another dongle.

License modules
===================

A license module gives access to some functionalities of the SDK as described below:

.. list-table:: 
  :width: 100%
  :widths: 30 70
  :header-rows: 1

  * - Module
    - Description
  * - Face
    - Main module
  * - FaceAttributes
    - Provides access to the :ref:`id3_face_face_analyser_class`
  * - FaceEncoder
    - Provides access to the :ref:`id3_face_face_encoder_class`
  * - FaceGPU
    - Provides access to the GPU.
  * - FaceMatcher
    - Provides access to the :ref:`id3_face_face_matcher_class`
  * - FacePAD
    - Provides access to the :ref:`id3_face_face_pad_class`
  * - ServerEdition
    - Identifies the server edition (Windows, Linux, Mac)
  * - MobileEdition
    - Identifies the mobile edition (Android, iOS)
  * - EdgeEdition
    - Identifies the edge edition (Raspberry PI)

.. hint:: In your application, call the :ref:`id3_face_face_license_check_module_class_method` to find out whether a particular module is enabled in your license.

.. _license_activation:

License activation
==========================

The activation of a license is required prior to use any module of this SDK.

License manager (Windows only)
------------------------------
On windows the graphical License Manager application may also be used to activate licenses. Please refer to the License Manager user's guide for more details.

Please note that on windows, and windows only, you can lock your license on a USB device.

Command-line interface
----------------------

A command-line activation software is available in the `activation/cli-tool` directory.

For example on linux x64:

.. code-block::

    cd activation/cli-tool/linux/x64
    chmod +x id3LicenseActivationCLI
    ./id3LicenseActivationCLI --help

Several options are possible to activate a license. See :ref:`license_activation_options` for details.

**Activation with a serial number:**

.. code-block::

    id3LicenseActivationCLI.exe --activate .\data\id3Face.lic --serialkey="XXXX-XXXX-XXXX-XXXX"

**Activation with an activation key:**

.. code-block::

    id3LicenseActivationCLI.exe --activate .\data\id3Face.lic --activationkey="email-XXXXXXXX-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"

**Activation with credentials:**

.. code-block::

    id3LicenseActivationCLI.exe --activate .\data\id3Face.lic --login="login@domain.com" --password="myPassword" --reference="XXXXXXXX"


Programmatic activation
-----------------------

It is generally preferred to activate the license programmatically within your application. 
See :ref:`license_handling` in the :ref:`sdk_usage` section for details.

.. note:: On mobile devices, the :ref:`license_hardware_id` is linked to the application itself, so programmatic activation is the only way to activate a license in this case.


.. _license_activation_options:

License activation options
--------------------------

The following license activation options are available:

- **Serial number**: A unique key in the format ``XXXX-XXXX-XXXX-XXXX`` allowing a single activation.
- **Activation key**: A unique key in the format ``email-XXXXXXXX-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX`` allowing multiple activations on multiple devices.
- **Credentials**: Customer login/password and reference number of the product to be activated.
 
.. important:: 
    An internet connection is required to complete the activation procedure.
    Unless the ``Online`` option is enabled, once the license is activated, the internet is no longer required.

.. note:: During the activation process, the SDK license is linked to a unique hardware identifier. See :ref:`license_hardware_id` for details.


.. _license_hardware_id:

License hardware code
=====================

Each license is bound to a hardware identifier which is calculated according to the target platform.

.. list-table:: 
  :width: 100%
  :widths: 20 80
  :header-rows: 1

  * - Platform
    - Hardware ID
     
  * - Windows OS
    - 1. NetBIOS name + Volume ID
      2. Serial number of a USB key (see :ref:`dongle_license`)

  * - Linux OS
    - Host name + Machine ID

  * - Android
    - 1. Android ID (unique to each combination of app-signing key, user, and device). `More information. <https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID>`_
      2. Package name (available on request)

  * - iOS
    - 1. Vendor identifier, or
      2. Bundle ID (available on request)

  * - macOS
    - Host name + machine ID

  * - Jetson Nano
    - Host name + machine ID + serial number

.. warning:: Any change on one of these items may invalidate exsiting licenses on the computer.

.. important:: 
    On Android and iOS platforms, it is not possible, for reasons of confidentiality, to retrieve a truly unique hardware identifier. The side effect is that the hardware code is different (but fixed) for every application you develop, even on the same device.

The hardware code is in the form ``XXXXXXX-XXXXXXX-XXXXXXX-XXXXX00``
The last two digits identify the platform:

- ``01``: Windows OS
- ``03``: Linux OS
- ``05``: Android
- ``06``: Android package name
- ``07``: iOS
- ``08``: macOS
- ``09``: Jetson Nano
- ``10``: iOS Bundle ID
- ``11``: Dongle (Windows only)

.. _license_manager:

License manager 
===============

The id3 License Manager is a Windows application that helps you manage your license files. Before you can
use id3 Software Development Kits (SDKs), you must have the correct license installed.

The purpose of this guide is to describe the use of id3 License Manager and how to activate a license.

**Prerequisites**

- Microsoft Windows 7, 8 or 10,
- An active Internet connection

.. license_transfer

License repositionning
======================

License repositionning is possible under certain conditions.

Please contact our sales department or make a support request to obtain a license repositionning.

.. important:: Any request to reposition a license must be justified. The serial number of the license must be mentioned in the request.

See also
========
- :ref:`license_handling`
- :ref:`license_hardware_id`
