Zengain beta open for customers sign up now:
click here
Documentation
SupportNalpeiron.comGithubFree TrialFeedback
  • Documentation
  • Zentitle2 Docs
  • Zengain Docs
  • Zentitle I (V10)
  • Education & Training
  • Welcome
    • Zentitle2 documentation: License Management Software
    • Introduction to Zentitle2
  • Latest UI Changes
  • Zentitle Overview
    • Zentitle Quick Overview
      • Zentitle2 Features & Benefits
      • A single source of truth: 1 platform
      • Zentitle Architecture
      • Zentitle supports every platform
      • Zentitle business models
      • Critical differences for secure site/offline/dark site management
      • Zentitle for SaaS Licensing
  • Quick Start
    • Onboarding Zentitle2
    • Integrating is easy
    • Pricing & Packaging with Zentitle
  • Using the Platform UI
    • Introduction
    • New User Setup
    • Getting around
      • Search
      • Using reports
      • Providing feedback
    • Getting started
  • UI: ADMINISTRATION
    • Introduction
    • Users
      • Managing Users
      • Resending user invites
      • User permissions
      • Lost password
    • API Credentials
      • Package Registry
    • Webhooks
      • Logs
      • Workflow automation software
    • Integrations
      • FastSpring
      • SalesForce Sample Integration
        • Sample Integration Installation
        • Post-Installation Configuration
        • Connecting Salesforce to Zentitle
        • Creating a Zentitle Customer in SalesForce
        • Creating a Zentitle Entitlement in SalesForce
        • Editing Zentitle Entitlements in SalesForce
        • Managing Software Activations in SalesForce
    • Configuration
      • Import customers
      • Account Based Licensing (Identity-based licensing)
        • Setup Account Based Licensing with OpenID tokens.
        • Setup Account Based Licensing with username/password
        • Branding the user experience
      • End User Portal
        • End User Portal User Access
        • End user - Use of the portal
        • End User Offline Activation
      • Custom Fields
      • Security (2FA)
    • "Hard" Delete
  • UI: Dashboard
    • The Dashboard
  • UI: Customers
    • Customers and contacts
    • Customers
      • Adding (managing) contacts
      • The contact page
      • Setting up End User Portal (EUP) access
      • Inviting contacts to EUP
      • Disabling Customers
      • Managing Entitlements (from the Customer page)
  • UI: Entitlements
    • Entitlements
      • Using Entitlements
      • Maintenance options
    • Working with Entitlements
      • Activation Codes
      • Contacts (ABL)
      • Activations
      • Activity log
      • Notes
    • Managing Entitlements
      • Allocating entitlements
      • Change the offering (upgrade/downgrade)
      • Entitlements with overrides/changes
      • Renewing an entitlement
      • Resetting the usage count
      • Disabling Entitlements
      • Entitlements in overdraft (seats)
  • UI: Product Catalog
    • Product paradigm
    • Products
      • Product Features
      • Overdraft option (feature usage)
      • Feature Control
      • Product Attributes
      • Product Editions
      • Edition Setup
    • Offerings
      • Overdraft option (seats)
      • Managing offerings
      • Maintenance options
      • Change offering (upgrade/downgrade)
      • Custom Fields
    • Plans
      • Trial plans
    • Global Features (and attributes)
  • UI: Local License Server
    • Local License Server (LLS)
      • Local License Server Installation
      • LLS License End-User Management
      • Entitlements to be used on LLS instances
      • LLS Licensing API
      • LLS Release Notes
  • UI: Help
    • Support
  • Developers
    • Licensing & Management APIs
      • API docs
      • API Rate limits
      • Collecting credentials for integration
      • API Versioning
    • The Licensing Client (.NET)
      • Configure NuGet Source
      • Configuring the Activation
      • Configuring the SharedActivation
      • Working with SharedActivation
      • Licensing API Nonce
      • IActivation interface
      • Zentitle2Core Library
      • Exceptions
      • FAQ
      • Release Notes
    • The Licensing Client (C++)
      • Configuring the Activation
      • Licensing API Nonce
      • IActivation interface
      • Zentitle2Core Library
      • Exceptions
      • Release Notes
    • The Licensing Client (Java)
      • Configure JAR Source
      • Configuring the Activation
      • Licensing API Nonce
      • IActivation interface
      • Zentitle2Core Library
      • Exceptions
      • FAQ
      • Release Notes
    • The Zentitle2Core Library (C++)
      • Security
      • Offline Activation
      • Generating Device Fingerprint
      • Using the Zentitle2Core Library
      • Troubleshooting and FAQs
    • Platform Summary
      • Turboscale architecture
      • SaaS Application Licensing
      • On-Premise Licensing
        • 1-Step Offline Deactivation: On-Premise
        • 2-Step Offline Activation: On-Premise
    • Offline Activation
    • Virtual Machine Control
    • No-code Test Application
      • Creating a Product and Entitlement
      • Download the demo files
      • OnPremDemo.dll.config setup
      • Test the demo application
        • Install Desktop Runtime
    • No-code SaaS Example
      • Creating a Product and Entitlement
      • Download the demo files
      • Collecting the serverside parameters
      • Edit appsettings.json file for IDE based Testing
      • Edit docker-compose.yml file for Docker-based Testing
      • Test the demo application
        • Using docker to test
    • Naming conventions/Glossary
  • Premium Features
    • Overdraft Tracker (Basic)
      • API references (Overdraft)
      • Overdraft Tracker on the dashboard
      • Reporting with the Overdraft Tracker
    • Network Licensing
    • Change log feature
  • Use Cases
    • Dark Site Local License Server (Network-based licensing)
    • Renewals (Customer Success) Management
    • Subscription grace periods
    • Self-service - End-user portal
    • Virtualized Environments
    • Usage-Based Licensing
    • Trial Management
    • Identity Based Licensing: Understanding IDP
    • Single Tenant Option
    • Entitlements with ERP & billing systems
    • Entitlements with Subscriptions
    • Entitlements with a CRM
    • E-commerce Integration
    • IoT and hardware licensing
    • SaaS Applications
    • Overuse tracking (overdrafts)
    • Order Fulfillment
  • Zentitle and M&A deals
  • Other
    • Zentitle2 Changelog
      • Terms and Conditions Changelog
Powered by GitBook
LogoLogo

Nalpeiron Privacy Policy

  • Privacy and Cookie Policy

Nalpeiron Growth Platform Terms

  • Nalpeiron ELTC

Get a FREE Trial

  • Click here for FREE Trial

© Copyright - Nalpeiron, all rights reserved. Nalpeiron, The Nalpeiron Growth Platform, Zentitle and Zengain are trademarks of Nalpeiron Inc. All use subject to our Terms above.

On this page
  • Zentitle2Core Library Integration
  • Custom DllImportResolver
  • Using Zentitle2Core Methods
  • Device Fingerprint
  • Offline Activation
  • Secure Storage

Was this helpful?

Export as PDF
  1. Developers
  2. The Licensing Client (.NET)

Zentitle2Core Library

PreviousIActivation interfaceNextExceptions

Last updated 1 month ago

Was this helpful?

The .NET Licensing Client implements bindings to the library's methods, allowing .NET applications to leverage the functionality of the C++ Core library using the C# code.

Zentitle2Core Library Integration

  1. Download the zip package with the Zentitle2Core binaries from the Zentitle2Core's Release Notes page.

  2. Extract the content from the downloaded zip package. Depending on your needs and preferences, you can place the platform-specific binaries in the root directory of your project and ensure that they are always copied to the output/publish directory or provide a .

In the example below, the application is targeting Windows OS. Thus, only the Windows binary has been included in the project.

This solution works for all the operation systems, as .NET runtime always loads the binary depending on the OS that the application is currently running (.dll on Windows, .so on Linux and .dylib on MacOS).

Custom DllImportResolver

public static IntPtr Zentitle2CoreDllImportResolver(
     string libraryName, Assembly assembly, DllImportSearchPath? searchPath)
{
    if (libraryName != "Zentitle2Core")
    {
        // Fallback to the default import resolver.
        return IntPtr.Zero;
    }

    if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
    {
        if (RuntimeInformation.OSArchitecture == Architecture.X64 ||
            RuntimeInformation.OSArchitecture == Architecture.X86)
        {
            return NativeLibrary
                     .Load("libZentitle2_v1.2.1/MacOS_x86_64/libZentitle2Core.dylib");
        }

        return NativeLibrary
                 .Load("libZentitle2_v1.2.1/MacOS_arm64/libZentitle2Core.dylib");
    }

    if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
    {
        return NativeLibrary
                 .Load("libZentitle2_v1.2.1/Windows_x86_64/Zentitle2Core.dll");
    }

    if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ||
        RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD))
    {
        return NativeLibrary
                 .Load("libZentitle2_v1.2.1/Linux_x86_64/libZentitle2Core.so");
    }

        // Otherwise, fallback to the default import resolver.
        return IntPtr.Zero;
}

The following code must be executed before the first use of the Zentitle2Core library to instruct the .NET runtime to use the custom DllImportResolver when loading the binaries.

NativeLibrary.SetDllImportResolver(
    typeof(IActivation).Assembly, Zentitle2CoreDllImportResolver);

Using Zentitle2Core Methods

After the Zentitle2Core binaries have been integrated into the .Net application, the following activation options can be used to leverage the functionality implemented in the Core library.

Device Fingerprint

var activation = new Activation(options => 
    options.WithSeatId(Zentitle2Core.DeviceFingerprint.GenerateForCurrentMachine));

Offline Activation

var activation = new Activation(options => 
    options.WithOfflineActivationSupport(off =>
       off.UseTenantRsaKeyModulus(licensingOptions.TenantRsaKeyModulus));

Secure Storage

It is not trivial to persist the activation's details into a license file that is hard to tamper and should not work on a different device (or even in a different folder within the same machine). The Zentitle2Core library implements this functionality using low-level code, making the license file encrypted and unusable when copied/moved elsewhere.

Secure storage also helps place the file into the correct system directory, depending on the OS that the application is currently running on. It provides predefined directories USER_DATA and PUBLIC_DATA. Depending on the application's licensing model, you can decide which one to use. The code below will create the ../{USER_DATA Dir}/YourAppName/.license file for your app.

var activation = new Activation(options => 
    options.UseStorage(
        Zentitle2Core.SecureActivationStorage
           .WithAppDirectory(PredefinedSystemFolder.UserData, "YourAppName")));

The above approach has an issue when targeting MacOS with both the x86_64 and arm64 architectures. The Zentitle2Core binaries must be explicitly compiled for each architecture but have the same .dylib extension. For that reason, it's not possible to place them both in the project's root directory, and a must be used.

For the cases when you want to target operation systems with multiple architectures or you don't want to place the Zentite2Core binaries into the project's root directory, a custom can be implemented that loads the correct library depending on your project's structure. For the default Zentitle2Core release structure, the following Zentitle2CoreDllImportResolver implementation would work:

A is a unique identifier of the device on which the application is being executed. Therefore, it is a good candidate for use as the activation's seat ID.

The Zentitle2Core library implements the logic responsible for encrypting and decrypting the tokens exchanged in the process. Without the Zentitle2Core library, this functionality cannot be used.

Custom DllImportResolver
DllImportResolver
Device Fingerprint
Offline License Activation
Zentitle2Core C++
custom DllImportResolver