/// <summary>
        /// Reads the connection string values and returns a decrypted connnection string
        /// </summary>
        /// <param name="conVal"></param>
        /// <param name="decryptor"></param>
        /// <returns></returns>
        public static string DecryptConVal(string conVal, IEncryptDecrypt decryptor)
        {
            string[] conVals = conVal.Split(';');
            string proVal = string.Empty;
            string decVal = string.Empty;
            for (int cnt = 0; cnt < conVals.Count(); cnt++)
            {
                if (conVals[cnt].Contains("User ID"))
                {
                    proVal = string.Empty;
                    proVal = conVals[cnt].ToString().Replace("User ID=", " ");
                    conVals[cnt] = "User ID=" + decryptor.DecryptString(proVal);
                }

                if (conVals[cnt].Contains("Password"))
                {
                    proVal = string.Empty;
                    proVal = conVals[cnt].ToString().Replace("Password="******" ");
                    conVals[cnt] = "Password="******";";
            }

            return decVal;
        }
        public void Setup()
        {
            fileService            = FileService.CrossFileService.Current;
            fileService.SandboxTag = SANDBOX_TAG;

            encryptedDecrypt = EncryptDecrypt.CrossEncryptDecrypt.Current;
        }
        public static void ClassSetup(TestContext testContext)
        {
            //fileService = new Service.FileServiceImplementation
            //{
            //    SandboxTag = SANDBOX_TAG
            //};

            fileService = CrossFileService.Current;

            encryptedDecrypt = new EncryptDecrypt();
        }
Esempio n. 4
0
        /// <summary>
        /// generic implementation
        /// </summary>
        /// <param name="helper"></param>
        /// <param name="encDec"></param>
        /// <param name="actionName"></param>
        /// <param name="routeValues"></param>
        /// <returns></returns>
        public static string ActionEnc(this UrlHelper helper, IEncryptDecrypt encDec, string actionName, object routeValues)
        {
            var url   = helper.Action(actionName, routeValues);
            var index = url.IndexOf("?");

            if (index == -1)
            {
                return(url);
            }
            var uri = new Uri(url, UriKind.RelativeOrAbsolute);
            Uri absoluteUri;

            if (uri.IsAbsoluteUri)
            {
                absoluteUri = uri;
            }
            else
            {
                absoluteUri = new Uri(new Uri("http://msprogrammer.serviciipeweb.ro/"), uri);
            }
            var q    = absoluteUri.Query;
            var args = HttpUtility.ParseQueryString(q);

            if (args.Count == 0)
            {
                return(url);
            }

            for (int i = 0; i < args.Count; i++)
            {
                var key = args.GetKey(i);
                args[key] = encDec.EncryptString(args[i]);
            }
            url = url.Substring(0, index + 1);
            AppSettings._param = url + args;
            return(url + args.ToString());
        }
Esempio n. 5
0
 protected TestEncryption(IEncryptDecrypt encryptor)
 {
     this.Encryptor = encryptor;
 }
Esempio n. 6
0
 /// <summary>
 /// default constructor
 /// </summary>
 /// <param name="value"></param>
 public MVCDecryptActionFilter(IEncryptDecrypt value)
 {
     encDec = value;
 }
Esempio n. 7
0
 public void Setup()
 {
     encryptDecrypt = new EncryptDecrypt();
 }
Esempio n. 8
0
 public void SetDecryptor(IEncryptDecrypt encryptDecrypt)
 {
     this._encryptDecrypt = encryptDecrypt;
 }
 public EncryptionByAESController(IEncryptDecrypt encryptDecrypt)
 {
     _encryptDecrypt = encryptDecrypt;
 }
 //Need to implement wire via IoC (DI)
 public EncryptionByAESController()
 {
     _encryptDecrypt = new AESEncryption();
 }
Esempio n. 11
0
 private SecretIO()
 {
     Crypto = new Cryptography();
 }
Esempio n. 12
0
 protected TestEncryption(IEncryptDecrypt encryptor) { this.Encryptor = encryptor; }