For OpenJDK11 with RSA Key

1. Generate an RSA keypair on Utimaco HSM.

›_ Console

# keytool -genkey -keyalg RSA -keysize 2048 -keystore NONE -storetype PKCS11 storepass 12345678  -providername SunPKCS11-CryptoServer -alias tomcatrsa 

Provide information when prompted Here:

  • RSA is the key algorithm

  • 2048 is the key size

  • NONE is the keystore for HSM

  • PKCS11 is the storetype

  • 12345678 is the slot PIN

  • SunPKCS11-CryptoServer is the provider name

  • tomcatrsa is the key name that will be generated on Utimaco HSM

tmp1pyny4dg.jpg

Key Generation using Keytool command

2. Verify that the keys have been generated.

›_ Console

# keytool -list -keystore NONE -storetype PKCS11 -providername SunPKCS11-
CryptoServer -storepass 12345678 -v 

Here:

  • NONE is the keystore for HSM

  • PKCS11 is the storetype

  • 12345678 is the slot PIN

  • SunPKCS11-CryptoServer is the provider’s name

tmp5w2l9s3b.jpg

Listkeys output

  1. List the keys using p11tool2.

›_ Console

# /opt/utimaco/bin/p11tool2 Slot=0 LoginUser=12345678 ListObjects 
tmppu2bya_8.jpg

List Keys output using p11tool2

  1. Generate a CSR using Keytool command.

›_ Console

# keytool -certreq -keystore NONE -storetype PKCS11 -storepass 12345678 providername SunPKCS11-CryptoServer -alias tomcatrsa  -file tomcatrsa.csr 

Here:

  • NONE is the keystore for HSM

  • PKCS11 is the storetype

  • 12345678 is the slot PIN

  • SunPKCS11-CryptoServer is the provider name

  • tomcatrsa is the key name

  • tomcatrsa.csr is the CSR file name that will be generated


  1. Get this CSR signed by CA.

  2. Copy the signed certificate along with root CA certificate chain on the tomcat server.

  3. Import the signed certificate chain reply using the command belo.

›_ Console

# keytool -importcert -trustcacerts -alias tomcatrsa -file /root/tomcatrsa.p7b 
-storetype PKCS11 -keystore NONE -providername SunPKCS11-CryptoServer storepass 12345678


tmpsabodklf.jpg
tmpcmooo7cz.jpg

Import user certificate into keystore

Signed certificate must also contain certificate chain.

8. Verify that the keytool command shows the signed certificate as well as root CA certificate.

›_ Console

# keytool -list -keystore NONE -storetype PKCS11 -providername SunPKCS11-

CryptoServer -storepass 12345678 -v 

Here:

  • NONE is the keystore for HSM

  • PKCS11 is the storetype

  • 12345678 is the slot PIN

  • SunPKCS11-CryptoServer is the provider’s name

tmpl1qraiif.jpg
tmp5zd1d8h7.jpg

Keytool list output