Dispose() 공개 메소드

public Dispose ( ) : void
리턴 void
예제 #1
0
        public static string DecryptString(string EncryptedText, string iv = "", string key = "")
        {
            try
            {
                iv  = (iv + Röschti).Substring(0, 16);
                key = (key + Bradwurscht).Substring(0, 32);
                byte[] encryptedTextBytes = Convert.FromBase64String(EncryptedText);

                System.Security.Cryptography.SymmetricAlgorithm rijn = SymmetricAlgorithm.Create();

                MemoryStream ms       = new MemoryStream();
                byte[]       ba_rgbIV = Encoding.ASCII.GetBytes(iv);
                byte[]       ba_key   = Encoding.ASCII.GetBytes(key);
                CryptoStream cs       = new CryptoStream(ms, rijn.CreateDecryptor(ba_key, ba_rgbIV), CryptoStreamMode.Write);

                cs.Write(encryptedTextBytes, 0, encryptedTextBytes.Length);
                cs.Close();
                rijn.Dispose();
                rijn = null;

                return(Encoding.UTF8.GetString(ms.ToArray()));
            }
            catch (Exception)
            {
                return(null);
            }
        }
예제 #2
0
 /// <summary>
 /// Releases all resources used by the current instance of the
 /// <see cref="SymmetricEncryptor"/> class.
 /// </summary>
 public void Dispose()
 {
     _algorithm.Dispose();
 }
예제 #3
0
 public void Dispose()
 {
     decryptor.Dispose();
     encryptor.Dispose();
     aes.Dispose();
 }