Tuesday, January 12, 2016

Encrypting data using EncryptionFactory in IBM WCS


Encrypting data using EncryptionFactory in IBM WCS
The following are the encryption providers that you can use for encrypting / decrypting data:
ActiveProvider: This provider is responsible for encrypting and decrypting sensitive data to be stored in the database, for example credit card numbers. The encryption key is the merchant key.
SessionProvider: This provider is responsible for encrypting and decrypting external facing data such as values in a cookie. The encryption key is the session key.
To retrieve a particular encryption provider, call this method:
EncryptionFactory.getInstance().getProvider("name of provider")
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):

com.ibm.commerce.foundation.common.util.encryption.EncryptionFactory.getInstance()

.getProvider("com.ibm.commerce.server.ECConstants.EC_ENCRYPTION_ACTIVEPROVIDER")

.encrypt("myDataToEncrypt");
 
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):

com.ibm.commerce.foundation.common.util.encryption.EncryptionFactory.getInstance()

.getProvicer("com.ibm.commerce.server.ECConstants.EC_ENCRYPTION_ACTIVEPROVIDER")

.decrpypt("myEncryptedData");

No comments:

Post a Comment