Skip to content

Commit eddb4d8

Browse files
committed
Added Machine Key Generator.
1 parent d7a5ad5 commit eddb4d8

15 files changed

+1447
-1
lines changed

MachineKeyGenerator/App.config

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<configSections>
4+
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
5+
<section name="MachineKeyGenerator.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
6+
</sectionGroup>
7+
</configSections>
8+
<startup>
9+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
10+
</startup>
11+
<applicationSettings>
12+
<MachineKeyGenerator.Properties.Settings>
13+
<setting name="DecryptionKeyLength" serializeAs="String">
14+
<value>64</value>
15+
</setting>
16+
<setting name="ValidationKeyLength" serializeAs="String">
17+
<value>64</value>
18+
</setting>
19+
</MachineKeyGenerator.Properties.Settings>
20+
</applicationSettings>
21+
</configuration>

MachineKeyGenerator/GeneratorForm.Designer.cs

Lines changed: 123 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System;
2+
using System.Windows.Forms;
3+
4+
namespace MachineKeyGenerator
5+
{
6+
public partial class GeneratorForm : Form
7+
{
8+
public GeneratorForm()
9+
{
10+
InitializeComponent();
11+
txtDecryption.Text = Properties.Settings.Default.DecryptionKeyLength.ToString();
12+
txtValidation.Text = Properties.Settings.Default.ValidationKeyLength.ToString();
13+
}
14+
15+
private void btnGenerate_Click(object sender, EventArgs e)
16+
{
17+
int DecLength = Properties.Settings.Default.DecryptionKeyLength;
18+
int ValLength = Properties.Settings.Default.ValidationKeyLength;
19+
if (!Int32.TryParse(txtDecryption.Text, out DecLength) || !Int32.TryParse(txtValidation.Text, out ValLength))
20+
{
21+
txtOutput.Text += string.Format("No (or invalid) lengths specified for decryption key length or validation key length.\r\nUsing defaults of {0} bytes for decryption key and {1} bytes for validation key.\r\n", DecLength, ValLength);
22+
}
23+
txtOutput.Text += string.Format("<machineKey decryptionKey=\"{0}\" validationKey=\"{1}\" validation=\"HMACSHA256\"/>\r\n", KeyGenerator.CreateKey(DecLength), KeyGenerator.CreateKey(ValLength));
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)