7 Replies Latest reply on Jan 9, 2015 9:48 AM by RevJake1890

    Encrypt base64 encoded, hashed with the secret key


      I'd grateful for help in creating a hash value that is "base64 encoded, hashed (SHA-256) with the secret key string that is a concatenation of the a few values I have (accountId, userId, and Time)"

      The documentation given to us has a sample and shows us how to create the hash via PHP, but I need to know how to do this in using ColdFusion.


      Below is the sample starting values and the correct output for those sample values. If I can recreate this then I can create what I need with real values. 


      Sample Values from Documentation (using PHP)

      • $key = 'abc123';
      • $accountId = 123;
      • $userId = 123456;
      • $time = 1379605500; // 9-19-2013 15:45:00 GMT
      • $signatureString = $accountId . $userId . $time;
      • $signature = base64_encode(hash_hmac('sha256', $signatureString, $key, "true"));


      So, using the above sample values the documentation show that the string "1231234561379605500" will be converted to this hash, "DSJHPt7kUbRdB8U9XfCXXe4eTXDkiqpGud1Z0fO9EPg="


      Does anyone know how to do that in ColdFusion? I'm too embarrassed to show what I've been trying.


      Thanks in advance for help!