public static SymmetricAlgorithm GetDecryptionAlgorithm (string name)
{
SymmetricAlgorithm sa = null;
switch (name) {
case "AES":
case "Auto":
sa = Rijndael.Create ();
break;
case "DES":
sa = DES.Create ();
break;
case "3DES":
sa = TripleDES.Create ();
break;
default:
#if NET_4_0
if (name.StartsWith ("alg:"))
sa = SymmetricAlgorithm.Create (name.Substring (4));
else
#endif
{
#if NET_2_0
throw new ConfigurationErrorsException ();
#else
throw new HttpException ("Unknown encryption algorithm name.");
#endif
}
#if NET_4_0
break;
#endif
}
return sa;
}