License handling

Activating a license

One of the following methods can be used to activate a license programmatically:

Here is an example how to activate a license using a serial number:

hardware_code = BiosealLicense.get_host_hardware_code(LicenseHardwareCodeType.WINDOWS_OS)
print(f"Hardware code: {hardware_code}")

try:
    BiosealLicense.activate_serial_key(hardware_code, serial_key, "[Computer name]", license_path)
    print("License activated successfully")
except BiosealException as ex:
    print(ex.message)
using id3.Bioseal;
using System;

try
{
    // Get the hardware code for this device
    // Choose the appropriate hardware code type based on your platform:
    // - LicenseHardwareCodeType.WindowsOs for Windows
    // - LicenseHardwareCodeType.MacOs for macOS
    // - LicenseHardwareCodeType.LinuxOs for Linux
    string hardwareCode = BiosealLicense.GetHostHardwareCode(LicenseHardwareCodeType.WindowsOs);

    // Activate the license using an activation key
    string activationKey = "YOUR_ACTIVATION_KEY";
    string commentary = "Activation from C# application";
    string licensePath = "path/to/save/license.lic";

    // Activate and save the license to a file
    BiosealLicense.ActivateActivationKey(
        hardwareCode,
        activationKey,
        commentary,
        licensePath
    );

    // Check the license to verify it's valid
    BiosealLicense.CheckLicense(licensePath);

    Console.WriteLine($"License activated successfully! Valid until: {BiosealLicense.GetExpiryDate()}");
    Console.WriteLine($"License saved to: {licensePath}");
}
catch (BiosealException ex)
{
    Console.WriteLine($"Error during license activation: {ex.Message}");
}
import 'package:id3_bioseal/id3_bioseal.dart';

void main() async {
  try {
    // Get the hardware code for this device
    // Choose the appropriate hardware code type based on your platform:
    // - windowsOs for Windows
    // - macOs for macOS
    // - linuxOs for Linux
    final hardwareCode = BiosealLicense.getHostHardwareCode(LicenseHardwareCodeType.windowsOs);

    // Activate the license using an activation key
    const activationKey = 'YOUR_ACTIVATION_KEY';
    const commentary = 'Activation from Dart application';
    const licensePath = 'path/to/save/license.lic';

    // Activate and save the license to a file
    BiosealLicense.activateActivationKey(
      hardwareCode,
      activationKey,
      commentary,
      licensePath,
    );

    // Check the license to verify it's valid
    BiosealLicense.checkLicense(licensePath);

    final expiryDate = BiosealLicense.getExpiryDate();
    print('License activated successfully! Valid until: $expiryDate');
    print('License saved to: $licensePath');
  } on BiosealException catch (e) {
    print('Error during license activation: ${e.message}');
  }
}

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.

Hint

We recommend that you activate the application the first time you run it, and then store the license on the device for future use.

Warning

Internet usage permission is required for the activation process.

Checking the license

Before calling any function of the SDK, you need to check a valid license file first.

try:
    BiosealLicense.check_license(license_path)
    print(f"License name    : {BiosealLicense.get_license_name()}")
    print(f"License owner   : {BiosealLicense.get_license_owner()}")
    print(f"License serial  : {BiosealLicense.get_license_file_serial()}")
    print(f"License type    : {BiosealLicense.get_license_type().name}")
    print(f"Hardware code   : {BiosealLicense.get_license_file_hardware_code()}")
except BiosealException as ex:
    print(ex.message)

See also