2 // System.Web.Configuration.MachineKeySection
5 // Chris Toshok (toshok@ximian.com)
7 // (c) Copyright 2005 Novell, Inc (http://www.novell.com)
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 using System.ComponentModel;
33 using System.Configuration;
37 namespace System.Web.Configuration {
39 public sealed class MachineKeySection : ConfigurationSection
41 static ConfigurationProperty decryptionProp;
42 static ConfigurationProperty decryptionKeyProp;
43 static ConfigurationProperty validationProp;
44 static ConfigurationProperty validationKeyProp;
45 static ConfigurationPropertyCollection properties;
47 static MachineKeySection ()
49 decryptionProp = new ConfigurationProperty ("decryption", typeof (string), "Auto");
50 decryptionKeyProp = new ConfigurationProperty ("decryptionKey", typeof (string), "AutoGenerate,IsolateApps");
51 validationProp = new ConfigurationProperty ("validation", typeof (MachineKeyValidation), MachineKeyValidation.SHA1);
52 validationKeyProp = new ConfigurationProperty ("validationKey", typeof (string), "AutoGenerate,IsolateApps");
53 properties = new ConfigurationPropertyCollection ();
55 properties.Add (decryptionProp);
56 properties.Add (decryptionKeyProp);
57 properties.Add (validationProp);
58 properties.Add (validationKeyProp);
63 protected override void Reset (ConfigurationElement parentElement)
65 base.Reset (parentElement);
68 [TypeConverter (typeof (WhiteSpaceTrimStringConverter))]
69 [StringValidator (MinLength = 1)]
70 [ConfigurationProperty ("decryption", DefaultValue = "Auto")]
71 public string Decryption {
72 get { return (string) base [decryptionProp];}
73 set { base[decryptionProp] = value; }
76 [TypeConverter (typeof (WhiteSpaceTrimStringConverter))]
77 [StringValidator (MinLength = 1)]
78 [ConfigurationProperty ("decryptionKey", DefaultValue = "AutoGenerate,IsolateApps")]
79 public string DecryptionKey {
80 get { return (string) base [decryptionKeyProp];}
81 set { base[decryptionKeyProp] = value; }
85 [TypeConverter (typeof (MachineKeyValidationConverter))]
87 [ConfigurationProperty ("validation", DefaultValue = "SHA1")]
88 public MachineKeyValidation Validation {
89 get { return (MachineKeyValidation) base [validationProp];}
90 set { base[validationProp] = value; }
93 [TypeConverter (typeof (WhiteSpaceTrimStringConverter))]
94 [StringValidator (MinLength = 1)]
95 [ConfigurationProperty ("validationKey", DefaultValue = "AutoGenerate,IsolateApps")]
96 public string ValidationKey {
97 get { return (string) base [validationKeyProp];}
98 set { base[validationKeyProp] = value; }
101 protected override ConfigurationPropertyCollection Properties {
102 get { return properties; }