You've already forked linux-packaging-mono
Imported Upstream version 4.0.0~alpha1
Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
@ -33,17 +33,12 @@ using System.ComponentModel;
|
||||
using System.Configuration;
|
||||
using System.Globalization;
|
||||
|
||||
#if NET_2_0
|
||||
|
||||
namespace System.Web.Configuration {
|
||||
|
||||
public sealed class MachineKeyValidationConverter : ConfigurationConverterBase
|
||||
{
|
||||
#if NET_4_0
|
||||
const string InvalidValue = "The enumeration value must be one of the following: SHA1, MD5, 3DES, AES, HMACSHA256, HMACSHA384, HMACSHA512.";
|
||||
#else
|
||||
const string InvalidValue = "The enumeration value must be one of the following: SHA1, MD5, 3DES, AES.";
|
||||
#endif
|
||||
public MachineKeyValidationConverter ()
|
||||
{
|
||||
}
|
||||
@ -59,14 +54,12 @@ namespace System.Web.Configuration {
|
||||
return MachineKeyValidation.TripleDES;
|
||||
case "AES":
|
||||
return MachineKeyValidation.AES;
|
||||
#if NET_4_0
|
||||
case "HMACSHA256":
|
||||
return MachineKeyValidation.HMACSHA256;
|
||||
case "HMACSHA384":
|
||||
return MachineKeyValidation.HMACSHA384;
|
||||
case "HMACSHA512":
|
||||
return MachineKeyValidation.HMACSHA512;
|
||||
#endif
|
||||
default:
|
||||
throw new ArgumentException (InvalidValue);
|
||||
}
|
||||
@ -74,15 +67,8 @@ namespace System.Web.Configuration {
|
||||
|
||||
public override object ConvertTo (ITypeDescriptorContext ctx, CultureInfo ci, object value, Type type)
|
||||
{
|
||||
#if NET_4_0
|
||||
if ((value == null) || (value.GetType () != typeof (MachineKeyValidation)))
|
||||
throw new ArgumentException (InvalidValue);
|
||||
#else
|
||||
if (value.GetType () != typeof (MachineKeyValidation)) {
|
||||
/* MS throws this exception on an invalid */
|
||||
throw new FormatException (InvalidValue);
|
||||
}
|
||||
#endif
|
||||
|
||||
switch ((MachineKeyValidation) value) {
|
||||
case MachineKeyValidation.MD5:
|
||||
@ -93,7 +79,6 @@ namespace System.Web.Configuration {
|
||||
return "3DES";
|
||||
case MachineKeyValidation.AES:
|
||||
return "AES";
|
||||
#if NET_4_0
|
||||
case MachineKeyValidation.HMACSHA256:
|
||||
return "HMACSHA256";
|
||||
case MachineKeyValidation.HMACSHA384:
|
||||
@ -103,14 +88,8 @@ namespace System.Web.Configuration {
|
||||
default:
|
||||
// includes MachineKeyValidation.Custom
|
||||
throw new ArgumentException (InvalidValue);
|
||||
#else
|
||||
default:
|
||||
/* MS throws this exception on an invalid */
|
||||
throw new FormatException (InvalidValue);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user