Inheritance: IRijndaelStringEncrypter
示例#1
0
        public static MvcHtmlString EncryptedHidden(this HtmlHelper helper, string name, object value)
        {
            if (value == null)
            {
                value = string.Empty;
            }
            var strValue = value.ToString();
            IEncryptSettingsProvider settings = new EncryptSettingsProvider();
            var encrypter      = new RijndaelStringEncrypter(settings, helper.GetActionKey());
            var encryptedValue = encrypter.Encrypt(strValue);

            encrypter.Dispose();

            var encodedValue = helper.Encode(encryptedValue);
            var newName      = string.Concat(settings.EncryptionPrefix, name);

            return(helper.Hidden(newName, encodedValue));
        }
 private IRijndaelStringEncrypter GetDecrypter(RequestContext requestContext)
 {
     var decrypter = new RijndaelStringEncrypter(_settings, requestContext.GetActionKey());
     return decrypter;
 }