public static string GetSqlConnection(string connectionStringName = "DefaultConnection")
        {
            // optionally defaults to "DefaultConnection" if no connection string name is inputted
            string connectionString = ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString;
            // decrypt password
            string password = GetPhraseAfterWord(connectionString, "password="******";");

            connectionString = connectionString.Replace(password, StringCipher.DecryptAES(password));
            return(connectionString);
        }
Esempio n. 2
0
        public void DecryptAES_HexString_Test()
        {
            // arrange
            bool   uppercase = false;
            string source    = uppercase ? "905D3CB89F58282EE3DA55B3F48CC8BC" : "905d3cb89f58282ee3da55b3f48cc8bc";
            string expected  = "FuckYouIdiot";

            // act
            string target = StringCipher.DecryptAES(source);

            // assert
            Assert.AreEqual(expected, target);
        }