花了6小时,弄出来的代码。网上的是PHP代码
public static string DecodeUserInfo(string raw, string signature,string encryptedData, string iv) { byte[] iv2 = Convert.FromBase64String(iv); if (string.IsNullOrEmpty(encryptedData)) return ""; Byte[] toEncryptArray = Convert.FromBase64String(encryptedData); System.Security.Cryptography.RijndaelManaged rm = new System.Security.Cryptography.RijndaelManaged { Key = Convert.FromBase64String(session_key), IV = iv2, Mode = System.Security.Cryptography.CipherMode.CBC, Padding = System.Security.Cryptography.PaddingMode.PKCS7 }; System.Security.Cryptography.ICryptoTransform cTransform = rm.CreateDecryptor(); Byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length); return Encoding.UTF8.GetString(resultArray); }