Java Prerequisites and Considerations

In this topic:

>Prerequisites

>Considerations

>Protecting Java Applications That Use Reflection

>Protecting Applications Based on Oracle JDK 11 and Oracle JDK 14

Prerequisites

>You must install the Java JRE or JDK before using Sentinel LDK Envelope for Java engine.

>Before your JAR/WAR archive is protected, include the customized Licensing API dynamic libraries as follows:

Under Windows, include hasp_windows_****_<vendorId>.dll in one of the following locations:

In the application directory that contains the .exe file (not the .java file)

In the Windows System directory (for example: c:\Windows\System32\ or c:\Windows\SysWOW64))

In the Windows directory (for example: c:\Windows\)

For Windows, include also the External License Manager (hasp_rt.exe) in the application directory.

Under Linux, include libhasp_linux_***_<vendorId>.so in one of the following locations:

In one of the directories specified in the LD_LIBRARY_PATH variable

In /var/hasplm, /usr/local/lib, or /usr/lib

Under Linux ARM, include lhasp_linux_arm64_<vendorId>.so and hasp_linux_armhf_<vendorId>.so in one of the following locations:

In one of the directories specified in the LD_LIBRARY_PATH variable

In /var/hasplm, /usr/local/lib, or /usr/lib

Under Mac, include hasp_darwin_<vendorId>.dylib in one of the following locations:

In /var/hasplm, /usr/local/lib, or /usr/lib

During protection of the Java applications, Envelope copies these libraries automatically to the output directory.

NOTE   Envelope does not copy vendor-specific Mac files automatically to the output directory. You need to copy hasp_darwin_<vendorId>.dylib with the protected archive manually.

>After your JAR/WAR archive is protected, it requires a HASP library to function at run-time. Copy the following files to one of the locations described above:

For Win32 applications: HASPJava.dll

For Windows x64 applications: HASPJava_x64.dll

For Mac applications: libHASPJava.dylib and libHASPJava.jnilib

For 32-bit Linux applications: libHASPJava.so

For 64-bit Linux applications: libHASPJava_x86_64.so

>If you are using both Sentinel LDK Envelope and Sentinel Licensing API to protect a Java application, ensure that both of these tools are from the same version of Sentinel LDK. If they are not from the same version, error code 22 may be thrown by the protected application.

Considerations

Sentinel LDK Envelope cannot be used to protect Java applications for Linux ARM platforms.

For method-level protection, Sentinel LDK Envelope does not support protection of the types of methods listed below. Be sure to un-select these methods before you protect your Java application.

>Methods that use the Hibernate service.

> Methods that, in turn, use Synthetic methods that are created as bootstrap methods or as arguments of bootstrap attributes.

>Dynamic methods.

>Reflection methods.

>Deserialize or typecasting methods.

Protecting Java Applications That Use Reflection

Sentinel LDK Envelope makes use of reflection. Therefore, there is a limitation on protecting Java applications that use reflection APIs, such as applications using the Spring Framework. However, the following solution has been tested for use with applications that use reflection:

Use the dfcrypt utility with the Version 2 data protection mode to protect Java class files. The encrypted class files can be decrypted at runtime by a DLL or shared object (Linux) that has been protected with Envelope with Data File Protection Version 2 enabled.

Click here to see how to protect and distribute applications that use reflection.

Protecting Applications Based on Oracle JDK 11 and Oracle JDK 14

Sentinel LDK Envelope under Windows supports the protection of Oracle JDK 11 and Open JDK 14 applications for Windows, Linux, and Mac. This includes applications that use the Java Platform Module System (JPMS).

As part of the protection process, Envelope generates files that contain the command required to execute module-based applications on the various platforms. You must modify these files to execute the protected application.

For more information, see Modifying Execution Files for Applications That Use JPMS.

Related Topics

Creating a New Project

Protecting a Project

Java Default Protection Settings Screen

Defining Java Program Protection Details