예제 #1
0
        /// <summary>
        /// Returns the model for decoding from the web.config
        /// </summary>
        /// <returns></returns>
        internal static EncryptorModel GetEncryptorModel()
        {
            var pass = ConfigurationManager.AppSettings["CaptchaPass"];
            var salt = ConfigurationManager.AppSettings["CaptchaSalt"];

            if ((string.IsNullOrEmpty(pass) || string.IsNullOrEmpty(salt)))
            {
                throw new ConfigurationErrorsException("In the web.config file, there are no options for Captcha.");
            }
            try {
                var encryptorModel = new EncryptorModel()
                {
                    Password = pass, Salt = Convert.FromBase64String(salt)
                };
                return(encryptorModel);
            } catch (Exception) {
                throw;
            }
        }
예제 #2
0
 public EncryptorViewModel()
 {
     Model = new EncryptorModel();
 }