mardi 10 juillet 2018

How do I generate IIS machineKey from inside code?

I want random values for this web.config section:

<machineKey validation="HMACSHA512" decryption="AES"
     validationKey="I NEED VALUE FOR THIS" 
     decryptionKey="SOME KEY" />

I see that IIS Manager can generate values but in the version I have it has no option for "HMACSHA512" in the dropdown. So I need some other way.

I could write some C# code for that but what should it do exactly? Should it just generate a long enough random number and format that?

Do I just use RNGCryptoServiceProvider class and generate an appropriately long byte array and then format that as hex? Will that do?




Aucun commentaire:

Enregistrer un commentaire