c# - How do I share a hash key between servers for web.config etc? -
Is there a way to create a hash key that is used by our various servers to decrypt the connection string in web.config Can be done, and how will I do this? Any sign?
Thanks for the help! // Peter
There are 2 options, if it is in the house and you have to work all the machines Want to do the same, then a machine? Config sync will be the best. You want to generate a random key, but here are the example elements you want to change:
& lt; machineKey validationKey = "21F090935F6E49C2C797F69BBAAD8402ABD2EE0B667A8B44EA7DD4374267A75D7 AD972A119482D15A4127461DB1DC347C1A63AE5F1CCFAACFF1B72A7F0A281B" decryptionKey = "ABAA84D7EC4BB56D75D217CECFFB9628809BDB8BF91CFCD64568A145BE59719F" validation = "SHA1" decryption = "AES" / & gt;
To generate cryptographic random keys:
Use the RNGCryptoServiceProvider class to generate cryptographicly strong random numbers. Choose the appropriate key size. Recommended key length is as follows:
- For SHA1, validate for 64 bytes (128 hexadecimal characters).
- For AES, set the decryption set to 32 bytes (64 hexadecimal characters).
- For 3DES, set 24 bytes (48 hexadecimal characters) for decryption.
Since this was the first question I did when it was first ... how to generate it here, do this once and apply it to all machines:
Option 2: If you are not in that state and you need it Web.config level, then see ion MSDN
Comments
Post a Comment