.. index:: 
  !DocumentLicense.activateActivationKeyBuffer Method
  
.. _id3_document_document_license_activate_activation_key_buffer_class_method:

===============================================================================
DocumentLicense.activateActivationKeyBuffer Method
===============================================================================

Module: :ref:`DocumentLicense<id3_document_document_license_class>`

Definition
----------

Activates a license using an activation key and returns the license in a data buffer.


.. tab-set::

    .. tab-item:: Python
      :sync: Python

      .. code:: Python

        @staticmethod
        activate_activation_key_buffer(hardware_code: str, activation_key: str, commentary: str) -> bytearray

      **Parameters**

        .. line-block::

          ``hardware_code`` str
          :guilabel:`in` The hardware code on which the license file will be attached, to be retrieved using the GetHostHardwareCode function.

          ``activation_key`` str
          :guilabel:`in` The id3 activation key.

          ``commentary`` str
          :guilabel:`in` Commentary associated to this license activation.


      **Returns**

        .. line-block::

          ``bytearray``
          The license data buffer.

      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


    .. tab-item:: Dart
      :sync: Dart

      .. code:: Dart

        static Uint8List activateActivationKeyBuffer(String? hardwareCode, String? activationKey, String? commentary)

      **Parameters**

        .. line-block::

          ``hardwareCode`` String
          :guilabel:`in` The hardware code on which the license file will be attached, to be retrieved using the GetHostHardwareCode function.

          ``activationKey`` String
          :guilabel:`in` The id3 activation key.

          ``commentary`` String
          :guilabel:`in` Commentary associated to this license activation.


      **Returns**

        .. line-block::

          ``Uint8List``
          The license data buffer.

      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


    .. tab-item:: C#
      :sync: C#

      .. code:: C#

        public static byte[] ActivateActivationKeyBuffer(string hardwareCode, string activationKey, string commentary)

      **Parameters**

        .. line-block::

          ``hardwareCode`` string
          :guilabel:`in` The hardware code on which the license file will be attached, to be retrieved using the GetHostHardwareCode function.

          ``activationKey`` string
          :guilabel:`in` The id3 activation key.

          ``commentary`` string
          :guilabel:`in` Commentary associated to this license activation.


      **Returns**

        .. line-block::

          ``byte[]``
          The license data buffer.

      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


    .. tab-item:: Java
      :sync: Java

      .. code:: Java

        public static byte[] activateActivationKeyBuffer(String hardwareCode, String activationKey, String commentary) throws DocumentException

      **Parameters**

        .. line-block::

          ``hardwareCode`` String
          :guilabel:`in` The hardware code on which the license file will be attached, to be retrieved using the GetHostHardwareCode function.

          ``activationKey`` String
          :guilabel:`in` The id3 activation key.

          ``commentary`` String
          :guilabel:`in` Commentary associated to this license activation.


      **Returns**

        .. line-block::

          ``byte[]``
          The license data buffer.

      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


    .. tab-item:: Swift
      :sync: Swift

      .. code:: Swift

        public static func activateActivationKeyBuffer(hardwareCode: String, activationKey: String, commentary: String) throws -> [UInt8]

      **Parameters**

        .. line-block::

          ``hardwareCode`` String
          :guilabel:`in` The hardware code on which the license file will be attached, to be retrieved using the GetHostHardwareCode function.

          ``activationKey`` String
          :guilabel:`in` The id3 activation key.

          ``commentary`` String
          :guilabel:`in` Commentary associated to this license activation.


      **Returns**

        .. line-block::

          ``[UInt8]``
          The license data buffer.

      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


    .. tab-item:: C
      :sync: C

      .. code:: C

        int id3DocumentLicense_ActivateActivationKeyBuffer (
            const char * hardwareCode, 
            const char * activationKey, 
            const char * commentary, 
            unsigned char * licenseFileBuffer, 
            int * licenseFileBufferSize)

      **Parameters**

        .. line-block::

          ``hardwareCode`` const char *
          :guilabel:`in` The hardware code on which the license file will be attached, to be retrieved using the GetHostHardwareCode function.

          ``activationKey`` const char *
          :guilabel:`in` The id3 activation key.

          ``commentary`` const char *
          :guilabel:`in` Commentary associated to this license activation.

          ``licenseFileBuffer`` unsigned char *
          :guilabel:`out` The license data buffer.

          ``licenseFileBufferSize`` int *
          :guilabel:`in` Size of the 'licenseFileBuffer' buffer. Receives the number of elements in the 'licenseFileBuffer' array.


      **Returns**

        .. line-block::

          ``int``
          An error code.
          See :ref:`id3DocumentError<id3_document_document_error_enum>` file for the list of possible error codes.


