Generate a TDE master encryption key on the KMES Series 3
To configure Oracle Database 19c TDE with an HSM, refer to the following Oracle knowledge base article for Oracle Database 19c: https://docs.oracle.com/en/database/oracle/oracledatabase/19/asoag/configuring-transparent-data-encryption.html
This section provides a very basic example of configuring Oracle TDE with an HSM by using PKCS #11. However, there are many nuances in an Oracle Database environment, so the following steps do not apply directly to all situations and implementations. Use this section only as a general guide and thoroughly consult the preceding Oracle documentation link before implementing Oracle TDE with an HSM in your environment.
To use HSM-based encryption, you must generate a master encryption key (MEK), which you store on the . TDE uses the MEK to encrypt and decrypt the Oracle table keys.
This section covers two Oracle Database implementations: A standard implementation with Oracle Database running on a server or desktop and one with Oracle Database running in a Docker container.
Choose one of the following operating systems for the standard implementation:
This implementation uses the oraenv tool to set up the Oracle database environment for the current session and enable the sqlplus command. To set the Oracle environment, perform the steps in this section. When prompted, specify the system ID (SID) for the instance, orcl in this example, or use the default value indicated between the brackets in line 4 of step 1 in the following process. All instances on the system require a unique SID.
Set the Oracle environment with the following commands:
If it succeeds, the command returns the following message:
The Oracle base has been set to /home/oracle/app/oracle
Run the following command to connect to the database:
Run the following command to start the Oracle instance:
Run the following command to set the static WALLET_ROOT parameter, which sets the location of the keystore you plan to use:
You must set up the WALLET_ROOT parameter even if you do not use a keystore.
Stop and restart the database after setting the WALLET_ROOT parameter:
Set the dynamic TDE_CONFIGURATION parameter that sets the type of keystore you plan to use:
Stop and restart the database after setting the TDE_CONFIGURATION parameter:
Run the following command to open the hardware keystore with the password of the user created on the :
Run the following command to create the TDE master encryption key with the user password created on the :
If you are migrating a previously configured TDE Master Encryption Key, refer to this article.
If successful, the following message appears:
System altered.
If the database contains columns encrypted with a public key, the Oracle table key decrypts and re-encrypts the columns. The AES symmetric key generated by HSM-based TDE encrypts and decrypts the Oracle table key.
Keys generated on the begin with something similar to ORACLE.TDE.HSM.MK. You can view them in the Key Group under Key Management > Keys
If the database contains columns encrypted with a public key, the Oracle table key decrypts and re-encrypts the columns. The AES symmetric key generated by HSM-based TDE encrypts and decrypts the Oracle table key.
Use the following steps to configure the PKCS #11 (FXPKCS11) library to work with an Oracle Database Docker container. For instructions on how to build and run Oracle Database in a Docker container, refer to the Oracle documentation.
On the host computer that runs the Oracle Database container, open a terminal and go to the location where you saved the Oracle Database private key, tls_skey.pem.
Run the following command to make the Oracle Database private key readable and executable for all users:
Set the OpenSSL version to match your container in the OPENSSL_VERSION environment variable.
If your Oracle Database 19c uses the official Oracle Database container images repository on GitHub (https://github.com/oracle/docker-images/blob/main/OracleDatabase), run the following command because that container image is based on Oracle Linux 7, which is OpenSSL 1.0-based:
If your Oracle Database runs in a container based on OpenSSL 1.1, run the following command:
Download one of the following PKCS #11 (FXPKCS11) library installations from the Portal:
If your container is based on OpenSSL 1.0, download the fxpkcs11-redhat-4.xx-xxxx.tar file.
If your container is based on OpenSSL 1.1, download the fxpkcs11-redhat8-4.xx-xxxx.tar file.
Run the following command to extract the FXPKCS11 library and save the version in the PKCS_VERSION environment variable:
Edit the fxpkcs11.cfg file to allow the FXPKCS11 library to connect to the . Set the following fields in the <KMS> section:
Field
Description
<SLOT>
Can leave it set to the default value of 0.
<CRYPTO-OPR>
Specify the name of the identity created on the .
<KEYGROUP-NAME>
Specify the name of the key group that you created on the .
<ADDRESS>
Specify the IP address of the to which the PKCS #11 library should connect.
<PROD-PORT>
Set the PKCS #11 library to connect to the default Host API port on the , port 2001.
<PROD-TLS-ENABLED>
Set the field to YES. The only way to connect to the Host API port on the is over TLS.
<PROD-TLS-ANONYMOUS>
Set this value to NO because you're connecting to the Host API port by using mutual authentication. This field defines whether the PKCS #11 library authenticates to the .
<PROD-TLS-CA>
Specify the path to where you save the tls_ca.pem file.
<PROD-TLS-CERT>
Specify the path to where you saved the tls_cert.pem file.
<PROD-TLS-KEY>
Specify the path to where you saved the tls_skey.pem file.
<PROD-TLS-KEY-PASS>
Field should remain commented out because a password was not set for the client private key.
<FX-LOAD-BALANCE>
Set it to the default value of NO.
Run the following command to start the Oracle Database container and bind-mount all of the FXPKCS11 files needed for FXPKCS11 to connect to the .
The command takes up to 20 minutes to complete, and you must run it from the same directory where you extracted the fxpkcs11 directory.
If the TLS certificates for authentication with the are not stored in the /home/oracle/pki directory on your system, modify the third -v flag in your command to reflect this.
After the Oracle Database container is running, run the following command to connect to the container file system:
Modify the /opt/oracle/product/19c/dbhome_1/network/admin/sqlnet.ora file as shown in the following example, and save it:
Run the following command to connect to the database:
Run the following command to create the master encryption key for TDE:
If it succeeds, the following message appears:
System altered.