Tony and Elise's Blog

All things Family, and some tech/dev stuff here and there.
posts - 26, comments - 7, trackbacks - 3

Machine Key Generator

So there I was, strolling along minding my own SharePoint custom Membership Provider business, when all of a sudden I ran across some information (issue???) about Client Integration and persistent cookies. Then there was more information about cookie timeouts, and what a hassle it is to recover from the timeout on a machine with a default machine key in the machine.config file. THEN, there was a link to a microsoft article that describes the process to create new keys for use in Forms Authentication. So, I thought to myself, "Self, feels like a good time to write a simple windows form application to easily do this." All the code is there, its just a matter of retrofitting it for a form.

So, here it is in all its glory. The valid values for decryptionKey is 8 or 24. This creates a 16 byte key for Data Encryption Standard (DES) or a 48 byte key for Triple DES, respectively. Valid values for validationKey are 20 to 64. This creates keys from 40 to 128 bytes in length. The output from the code is an entire <machineKey> element that you can copy and paste into a Machine.config file. Simply right-click in the text box and choose copy, then past it in your machine.config. Easy, huh?

Download it here (Contains Source and Binaries for 32 and 64 bit).

Print | posted on Thursday, May 10, 2007 5:33 PM | Filed Under [ .NET C# Utilities ]

Feedback

No comments posted yet.

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 4 and 7 and type the answer here:

Powered by: