keytool -genkeypair generate the key pair on the appliance (through C_GenerateKeyPair) and, on dc27+, produces a usable PrivateKeyEntry with no CryptoHub UI step.
Choose one of the following operating systems and perform the instructions:
Linux
Perform the following steps to configure SunPKCS11 in Linux:1
Locate the Futurex PKCS #11 library:Confirm the location of the
libfxpkcs11.so file available on your system. Note its full path for later use. For example, it might be located at /usr/local/lib/fxpkcs11/libfxpkcs11.so.2
Create a SunPKCS11 configuration file:The SunPKCS11 provider uses a configuration file to load the Futurex PKCS #11 module. Perform the following steps:
- Create a file named
pkcs11.cfg(or any name you prefer, with a.cfgextension). You can save this file anywhere, but a standard location would be something like/usr/local/etc/pkcs11.cfg. - Add the following content to the file, adjusting the library path to indicate the installation location for the Futurex PKCS #11 library on your system:
pkcs11.cfg
name: Specify a friendly name for the Futurex PKCS #11 provider. The Java provider name becomes SunPKCS11-<name> (for example, SunPKCS11-Futurex).library: Specify the full, absolute path to the Futurex PKCS #11 module. A relative path prevents the provider from loading.slotListIndex: Specify the default Futurex PKCS #11 slot number.The two attributes(generate, ...) blocks force both the private key and the public key to be token objects on the CryptoHub. Both blocks are required on dc27+ so that keytool -list surfaces a PrivateKeyEntry.3
Set the FXPKCS11_CFG environment variable:Before running a standalone keytool command, export FXPKCS11_CFG so the Futurex PKCS #11 library can locate its own configuration file (
fxpkcs11.cfg). Point it at the fxpkcs11.cfg you configured in Install and configure Futurex PKCS #11.Shell
FXPKCS11_CFG points to the Futurex library configuration (fxpkcs11.cfg), which is separate from the SunPKCS11 provider configuration (pkcs11.cfg) you created in the previous step. Passing pkcs11.cfg on the command line (with -providerArg) is not enough on its own; without FXPKCS11_CFG, the token does not appear.4
Register the provider statically in Add the following line, pointing to the Replace
java.security:Apache Tomcat loads the SunPKCS11 provider itself (through server.xml) rather than accepting the provider flags on a command line, so static registration is required for the Tomcat integration. Open the java.security file:Shell
pkcs11.cfg file you just created and using the next available provider number (do not reuse an existing number). Then save the file.java.security
N with the next unused index in the security.provider.* list already in the file.5
Verify the configuration:Run the following Java keytool command in a terminal to verify that you configured the SunPKCS11 provider correctly to interact with the Futurex PKCS #11 library. The
-providerArg flag passes the pkcs11.cfg file you just created:Shell
If successful, you see a line similar to
Your keystore contains [number] entries. Once you generate a key pair in the next section, this command also lists a PrivateKeyEntry for it.Windows
Perform the following steps to configure SunPKCS11 in Windows:1
Locate the JDK installation directory:Find the path to your JDK installation. This is typically something similar to
C:\Program Files\Java\jdk-<version>.2
Create a configuration file for SunPKCS11:The SunPKCS11 provider uses a configuration file to load the Futurex PKCS #11 module. Create a file named
pkcs11.cfg (or any other name you prefer, with a .cfg extension).Add the following content to the file, adjusting the library path to point to where you installed the Futurex PKCS #11 library on your system:pkcs11.cfg
Specify the full, absolute path to
fxpkcs11.dll on the library line. The two attributes(generate, ...) blocks are both required on dc27+ so that keytool -list surfaces a PrivateKeyEntry.3
Set the FXPKCS11_CFG environment variable:Before running a standalone keytool command, set FXPKCS11_CFG so the Futurex PKCS #11 library can locate its own configuration file (
fxpkcs11.cfg). The Futurex PKCS #11 module looks for fxpkcs11.cfg in C:\Program Files\Futurex\fxpkcs11 by default; if you store it elsewhere, set the machine-wide variable in an elevated Command Prompt as described in Install and configure Futurex PKCS #11:Command Prompt
4
Register the provider statically in Replace
java.security:Apache Tomcat loads the SunPKCS11 provider itself (through server.xml) rather than accepting the provider flags on a command line, so static registration is required for the Tomcat integration. Open %JAVA_HOME%\conf\security\java.security in a text editor.Add the following line, pointing to the pkcs11.cfg file you just created and using the next available provider number (do not reuse an existing number). Use double backslashes for the path. Then save the file.java.security
N with the next unused index in the security.provider.* list already in the file.5
Verify the configuration:Open a command prompt and run the following java keytool command to verify that you configured the SunPKCS11 provider correctly to interact with the Futurex PKCS #11 library. The
-providerArg flag passes the pkcs11.cfg file you just created:Command Prompt
If successful, you see a line similar to
Your keystore contains [number] entries. Once you generate a key pair in the next section, this command also lists a PrivateKeyEntry for it.
