private Func <SymmetricAlgorithm> GetEncryptionAlgorithmFactory() { return(GetGenericAlgorithmFactory <SymmetricAlgorithm>( configAttributeName: "decryption", configAttributeValue: _machineKeySection.GetDecryptionAttributeSkipValidation(), switchStatement: algorithmName => { // We suppress CS0618 since some of the algorithms we support are marked with [Obsolete]. // These deprecated algorithms are *not* enabled by default. Developers must opt-in to // them, so we're secure by default. #pragma warning disable 618 switch (algorithmName) { case "AES": case "Auto": // currently "Auto" defaults to AES return CryptoAlgorithms.CreateAes; case "DES": return CryptoAlgorithms.CreateDES; case "3DES": return CryptoAlgorithms.CreateTripleDES; default: return null; // unknown #pragma warning restore 618 } }, errorResourceString: SR.Wrong_decryption_enum)); }