System.Web.Security.MembershipProvider.GetAlgorithm C# (CSharp) Method

GetAlgorithm() private method

private GetAlgorithm ( ) : SymmetricAlgorithm
return System.Security.Cryptography.SymmetricAlgorithm
		SymmetricAlgorithm GetAlgorithm ()
		{
			MachineKeySection section = MachineKeySection.Config;

			if (section.DecryptionKey.StartsWith ("AutoGenerate"))
				throw new ProviderException ("You must explicitly specify a decryption key in the <machineKey> section when using encrypted passwords.");

			SymmetricAlgorithm sa = section.GetDecryptionAlgorithm ();
			if (sa == null)
				throw new ProviderException (String.Format ("Unsupported decryption attribute '{0}' in <machineKey> configuration section", section.Decryption));

			sa.Key = section.GetDecryptionKey ();
			return sa;
		}