根据我的问题Aesencryption…缺less一个重要的一块 ,我现在已经了解到,我对string创build可逆encryption的假设是有点closures。 我现在有 public static byte[] EncryptString(string toEncrypt, byte[] encryptionKey) { var toEncryptBytes = Encoding.UTF8.GetBytes(toEncrypt); using (var provider = new AesCryptoServiceProvider()) { provider.Key = encryptionKey; provider.Mode = CipherMode.CBC; provider.Padding = PaddingMode.PKCS7; using (var encryptor = provider.CreateEncryptor(provider.Key, provider.IV)) { using (var ms = new MemoryStream()) { using (var cs = new CryptoStream(ms, encryptor, CryptoStreamMode.Write)) { cs.Write(toEncryptBytes, […]