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

Interface GiftListEncryptionHelper

  • All Known Implementing Classes:
    GiftListEncryptionHelperImpl


    public interface GiftListEncryptionHelper
    This helper interface provides services to encrypt, decrypt and match a given password. The default implementation uses the WebSphere Commerce encryption framework. To change the encryption mechanism a new implementation must be registered in the wc-component.xml. The instance to be used can be retrieved using the GiftCenterComponentHelper
     The sample snippet to include in the wc-component.xml is as shown below:
            <_config:extendedconfiguration>
                            <_config:configgrouping name="GiftListPasswordEncryptionOptions">
                                    <_config:property name= "EncryptionHelperImpl" value = "com.ibm.commerce.giftcenter.ext.ExtGiftListEncryptionHelperImpl" />
                            </_config:configgrouping>         
            </_config:extendedconfiguration>
     
    See Also:
    GiftCenterComponentHelper#getGiftListEncryptionHelper()}
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM copy right field.
      static java.lang.String DEFAULT_CHAR_SET
      The default character set used for encoding/decoding a string
      static java.lang.String NAME
      The name of this class
    • Method Summary

      All Methods Instance Methods Abstract 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)
      Determines if a given plain text matches encrypted text.
      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.
    • Field Detail

      • COPYRIGHT

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

        static final java.lang.String NAME
        The name of this class
      • DEFAULT_CHAR_SET

        static final java.lang.String DEFAULT_CHAR_SET
        The default character set used for encoding/decoding a string
        See Also:
        Constant Field Values
    • Method Detail

      • generateSalt

        java.lang.String generateSalt()
                               throws ECException
        This method generates the salt to be used for creating passwords.
        Returns:
        String The salt that is generated.
        Throws:
        ECException
      • performOneWayHashEncryption

        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.
        Parameters:
        password -
        salt -
        Returns:
        The one way hash encrypted password.
        Throws:
        ECException
      • isMatchingCipherText

        boolean isMatchingCipherText(byte[] originalPassword,
                                     java.lang.String salt,
                                     java.lang.String password,
                                     boolean matchByOneWayHash)
                              throws ECException
        Determines if a given plain text matches encrypted text. Based on the boolean flag passed as the parameter, the method either uses one way hash encryption or reversible encryption to match the password.
        Parameters:
        originalPassword - the encrypted text
        salt - the salt used for encryption or decryption of the cipher text
        password - the plaintext password used for comparison
        matchByOneWayHash - boolean to indicate if one way hash encryption is to be used.
        Returns:
        true if the plain text can be encrypted to the given cipher text. false, otherwise.
        Throws:
        ECException
      • performReversibleEncryption

        byte[] performReversibleEncryption(java.lang.String password,
                                           java.lang.String salt)
                                    throws ECException
        Performs reversible encryption on the password.
        Parameters:
        password - the plain text password
        salt - The salt to be used for the encryption
        Returns:
        the encrypted password
        Throws:
        ECException
      • reverseEncryptedPassword

        java.lang.String reverseEncryptedPassword(byte[] password,
                                                  java.lang.String salt)
        Decrypt a given password. The method should be invoked only if the password is reversible.
        Parameters:
        password - the password to be decrypted
        salt - The salt to be used while decrypting.
        Returns:
        the decrypted result