Encrypt data in custom code using EncryptionFactory

EncryptionFactory is a factory class that initializes all of the encryption provider classes used at runtime for encrypting and decrypting data. All encryption providers must implement the com.ibm.commerce.foundation.common.util.encryption.EncryptionProvider interface. The following are the encryption providers that we can use for encrypting / decrypting data:

To retrieve a particular encryption provider, call this method:

To encrypt data that uses an encryption provider, call the encrypt() method. For example, to encrypt data to be stored in the database, use the ActiveProvider (merchant key):

The following interaction diagram explains how a component encrypts sensitive data:

Similarly, to decrypt data that uses an encryption provider, call the decrypt() method. For example, to decrypt data from the database, use the ActiveProvider (merchant key):

The following interaction diagram demonstrates how a component decrypts data: