This topic describes how to install the Java Cryptographic Extension (JCE) provider.
Prerequisites
Your hardware security module (HSM) is in the Initializing state, and a crypto user (CU) is created. For more information, see Getting started with Cloud Hardware Security Module.
An HSM client (hsm_proxy) is started. For more information, see Getting started with Cloud Hardware Security Module.
The Java Development Kit (JDK) version is 1.8.
Procedure
Download and install the JCE provider.
Operating system
Description
CentOS 8
Run the following command to install the JCE provider:
sudo rpm -ivh ./hsm-client-jce-v2.03.15.10-2.el8.x86_64.rpm
Check whether the JCE provider is installed.
If all the following files can be found, the JCE provider is installed:
/opt/hsm/java/caviumjca-1.0.0-jar-with-dependencies.jar
/opt/hsm/java/hamcrest-core-1.3.jar
/opt/hsm/java/junit-4.12.jar
/opt/hsm/java/hsm-test-1.0.0.jar
/opt/hsm/java/log4j-api-2.17.0.jar
/opt/hsm/java/log4j-core-2.17.0.jar
/opt/hsm/lib/libcaviumjca.so
Verify the installation
Configure environment variables in applications as a crypto user (CU).
NoteReplace
user name
andpassword
with the username and password of the CU.export LD_LIBRARY_PATH=/opt/hsm/lib export HSM_PARTITION=PARTITION_1 export HSM_USER=user name export HSM_PASSWORD=password
Verify the basic features of the JCE provider.
java -classpath "/opt/hsm/java/*" org.junit.runner.JUnitCore TestBasicFunctionality
Expected output:
JUnit version 4.12 .2021-03-12 13:56:40,527 DEBUG [main] TestBasicFunctionality (TestBasicFunctionality.java:33) - Adding provider. 2021-03-12 13:56:40,721 DEBUG [main] TestBasicFunctionality (TestBasicFunctionality.java:42) - Logging in. 2021-03-12 13:56:40,721 INFO [main] cfm2.LoginManager (LoginManager.java:244) - Looking for credentials in HsmCredentials.properties 2021-03-12 13:56:40,722 INFO [main] cfm2.LoginManager (LoginManager.java:262) - Looking for credentials in System.properties 2021-03-12 13:56:40,722 INFO [main] cfm2.LoginManager (LoginManager.java:270) - Looking for credentials in System.env 2021-03-12 13:56:40,750 DEBUG [main] TestBasicFunctionality (TestBasicFunctionality.java:54) - Generating AES Key with key size 256. 2021-03-12 13:56:40,765 DEBUG [main] TestBasicFunctionality (TestBasicFunctionality.java:63) - Encrypting with AES Key. 2021-03-12 13:56:40,813 DEBUG [main] TestBasicFunctionality (TestBasicFunctionality.java:84) - Deleting AES Key. 2021-03-12 13:56:40,816 DEBUG [main] TestBasicFunctionality (TestBasicFunctionality.java:92) - Logging out. Time: 0.328 OK (1 test)