CodeKicks.com
Focus on Microsoft Technologies - Tutorials, Articles, Code Samples.

Saturday, September 02, 2006

Machine Key Generator in ASP.NET

This tool allows you to generate random keys for valdiation and ecnryption/decryption of the view state. It builds a <machineKey> element which you need to include in your web.config file.

The validation key should be in the range of 20 to 64. Decryption key—8 or 24. Between SHA1 and MD5 algorithms used for validation SHA1 produces a longer key and is therefore recommended. The tool creates a 8-byte key for the Data Encryption Algorythm (DES) and a 24-byte one for Triple-DES (3DES).

Once keys are generated they are converted into a string of hexadecimal characters.

for the input 64, 24, SHAI

Example <machineKey validationKey="46C62C2383DBB2F8E148C48405734FABC2118A2
5DB1B6590B7989B48776735019F1D6D8B0311AA072255
445BD46649C33EB3E4BEE482334093FBAEBF81D129C3"
decryptionKey="B0ED022DDBE33DE1B35EB67EA1D8CB1
3EA815591B1DD02F1" validation="SHA1" />

Get the Tool

Post a Comment