This should do the trick. Went through something like this many months ago.
Had some great help from some of the guys in here with a JAVA approach.
Worked like a charm.

        <cfset finalToHash = "WhateverINeedToHash">
        <cfset key = "WhateverKey">

        <cfset keyBytes = binarydecode(key, "base64")>
        <cfset msgBytes = CharsetDecode(finalToHash, "utf-8")>

            <cfscript>
            // let Variables.keyBytes be the binary key
            // let Variables.msgBytes be the binary message

            // calculate an HMAC-SHA1 for the given key and message
            Variables.key = CreateObject("java","
javax.crypto.spec.SecretKeySpec");
            Variables.key.init(Variables.keyBytes,"HmacSHA1");

            Variables.hmac = CreateObject("java","javax.crypto.Mac");
            Variables.hmac = Variables.hmac.getInstance("HmacSHA1");
            Variables.hmac.init(Variables.key);
            Variables.hmac.update(Variables.msgBytes);
            Variables.hmac = Variables.hmac.doFinal();

            // Variables.hmac now contains the binary HMAC
            </cfscript>

            <cfset computedHMAC = binaryencode(hmac, "base64")>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:290387
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to