コード例 #1
0
        private Func <KeyedHashAlgorithm> GetValidationAlgorithmFactory()
        {
            return(GetGenericAlgorithmFactory <KeyedHashAlgorithm>(
                       configAttributeName: "validation",
                       configAttributeValue: _machineKeySection.GetValidationAttributeSkipValidation(),
                       switchStatement: algorithmName => {
                switch (algorithmName)
                {
                case "SHA1":
                    return CryptoAlgorithms.CreateHMACSHA1;

                case "HMACSHA256":
                    return CryptoAlgorithms.CreateHMACSHA256;

                case "HMACSHA384":
                    return CryptoAlgorithms.CreateHMACSHA384;

                case "HMACSHA512":
                    return CryptoAlgorithms.CreateHMACSHA512;

                default:
                    return null;         // unknown
                }
            },
                       errorResourceString: SR.Wrong_validation_enum_FX45));
        }