悟空-简单就好
.net企业级应用研究

考虑最复杂的情况
开发出最简单的实现


Word文档-资料管理系统!

导航

 

花了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);
       
    }

 

posted on 2017-01-07 20:52  新悟空  阅读(4385)  评论(1编辑  收藏  举报