This sample demonstrates the use of Sentinel LDK Licensing (Run-time) API when working in the Java language.
Refer to the Sentinel LDK Release Notes - "Supported Platforms for Code Samples" and "Tested Compilers for Code Samples" sections.
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 |
This section describes how to customize and how to compile 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.
To use the Sentinel LDK Java API:
Place the Run-time API libraries in one of the following locations on the machine where the protected application is installed.
Under Windows:
In the process directory (where the application executable resides)
In the DLL directory (where the Java DLL resides, if any)
In the Windows System directory (for example: c:\Windows\System32\ or c:\Windows\SysWOW64)
In the Windows directory (for example: c:\Windows\)
Under Linux
In the process directory (where the application executable resides)
In one of the directories specified in the LD_LIBRARY_PATH variable
In /var/hasplm, /usr/local/lib, or /usr/lib
Under macOS
In the process directory (where the application executable resides)
In one of the directories specified in the LD_LIBRARY_PATH variable
In one of the directories specified in the DYLD_LIBRARY_PATH variable
In /var/hasplm, /usr/local/lib, or /usr/lib
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.
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.
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.
The sample consists of several functions. The default flow is as follows:
Copyright © 2022 Thales Group. All rights reserved. Support