Sentinel® LDK Licensing API - Java Sample: Readme


This sample demonstrates the use of Sentinel LDK Licensing (Run-time) API when working in the Java language.

Supported Operating Systems and Tested Compilers

Refer to the Sentinel LDK Release Notes - "Supported Platforms for Code Samples" and "Tested Compilers for Code Samples" sections.

Components

This version contains the following components:


Common to All Operating Systems
hasp_demo.java Java hasp_demo program
hasp_update.java Java hasp_update program
Aladdin Directory containing the Sentinel LDK Java sources
hasp-srm-api.jar JAR file with the compiled Sentinel LDK Java package
hasp-srm-demo.jar JAR file with the compiled Java samples
Windows
build_samples.bat Batch file for building the Java sample
HASPJava.dll JNI library for Win32
HASPJava_x64.dll JNI library for Windows x64
hasp_windows_demo.dll Run-time API DLL for Win32
hasp_windows_x64_demo.dll Run-time API DLL for Windows x64
Mac
build_samples.sh Batch file for building the Java samples
libHASPJava.dylib Universal library containing JNI libraries for various platforms
libHASPJava.jnilib Universal library containing JNI libraries for various platforms
hasp_darwin_demo.dylib Universal binary containing Run-time API dylibs for various platforms
Linux (Intel and ARM)
build_samples.sh Batch file for building the Java samples
libHASPJava_x86_64.so JNI library for Linux x64
libhasp_linux_x86_64_demo.so Run-time API DLL for Linux x64
libHASPJava_armhf.so JNI library for Linux armhf
libHASPJava_arm64.so JNI library for Linux arm64
libhasp_linux_armhf_demo.so Run-time API DLL for Linux armhf
libhasp_linux_arm64_demo.so Run-time API DLL for Linux arm64

Usage Notes

This section describes how to customize and how to compile the sample.

Customizing the Sample

The Sentinel LDK Java API package contains the Sentinel LDK Java samples, together with the Sentinel LDK Java package and the JNI libraries.

Using the Java API

To use the Sentinel LDK Java API:

  1. Copy the JNI libraries and the generated API library to the directory in which the operating system's dynamic libraries reside.
  2. Place the Run-time API libraries in one of the following locations on the machine where the protected application is installed.

    Note: With a language interpreter (such as java.exe), the application is the interpreter itself. In this case, the process directory is the directory where java.exe resides, and not where the Java JAR file resides.

Compiling the Samples

Before compiling the samples with build_samples, set the JDK environment variable to the path where Java is installed.

For example, for Windows, "set JDK=p:\java\j2sdk1.8".

To compile the samples, run the build_samples script.

Running the Samples

To run the samples, enter one of the following:

java hasp_demo

java hasp_update

To run the precompiled samples from the hasp-srm-demo.jar archive under Windows, enter one of the following:

java -cp .;hasp-srm-api.jar;hasp-srm-demo.jar hasp_demo

java -cp .;hasp-srm-api.jar;hasp-srm-demo.jar hasp_update

To run the precompiled samples from the hasp-srm-demo.jar archive under Mac or Linux, enter one of the following:

java -cp .:hasp-srm-api.jar:hasp-srm-demo.jar hasp_demo

java -cp .:hasp-srm-api.jar:hasp-srm-demo.jar hasp_update

After you have generated your vendor-specific libraries (using the Master Wizard), copy the C run-time libraries to the folder in which your source code is stored.

Description of the Sample Flow

The sample consists of several functions. The default flow is as follows:

  1. Log into the key.

  2. Extract information from the key. The sample reads and writes some information to and from the key.

  3. Encrypt and decrypt some test data.

Copyright © 2022 Thales Group. All rights reserved. Support   

DocID 104 Revision 2104-1