public void createFile(string strContent, string userName, string downloadName)
        {
            byte[]   key, iv;
            string[] fileName = filePath.Split('\\');
            string   FileName = fileName[fileName.Length - 1];

            //加密文件内容
            AesHelp.GenKeyIV(out key, out iv);
            AesHelp.EncryptString(strContent, AppDomain.CurrentDomain.BaseDirectory + "/files/" + userName + "_" + FileName, key, iv);
            FileTable file = new FileTable();

            file.UploadId = getID(userName);
            file.FileName = FileName;
            file.FilePath = AppDomain.CurrentDomain.BaseDirectory + "/files/" + userName + "_" + FileName;

            file.DownloadId = getID(downloadName);
            file.SessionKey = saveSessionKey(key, iv, downloadName, FileName);
            saveFile(file);
        }
        private void decrypt(string priPath, string sessionPath, string filePath, string downloadPath)
        {
            string privateKey, sessionKey;

            byte[] enkey, eniv;
            using (StreamReader sr = new StreamReader(sessionPath))
            {
                sessionKey = sr.ReadToEnd();
            }
            string[] s = sessionKey.Split(',');
            enkey = Convert.FromBase64String(s[0]);
            eniv  = Convert.FromBase64String(s[1]);

            using (StreamReader sr = new StreamReader(priPath))
            {
                privateKey = sr.ReadLine();
            }
            //解密会话密钥
            RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();

            rsa.FromXmlString(privateKey);
            byte[] key = rsa.Decrypt(enkey, false);
            byte[] iv  = rsa.Decrypt(eniv, false);
            //解密文件
            string[] fileName  = filePath.Split('/');
            string   downFile  = downloadPath + "\\" + fileName[fileName.Length - 1];
            string   deContent = AesHelp.DescyrptString(filePath, downFile, key, iv);

            using (StreamWriter sw = new StreamWriter(downFile))
            {
                sw.WriteLine(deContent);
            }
            //this.txt.Text = AesHelp.DescyrptString("../../files/" + userName + "_" + FileName, decrypt, iv);
            //string asd = Convert.ToBase64String(iv);//存储iv
            //this.txt.Text = Convert.ToBase64String(iv);
            //解密key,iv  byte[] ds = Convert.FromBase64String(asd);
        }