com.ibm.commerce.giftcenter.facade.server.helpers

Class GiftListEncryptionHelperImpl

  • java.lang.Object
    • com.ibm.commerce.giftcenter.facade.server.helpers.GiftListEncryptionHelperImpl
  • All Implemented Interfaces:
    GiftListEncryptionHelper


    public final class GiftListEncryptionHelperImpl
    extends java.lang.Object
    implements GiftListEncryptionHelper
    This helper provides services to encrypt, decrypt and match a given password using the encryption framework provided in WebSphere Commerce.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.String generateSalt()
      This method generates the salt to be used for creating passwords.
      boolean isMatchingCipherText(byte[] originalPassword, java.lang.String salt, java.lang.String password, boolean matchByOneWayHash)
      Checks if the original password matches with the encrypted password generated from the password and salt that is provided to the method.
      byte[] performOneWayHashEncryption(java.lang.String password, java.lang.String salt)
      This method performs one way hash on a given password using the salt provided.
      byte[] performReversibleEncryption(java.lang.String password, java.lang.String salt)
      Performs reversible encryption on the password.
      java.lang.String reverseEncryptedPassword(byte[] password, java.lang.String salt)
      Decrypt a given password.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copy right field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • GiftListEncryptionHelperImpl

        public GiftListEncryptionHelperImpl()
    • Method Detail

      • isMatchingCipherText

        public boolean isMatchingCipherText(byte[] originalPassword,
                                            java.lang.String salt,
                                            java.lang.String password,
                                            boolean matchByOneWayHash)
                                     throws ECException
        Checks if the original password matches with the encrypted password generated from the password and salt that is provided to the method. This method checks if WebSphere Commerce is configured for using one way hashing or reversible encryption based on which the comparison will be made.
        Specified by:
        isMatchingCipherText in interface GiftListEncryptionHelper
        Parameters:
        originalPassword - The password that is already encrypted and stored in the GRUSERAUTH table.
        salt - The salt to be used for encryption.
        password - The plain text to be matched.
        matchByOneWayHash - boolean to indicate if one way hash encryption is to be used.
        Returns:
        true, if the password matches. false, otherwise.
        Throws:
        ECException
      • reverseEncryptedPassword

        public java.lang.String reverseEncryptedPassword(byte[] password,
                                                         java.lang.String salt)
        Decrypt a given password. The caller should know that the password is reversible.
        Specified by:
        reverseEncryptedPassword in interface GiftListEncryptionHelper
        Parameters:
        password - the password to be decrypted
        salt - The salt to be used while decrypting
        Returns:
        the decrypted result
      • performOneWayHashEncryption

        public byte[] performOneWayHashEncryption(java.lang.String password,
                                                  java.lang.String salt)
                                           throws ECException
        This method performs one way hash on a given password using the salt provided.
        Specified by:
        performOneWayHashEncryption in interface GiftListEncryptionHelper
        Parameters:
        password - The plain text password.
        salt - The salt to be used for encryption.
        Returns:
        The byte encrypted password.
        Throws:
        ECException
      • performReversibleEncryption

        public byte[] performReversibleEncryption(java.lang.String password,
                                                  java.lang.String salt)
                                           throws ECException
        Performs reversible encryption on the password.
        Specified by:
        performReversibleEncryption in interface GiftListEncryptionHelper
        Parameters:
        password - The plain text password to be encrypted
        salt - The salt to be used.
        Returns:
        byte[] Then encrypted password.
        Throws:
        ECException