Migrating encrypted data
When migrating IBM Websphere Commerce Version 8 to HCL Commerce Version 9.0 you must migrate your encrypted data. Previous versions of WebSphere Commerce allowed for your site to use 3DES (16bit merchantKey) or AES (32bit merchantKey) encryption. In HCL Commerce Version 9.0, only AES encryption is used.
Before you begin
-
- Log in to the environment that is hosting the Utility server Docker container.
If a Utility server Docker container is not deployed, see Preparing a Docker host server to launch Utility server Docker container.
- Enter the Utility server Docker container.For example,
docker exec -it utility_container_name bash
You are now within the Utility server Docker container. The following steps must be performed in this environment.
- Log in to the environment that is hosting the Utility server Docker container.
Procedure
-
Create the required files to migrate your encrypted data.
-
Configure the data encryption migration.
Create CustomKeys.xml. This file is used to give the MigrateEncryptedInfo utility the instructions on what to migrate data from and to.
Place this file at the following location: /opt/WebSphere/AppServer/profiles/default/installedApps/localhost/ts.ear/xml/config/CustomKeys.xml.
A sample configuration file is as follows:<?xml version="1.0" encoding="UTF-8"?> <keys xmlns="http://www.ibm.com/xmlns/prod/WebSphereCommerce" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ibm.com/xmlns/prod/WebSphereCommerce xsd/WCKeys.xsd"> <key name="MerchantKey" providerName="WC" status="current" className="com.ibm.commerce.security.keys.WCExternalFileMerchantKeyImpl" algorithm="3DES"> <config name="keyFile" value="oldMerchantKey.xml"/> </key> <key name="MerchantKey" providerName="WC" status="new" className="com.ibm.commerce.security.keys.WCExternalFileMerchantKeyImpl" algorithm="AES"> <config name="keyFile" value="merchantKey.xml"/> <config name="keyEncryptionKeyFile" value="KeyEncryptionKey.xml"/> <config name="newKeyFile1" value="newMerchantKey1.xml"/> <config name="newKeyFile2" value="newMerchantKey2.xml"/> </key> <key name="SessionKey" providerName="WC" status="current" className="com.ibm.commerce.security.keys.WCSessionKeyImpl"> </key> </keys>
In the customKeys.xml there are three<key>
elements:- The first key designates the MerchantKey that your data is currently encrypted
with. This is your current key, and is specified in this configuration file with the
status value of current.
This is used by the utility to determine how the data is currently encrypted, and what to use to decrypt the data for the transition to a new key and/or encryption algorithm.
This key will become obsolete once the utility is run successfully and can be deleted.
- The second key designates the MerchantKey that you want to use with your site
going forward. This is known as your new key, and is denoted in this configuration
file with the status value new.
This is the key that you are transitioning to using. It is used by the utility to re-encrypt the data that is decrypted by the original (presently current) key.
Once the utility is run, this key is now the current key. It will take the place of the original current key (the first key value that is specified in the configuration file, with a status of current) for any future encryption algorithm or key migration.
- The third key denotes your sessionKey and is not important to the MigrateEncryptedInfo utility.
To specify the configuration of the utility, update this file accordingly:
- The first key designates the MerchantKey that your data is currently encrypted
with. This is your current key, and is specified in this configuration file with the
status value of current.
-
Complete the data encryption migration.
Migrate your data encryption using the migrateEncryptedInfo utility.Note: If you have already run the migrateEncryptedInfo utility, you must clear the existing merchantKey value before re-running the migrateEncryptedInfo utility.An example of running this utility successfully is as follows:
[root@utils /]# /opt/WebSphere/CommerceServer90/bin/MigrateEncryptedInfo.sh db2 demo 1 1 -k /opt/WebSphere/AppServer/profiles/default/installedApps/localhost/ts.ear/xml/config/CustomKeys.xml Migration completed. Please check /opt/WebSphere/CommerceServer90/logs/MigrateEncryptedInfoError.log for any errors. Some errors can be ignored; see documentation for details.
The migrateEncryptedInfo utility generates a newly encrypted merchant key file, merchantKey.xml.
-
Ensure that the data encryption migration completed successfully.
Check the MigrateEncryptedInfoError.log and CCInfoMigration.log log files to determine if there were any errors encountered by the utility.
-
Update your HCL Commerce Version 9.0 installation to use AES
encryption.
- Update wc-server.xml. Set
AES_DB="true"
. - Update product.xml. Set
<AES_DB>true<AES_DB/>
. - Make the merchant key accessible to your environment.
- If you plan to use a custom Key Locator Framework (KLF) file. For example,
CustomKeys.xml.
- Update your site configuration.
- Open the wc-server.xml configuration file for editing.
- Add the following within the
<Instance>
section:KeysConfigFile = "config/CustomKeys.xml"
- Save and close the file.
- Define CustomKeys.xml as
follows:
<?xml version="1.0" encoding="UTF-8"?> <keys xmlns="http://www.ibm.com/xmlns/prod/WebSphereCommerce" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ibm.com/xmlns/prod/WebSphereCommerce xsd/WCKeys.xsd"> <key name="MerchantKey" providerName="WC" status="current" className="com.ibm.commerce.security.keys.WCExternalFileMerchantKeyImpl" algorithm="AES"> <config name="keyFile" value="merchantKey.xml"/> <config name="keyEncryptionKeyFile" value="KeyEncryptionKey.xml"/> </key> <key name="SessionKey" providerName="WC" status="current" className="com.ibm.commerce.security.keys.WCSessionKeyImpl"> </key> </keys>
Note: Only use keyEncryptionKeyFile if you re-encrypted your merchantKey using this file.
- Update your site configuration.
- If you do not plan to use a custom KLF file, for example,
CustomKeys.xml, and you plan to store the merchant key in
Vault:
- Obtain the new encrypted merchant key from the generated merchantKey.xml file and then store it in Vault. See, Key Locator Framework (KLF).
- If you encrypted the merchant key with a key encryption key, obtain the new key encryption key from the KeyEncryptionKey.xml file, and store it in Vault.
- If you do not plan to use a custom KLF file, for example,
CustomKeys.xml, and you do not plan to use Vault to store
the merchant key:
As per WCKeys.xml, then the encrypted merchantKey value must be stored in merchantKey.xml, and the key encryption key must be stored in KeyEncryptionKey.xml.
- If you plan to use a custom Key Locator Framework (KLF) file. For example,
CustomKeys.xml.
- If you are planning to use a custom Keys Configuration File, for example,
CustomKeys.xml, then deploy any modified files to your Transaction server (
ts-app
).For example, wc-server.xml, CustomKeys.xml, merchantKey.xml, and KeyEncryptionKey.xml.
- If your Transaction server is running, restart the application.
- Update wc-server.xml. Set