static string ManuallyDecrypt(string encryptedString, IEnumerable<string> purposes = null)
        {
            var entropyCreator = new EntropyCreator();
              var entropy = entropyCreator.CreateEntropy(purposes);
              var protector = new DataProtector(entropy);

              var cypher = Convert.FromBase64String(encryptedString);
              var userData = protector.Unprotect(cypher);

              return Encoding.UTF8.GetString(userData);
        }
예제 #2
0
 public void SetUp()
 {
     _sut = new EntropyCreator();
 }
예제 #3
0
 public void SetUp()
 {
     _sut = new EntropyCreator();
 }
        static string ManuallyEncrypt(string stringtoEncrypt, IEnumerable<string> purposes = null)
        {
            var entropyCreator = new EntropyCreator();
              var entropy = entropyCreator.CreateEntropy(purposes);
              var protector = new DataProtector(entropy);

              var userData = Encoding.UTF8.GetBytes(stringtoEncrypt);
              var cypher = protector.Protect(userData);

              return Convert.ToBase64String(cypher);
        }