Clone Users - how to calculate hmac?
Question

Hi All,

In a customer scenario in which we need a seperate User provider we created a clone and implemented some encrypting and decrypting by using the cryptoapi forge component with success. 

In this scenario we would like to configure the authentication for this clone against saml, but for that to work, we will need to implement a CalculateHMACWithAlgorithm server action.

I tried the computemac method from the cryptoapi but that results in an 'cannot cast SHA256Managed to HMAC error.

To be honest I am not that familiair with this hmac, so before I take a deep dive into this I was wondering if anyone knows if and if so how I can implement this by using cryptoapi or another method?

Thanks!
Dennis




Hi Dennis

There is a PlatformPasswordUtils extension, specifically the GenerateSaltedSHA512Hash function, I don't know if it fits your needs, but I think you can do some conversions from that.

If you are confortable with C# you can always create you own extension to generate the HMAC you need and return the value in the format you require.

Leopoldo Ismael wrote:

Hi Dennis

There is a PlatformPasswordUtils extension, specifically the GenerateSaltedSHA512Hash function, I don't know if it fits your needs, but I think you can do some conversions from that.

If you are confortable with C# you can always create you own extension to generate the HMAC you need and return the value in the format you require.

Thank you Leopoldo!


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.