question

Teodor Plop avatar image
Teodor Plop asked

HmacSHA256 Azure Table integration

Hi there!

Has anyone managed to successfully integrate the HmacSHA256 algorithm to authorize Azure Table Storage requests?

I managed to connect using Postman and crypto-js to Azure Table Storage, but for some reason crypto-js returns different results than other algorithms that I copied over to Playfab.

This is the code from Postman that I cannot replicate on Playfab:

const signature = calculate_signature;
const storageKey = some_storage_key;


const signatureBytes = cryptoJS.HmacSHA256(signature, cryptoJS.enc.Base64.parse(storageKey));
const signatureEncoded = signatureBytes.toString(cryptoJS.enc.Base64);

// do something with signatureEncoded

Can anyone help with this?

Thanks!

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Teodor Plop avatar image
Teodor Plop answered

Hi there!

I managed to import the raw text for crypto-js plugin into Playfab and after a few more tries, I was able to successfully connect to Azure Table Storage.

As a side note, I understand why Playfab does not allow us to import plugins, but it would be great if you could provide in a future update at least some popular encryption algorithms, as they are required for most external database requests.

Cheers!

6 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Citrus Yan avatar image Citrus Yan commented ·

Hi @Teodor Plop,

Glad to hear that you made it!

Please note that you can include the source code for any encryption scheme you want to do directly in your script. And, adding some popular encryption algorithms sounds like a feature request to me, you can make a feature request about it here to help us improve the service:)

0 Likes 0 ·
krishole avatar image krishole commented ·

Hi @Teodor Plop, just wondering if you wouldn't mind sharing what you did to import crypto-js to use in playfab?

0 Likes 0 ·
Teodor Plop avatar image Teodor Plop krishole commented ·

Hi @kris.hole. Well, I took a brute force approach. Found a JS code that worked somewhere on the web, used a website to minimize the code and added it at the end of the Playfab file.

0 Likes 0 ·
krishole avatar image krishole Teodor Plop commented ·

Yeah I have a feeling that's what I'm going to need to do, would you mind sharing the JS code you used or if you recall where you found it? I would be very grateful if you could.

0 Likes 0 ·
Show more comments
Citrus Yan avatar image
Citrus Yan answered

Can you share the code that returns different results you used in PlayFab?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.