With RSA Key (CA Signed Certificate)

  1. Generate a keypair on Utimaco HSM with the help of keytool command.

›_ Console

# keytool -genkey -alias ibmrsa -keyalg RSA -keysize 2048 -keystore NONE -storetype PKCS11IMPLKS -providername IBMPKCS11Impl-CryptoServer 

Provide information when prompted Here:

  • RSA is the key algorithm

  • 2048 is the key size

  • NONE is the keystore for HSM

  • PKCS11IMPLKS is the storetype

  • IBMPKCS11Impl-CryptoServer is the provider name

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

Provide the keystore password when prompted:

tmppeclould.jpg

Key generation using keytool command

  1. Verify the entry with same alias name is generated using keytool command.

›_ Console

# keytool -list -keystore NONE -storetype PKCS11IMPLKS -providername IBMPKCS11Impl-CryptoServer  

Here:

  • NONE is the keystore for HSM

  • PKCS11IMPLKS is the storetype

  • IBMPKCS11Impl-CryptoServer is the provider’s name

Provide the keystore password when prompted:

tmpoaes7qvl.jpg

Listkeys output


  1. List the objects using p11tool2.

›_ Console

# p11tool2 Slot=0 LoginUser=ask ListObjects 

Enter user PIN when prompted:

tmp820ecd23.jpg
tmp9ll01km_.jpg

List keys output using p11tool2

  1. Generate a CSR using Keytool command.

›_ Console

# keytool -certreq -alias ibmrsa -keystore NONE -storetype PKCS11IMPLKS providername IBMPKCS11Impl-CryptoServer -file ibm.csr 

Here:

  • NONE is the keystore for HSM

  • PKCS11IMPLKS is the storetype

  • IBMPKCS11Impl-CryptoServer is the provider name

  • ibmrsa is the key name

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

Provide keystore password when prompted

  1. Get this CSR signed by CA.

  2. Copy the signed certificate and root CA certificate on the IBMPKCS11 server.

  3. Import Root CA certificate into HSM keystore.

›_ Console

#  keytool -importcert -alias rootca -file /home/LAbCA-Root.crt storetype PKCS11IMPLKS -keystore NONE -providername IBMPKCS11ImplCryptoServer
tmp49kzwqdb.jpg
tmp0oieb9qc.jpg

Importing root certificate into keystore

  1. Import the signed certificate reply using the command below.

›_ Console

#  keytool -importcert -alias ibmrsa -file /home/test_demo.p7b -storetype PKCS11IMPLKS -keystore NONE -providername IBMPKCS11Impl-CryptoServer
tmpoozac_uh.jpg

Import user certificate into keystore

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

›_ Console

# keytool -list -keystore NONE -storetype PKCS11IMPLKS -providername IBMPKCS11Impl-CryptoServer  

Here:

  • NONE is the keystore for HSM

  • PKCS11IMPLKS is the storetype

  • IBMPKCS11Impl-CryptoServer is the provider’s name

Provide the keystore password when prompted:

tmp7vuirw8v.jpg

Listkeys output showing signed certificate as well as root CA

  1. Sign any sample jar file with jarsigner command.

›_ Console

# jarsigner -tsa http://timestamp.digicert.com -keystore NONE -storetype PKCS11IMPLKS -providername IBMPKCS11Impl-CryptoServer -signedjar hello_worldoutput.jar HelloWorld-0.7.0.jar ibmrsa  

Here

  • http://timestamp.digicert.com is URL of timestamp server

  • NONE is the keystore for HSM

  • PKCS11IMPLKS is the storetype

  • IBMPKCS11Impl-CryptoServer is the provider’s name

  • hello_worldoutput.jar is the new output signed jar file that will be generated

  • HelloWorld-0.7.0.jar is the jar file to be signed

  • ibmrsa is the RSA key used for jar signing

Provide the keystore password when prompted:

tmplmw5uwln.jpg

Signing the jar using jarsigner command

  1. Verify the signed jar.

›_ Console

# jarsigner -verify hello_worldoutput.jar -keystore NONE -storetype PKCS11IMPLKS -storepass 12345678 -providername IBMPKCS11Impl-CryptoServer

Here hello_worldoutput.jar is the newly generated signed jar file:

tmplx_u6xmb.jpg

Verifying signed jar