• Brendan C
  • NEWBIE
  • 5 Points
  • Member since 2015
  • Pinterest

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 1
    Questions
  • 4
    Replies
Hello!

I am attempting to mirror a specific process for generating an hmac (using SHA-256) that is currently being done in Python.

The problem is as follows,

1) In Python - you have a two step process for generating an hmac/signature
2) First step - you initialize a new hmac object with your secret key
3) Second step - you call an UPDATE method with the specific string you want to use for your signature (see example below)
# Create a HMAC-SHA256 instance and initialize it with your secret 
hmac = hmac.new("yoursecretkey", digestmod=hashlib.sha256)
# Update the instance with your sig string
hmac.update("yourinputstring")
sig = hmac.hexdigest()
4) You then can call hmac.hexdigest and get a hex encoded signature

The problem is - in Salesforce, there is a single method, Crypto.generateMac, that takes three arguments:

a) The algorithm (sha-256)
b) The input string
c) Your secret key

Running this method with the same string/secret key will net out a different result than running the process in Python.

I don't know enough about hmac/SHA-256 to know what the hmac.new vs hmac.update methods are doing - but I'm hoping to reproduce the process and get the same results in Salesforce.

Any help/thoughts you could provide would be very helpful
Hello!

I am attempting to mirror a specific process for generating an hmac (using SHA-256) that is currently being done in Python.

The problem is as follows,

1) In Python - you have a two step process for generating an hmac/signature
2) First step - you initialize a new hmac object with your secret key
3) Second step - you call an UPDATE method with the specific string you want to use for your signature (see example below)
# Create a HMAC-SHA256 instance and initialize it with your secret 
hmac = hmac.new("yoursecretkey", digestmod=hashlib.sha256)
# Update the instance with your sig string
hmac.update("yourinputstring")
sig = hmac.hexdigest()
4) You then can call hmac.hexdigest and get a hex encoded signature

The problem is - in Salesforce, there is a single method, Crypto.generateMac, that takes three arguments:

a) The algorithm (sha-256)
b) The input string
c) Your secret key

Running this method with the same string/secret key will net out a different result than running the process in Python.

I don't know enough about hmac/SHA-256 to know what the hmac.new vs hmac.update methods are doing - but I'm hoping to reproduce the process and get the same results in Salesforce.

Any help/thoughts you could provide would be very helpful
In a nutshell the issue is, We've implemented custom email publisher action where we are using publisher js. We are populating email body with the response received with publisher js but its not getting updated. It was working fine till API version 32 but since version 33 its breaking.

Some more pointers on the events which we see while calling this functionality. It looks specific to Custom Publisher action called Send_Email on Case object which contains a visualforce page that has apex:emailPublisher tags.

Following are the javascript events that works on Winter 15 and doesnt work on Spring 15

Winter 15 :CEB EVENT! ns<entityFeed:publisher> en<onShow> pld<[object Object]> exec-time<1> Chatter.js:257 CEB EVENT! ns<action:Case.Email> en<onSetInputValues> pld<[object Object]> exec-time<1> Chatter.js:257 CEB EVENT! ns<entityFeed:publisher> en<onShow> pld<[object Object]> exec-time<0> Chatter.js:257 CEB EVENT! ns<entityFeed:publisher> en<onShow> pld<[object Object]> exec-time<0> Chatter.js:257 CEB EVENT! ns<action:Case.Email> en<onSetInputValues> pld<[object Object]> exec-time<9> Chatter.js:257 CEB EVENT! ns<action:Case.Email> en<onSetInputValues> pld<[object Object]> exec-time<0>Spring 15 :CEB EVENT! ns<entityFeed:publisher> en<onShow> pld<[object Object]> exec-time<4> Chatter.js:257 CEB EVENT! ns<entityFeed:publisher> en<onShow> pld<[object Object]> exec-time<0> EntityFeedCore.js:17 CEB EVENT! ns<entityFeed:publisher> en<onShow> pld<[object Object]> exec-time<1> Chatter.js:257 CEB EVENT! ns<entityFeed:publisher> en<onShow> pld<[object Object]> exec-timeHas any one faced such issue or have any pointer on this? Has salesforce changed/introduced anything new around it?
In a nutshell the issue is, We've implemented custom email publisher action where we are using publisher js. We are populating email body with the response received with publisher js but its not getting updated. It was working fine till API version 32 but since version 33 its breaking.

Some more pointers on the events which we see while calling this functionality. It looks specific to Custom Publisher action called Send_Email on Case object which contains a visualforce page that has apex:emailPublisher tags.

Following are the javascript events that works on Winter 15 and doesnt work on Spring 15

Winter 15 :CEB EVENT! ns<entityFeed:publisher> en<onShow> pld<[object Object]> exec-time<1> Chatter.js:257 CEB EVENT! ns<action:Case.Email> en<onSetInputValues> pld<[object Object]> exec-time<1> Chatter.js:257 CEB EVENT! ns<entityFeed:publisher> en<onShow> pld<[object Object]> exec-time<0> Chatter.js:257 CEB EVENT! ns<entityFeed:publisher> en<onShow> pld<[object Object]> exec-time<0> Chatter.js:257 CEB EVENT! ns<action:Case.Email> en<onSetInputValues> pld<[object Object]> exec-time<9> Chatter.js:257 CEB EVENT! ns<action:Case.Email> en<onSetInputValues> pld<[object Object]> exec-time<0>Spring 15 :CEB EVENT! ns<entityFeed:publisher> en<onShow> pld<[object Object]> exec-time<4> Chatter.js:257 CEB EVENT! ns<entityFeed:publisher> en<onShow> pld<[object Object]> exec-time<0> EntityFeedCore.js:17 CEB EVENT! ns<entityFeed:publisher> en<onShow> pld<[object Object]> exec-time<1> Chatter.js:257 CEB EVENT! ns<entityFeed:publisher> en<onShow> pld<[object Object]> exec-timeHas any one faced such issue or have any pointer on this? Has salesforce changed/introduced anything new around it?