IBM Developer

Tutorial

Protect storage systems with Hyper Protect Crypto Service and Guardium Key Lifecycle Manager

Ensure your highly sensitive workloads are safe in the cloud

By Sandeep Batta

Data repositories in the cloud must ensure maximum protection due to increasing threats from malicious actors and organized criminal entities. Organizations will only bring highly sensitive workloads to the cloud if the cloud provider can ensure its security. IBM's Hyper Protect platform brings the reliability, availability and security (RAS) capabilities of the IBM Z architecture to IBM Cloud using IBM Secure Execution for Linux.

IBM Cloud Hyper Protect Crypto Services is a single-tenant, hybrid cloud key management service. Every instance of Hyper Protect Crypto Services provisioned in an IBM Cloud account provides access to life cycle management functions for encryption keys using various types of endpoints from public or private networks.

At the core of Hyper Protect Crypto Services is the industry's only hardware security module (HSM) that is FIPS 140-2 Level 4-certified. Customers can access the HSM directly using the Enterprise PKCS#11 (ep11) interface, or use the REST-API interface to perform key management functions.

Every instance of Hyper Protect Crypto Services must be initialized with a master key. Once initialized, the master key stays within the HSM at all times. Hyper Protect Crypto Services can then be used to create thousands of encryption keys that are derived from the HSM master key.

Data encryption

Envelope encryption is the practice of encrypting plain text data with data encryption keys (DEK), and then encrypting those keys with a key encryption key (KEK). This process can be used to encrypt blobs or buckets of data in object storage, block storage, and entire data volumes. For sensitive data repositories in the cloud, and workloads like high-performance computing, KEKs should be sourced from an HSM. For high-performance storage subsystems which have to adhere to performance boundaries, it is vitally important for key management systems to be "close" to the storage subsystems. Most interaction between storage subsystems and key management systems happens over the Key Management Interoperability Protocol (KMIP).

IBM Guardium Key Lifecycle Manager is an encryption key management tool that centralizes, simplifies, and automates the key management process. It offers robust and security-rich key storage, key serving, and key lifecycle management for self-encrypting applications and solutions. It uses interoperability protocols, including KMIP, IPP and REST, and interfaces such as PKCS#11 for communicating with an external HSM.

In Guardium Key Lifecycle Manager, a master key (AES 256-bit) is created whenever a new key or a server certificate is created. This master key encrypts the cryptographic objects in Guardium Key Lifecycle Manager, such as keys and certificates. The system-generated master key is stored in the default master key store; that is, Java Cryptography Extension Keystore (JCEKS). Depending on your requirement, you can move the master key from the Java keystore to the HSM.

This tutorial explains how to store this master key in Hyper Protect Crypto Services using PKCS#11, as shown in the following diagram:

Guardium Key Lifecycle Manager interaction

Prerequisites

Before you begin this tutorial, ensure that you have the following:

  • A fully initialized instance of Hyper Protect Crypto Services on IBM Cloud with root key/KEK assigned for Guardium Key Lifecycle Manager integration
  • An API Key to access PKCS#11 services at the Hyper Protect Crypto Services EP11 endpoint
  • An API Key associated with "SO_User" that has access to your Hyper Protect Crypto Services instance, referred to as "SO_Pin" in the instructions below. For more information, refer to HPCS User Types
  • A fully configured Guardium Key Lifecycle Manager server with IBM Java 8 or later and network access to the Hyper Protect Crypto Services EP11 endpoint
  • An understanding of the Hyper Protect Crypto Services PKCS#11 setup instructions
  • Access to pkcs11-tool to test Hyper Protect Crypto Services connectivity on the server where Guardium Key Lifecycle Manager is installed

Estimated time

This tutorial should take 45 minutes to complete.

Steps

Step 1. Log on to the server where Guardium Key Lifecycle Manager is installed

To configure the integration of IBM Java, Guardium Key Lifecycle Manager, and Hyper Protect Crypto Services HSM, complete the following steps:

  1. Log on to the server with root privileges and run the following command:
      mkdir -p /etc/ep11client
      cd /etc/ep11client
    
  2. Download the latest version of the HPCS-PKCS#11 Library to the directory /etc/ep11client for the architecture-platform and server where Guardium Key Lifecycle Manager server is installed. Grant the following permissions:
    ln -s /etc/ep11client/hpcs-grep11.so <downloaded-version-of-hpcs-grep11.so>
    chmod +rx /etc/ep11client/hpcs-grep11.so
    

Step 2. Set up the HPCS-PKCS11 configuration file

  1. Download the sample-publicEP-grep11client.yaml file to /etc/ep11client/grep11client.yaml.
  2. Update the following values in the configuration file:
    <HPCS_INSTANCE_ID>
    <HPCS_INSTANCE_ENDPOINT_URI>
    <HPCS_INSTANCE_ENDPOINT_PORT#>
    <UUID-#1>
    <UUID-#2>
    <HPCS_ACCESS_APIKEY>
    
  3. Grant permissions to the YAML file:
    chmod +rx /etc/ep11client/grep11client.yaml
    

Step 3. Confirm HPCS-HSM connectivity

  1. Create the log file for the ep11client:
    mkdir -p /var/log/opencryptoki
    
  2. Use the pkcs11-tool to confirm the HSM connectivity is configured correctly:
    cd /etc/ep11client
    pkcs11-tool --module=/etc/ep11client/hpcs-grep11.so  --generate-random 20 > random.txt
    

Step 4. Update the java.security file

  1. Update the java.security file to include IBMPKCS11Impl provider as follows:
    # List of providers and their preference orders (see above):
    #
    security.provider.1=com.ibm.jsse2.IBMJSSEProvider2
    security.provider.2=com.ibm.crypto.ibmjcehybrid.provider.IBMJCEHYBRID
    security.provider.3=com.ibm.crypto.hdwrCCA.provider.IBMJCECCA
    security.provider.4=com.ibm.crypto.plus.provider.IBMJCEPlus
    security.provider.5=com.ibm.crypto.provider.IBMJCE
    security.provider.6=com.ibm.crypto.pkcs11impl.provider.IBMPKCS11Impl /etc/ep11client/gklm-hpcs-hsm.cfg
    security.provider.7=org.bouncycastle.jce.provider.BouncyCastleProvider
    security.provider.8=com.ibm.security.jgss.IBMJGSSProvider
    security.provider.9=com.ibm.security.cert.IBMCertPath
    security.provider.10=com.ibm.security.sasl.IBMSASL
    security.provider.11=com.ibm.xml.crypto.IBMXMLCryptoProvider
    security.provider.12=com.ibm.xml.enc.IBMXMLEncProvider 
    security.provider.13=com.ibm.security.jgss.mech.spnego.IBMSPNEGO 
    security.provider.14=sun.security.provider.Sun 
    security.provider.15=com.ibm.securerandom.provider.IBMSecureRandom
    

Step 5. Configure the Guardium Key Lifecycle Manager DB-user

To configure the Guardium Key Lifecycle Manager DB-user to access HSM, complete the following steps:

  1. Copy the following configuration block to the /etc/ep11client/gklm-hpcs-hsm.cfg file:

     #HPCS HSM config for GKLM
    
     name = TKLM
     library=/etc/ep11client/hpcs-grep11.so
     description=HPCS HSM
    
     slotListIndex = 0
    
     attributes (*, CKO_PRIVATE_KEY, *) = {
       CKA_SENSITIVE = true
     }
     attributes (GENERATE, CKO_SECRET_KEY, *) = {
       CKA_SENSITIVE = true
       CKA_ENCRYPT = true
       CKA_DECRYPT = true
     }
     attributes (IMPORT, CKO_PUBLIC_KEY, *) = {
       CKA_VERIFY = true
     }
     #disabledmechanisms = {
     #   CKM_DSA_SHA1
     #}
    
  2. If db-user is klmdb411, change the ownership as follows:
     chmod +rx /etc/ep11client/gklm-hpcs-hsm.cfg
     chown -R klmdb411:klmdb411 /etc/ep11client/
     chown -R klmdb411:klmdb411 /var/log/opencryptoki/
    

Step 6. Switch the user

You now need to switch the user to DB-User.

  1. Switch to the DB-User user ID, and change directories to the home directory, <db-user-home>.
  2. Create a symlink to the HPCS-PKCS11 library:
    ln -s <db-user-home>/hpcs-grep11.so /etc/ep11client/hpcs-grep11.so
    chmod +rx <db-user-home>/hpcs-grep11.so
    
  3. Use the pkcs11-tool to confirm the configuration:
    pkcs11-tool --module=<DB-user-home>/hpcs-grep11.so --generate-random 20 > random.txt
    

Note: If this command runs successfully, a random value will be output to the file random.txt.

  1. Use the pkcs11-tool to initialize a token with a given label:
    pkcs11-tool --module=<DB-user-home>/hpcs-grep11.so --init-token --so-pin=<SO_PIN> --label "HPCS-GKLM-001"
    

Note: If this command runs successfully, you must see private/public entries on your HPCS "EP11 keystores" tab for "HPCS-GKLM-001".

Step 7. Configure the Guardium Key Lifecycle Manager server

  1. Log on to the Guardium Key Lifecycle Manager server as sklmadmin. Guardium Key Lifecycle Manager login screen
  2. Ensure the initial configuration of Guardium Key Lifecycle Manager shows the HSM / MasterKey repository as Not Configured, similar to the following image: Guardium Key Lifecycle Manager HSM not configured
  3. Review the documentation on how to call the Guardium Key Lifecycle Manager Master Key API. Update the settings as described at Configuring Guardium Key Lifecycle Manager Master with HSM.
  4. Get an auth-token for the sklmadmin user ID. Refer to the documentation for the Login REST Service.
  5. Access the Guardium Key Lifecycle Manager Master Swagger / Rest Client, which is available in the drop-down on the sklmadmin UI Dashboard. Guardium Key Lifecycle Manager master key API
  6. Create a server certificate and run MKM-rest with the following information
    { 
    "pkcs11.pin" : "HPCS_ACCESS_APIKEY",
    "pkcs11.config" : "/etc/ep11client/gklm-hpcs-hsm.cfg"
    "useMasterKeyInHSM" : "true | false"
    }
    
  7. Invoke GKLM masterkey API to move the Guardium Key Lifecycle Manager master key from the GKLM JCEKS keystore to HPCS-HSM keystore.

Step 8. Stop and start the Guardium Key Lifecycle Manager server

  1. Update the master key status on the Guardium Key Lifecycle Manager dashboard similar to the following image: Guardium Key Lifecycle Manager HSM
  2. Run gklm-test-hsm.java to test whether the HSM-related functions are working, as shown in the following sample output: Guardium Key Lifecycle Manager - Testing HSM

Summary

In this tutorial, you have learned how to store the master key in Hyper Protect Crypto Services.

Integration of Guardium Key Lifecycle Manager with Hyper Protect Crypto Services will enable Guardium Key Lifecycle Manager-only installations to take advantage of the FIPS 140-2 Level 4 hardware security module available in IBM Cloud. If you require it, this capability can also made available on-premises for your LinuxONE machine by using the HPCS-GREP11 container on a Hyper Protect Virtual Server, along with a containerized version on Guardium Key Lifecycle Manager.

On platforms where the HPCS-PKCS11 library is not supported, you can enable workloads such as Oracle to make an indirect connection to Hyper Protect Crypto Services using Guardium Key Lifecycle Manager as an intermediary, since Guardium Key Lifecycle Manager is able to support front-end Transparent Data Encryption (TDE) clients.

For more information on this topic, refer to Setting up Guardium Key Lifecycle Manager for Oracle TDE

Transparent Data Encryption

Next steps

Now that you are familiar with how to integrate IBM Hyper Protect Crypto Services with IBM Security Guardium Key Lifecycle Manager, you can try pairing a storage subsystem like Lenovo XClarity with Guardium Key Lifecycle Manager.

For more details or to request a demo, contact the Hyper Protect zCAT Team.