ueHash

Defines the properties of the hash used to validate a source key.

Description

This object defines the properties of the hash used to validate a source key. This object is only required on source keys that have a PIN assigned.

PINs are not meant to be stored by the application. Instead, the application should prompt the end user for the PIN. The PIN may be cached temporarily, but should not be stored permanently unless appropriate security measures are taken, such as strong encryption.

Please note that access to certain methods will require a PIN. These features are restricted to sources with a PIN to minimize the impact of a merchant's source key being stolen.

Properties

TypeNameDescription
stringTypeHashing function used: currently, only “md5” and “sha1” are supported. (required)
stringSeedThe data used to seed the hash: this value must be unique and cannot be reused. The system will reject the request if a seed is reused. The reason for this is to minimize the damage if a HashValue is stolen. An intruder may manage to obtain a SourceKey and a HashValue, but will not be able to use the source key since the HashValue is based on a seed that cannot be reused. (required)
stringHashValueHash string: the resulting hash. The hash is calculated by concatenating the SourceKey, the seed, and the PIN value. Do not place any characters in between these values. Once the values have been concatenated, calculate the hash string using the algorithm specified by Type. (required)

Examples

MD5 md5Hasher = MD5.Create();
           // Convert the input string to a byte array and compute the hash.
           byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(input));
           // Create a new Stringbuilder to collect the bytes
           // and create a string.
           StringBuilder sBuilder = new StringBuilder();
           // Loop through each byte of the hashed data
           // and format each one as a hexadecimal string.
           for (int i = 0; i < data.Length; i++)
           {
               sBuilder.Append(data[i].ToString("x2"));
           }
           // Return the hexadecimal string.
           return sBuilder.ToString();