ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexWebSphere DataPowerUsing hmac-sha256

Post new topicReply to topic
Using hmac-sha256 View previous topic :: View next topic
Author Message
blink
PostPosted: Tue Aug 22, 2017 11:08 am Post subject: Using hmac-sha256 Reply with quote

Newbie

Joined: 22 Aug 2017
Posts: 2

At a high level i'm looking for a way to mimic the hmac-sha256 function used in JavaScript.

The JS version allows for a secret key which is not a 256 bit value e.g. "mysecretkey". However the DP version only allows 256 bit keys.

How I can use my custom key with the DP hmac-sha256 even when it's not a 256 bit value?
Back to top
View user's profile Send private message
blink
PostPosted: Tue Aug 22, 2017 11:10 am Post subject: Using hmac-sha256 Reply with quote

Newbie

Joined: 22 Aug 2017
Posts: 2

Here is the associated code to help clarify what I'm trying to do:

DP code:
Code:

var keyBuf = new Buffer("mysecretkey");
var hmac = crypto.createHmac('hmac-sha256', keyBuf); // this fails because keyBuf not 256 bits
var hmac_result = hmac.update(Message).digest('base64');
console.debug('hmac_results:' + hmac_result);


JS code:
Code:

var hash = CryptoJS.HmacSHA256("Message","mysecretkey");  / /this succeeds
var results = CryptoJS.enc.Base64.stringify(hash);
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere DataPowerUsing hmac-sha256
Jump to:



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.