当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > .NET中加密和解密的实现方法 3

ASP.NET
asp+的页面指示标识
亲密接触ASP+(1)
亲密接触ASP+(2)
使用纯粹的asp+语言制作的栏目管理(二)
使用纯粹的asp+语言制作的栏目管理(三)
利用asp+的独特的底层操作的功能实现对Pop服务器的存取(实现了asp+收pop信件的功能)
C#中的函数重载
开发者面临的.Net挑战(二)
ASP中是如何使用存储过程的
深入讲解 ASP+ 验证(一)
深入讲解 ASP+ 验证(二)
深入讲解 ASP+ 验证(三)
深入讲解 ASP+ 验证(四)
ASP.NET强大的性能(一)
ASP.NET强大的性能(二)
ASP.NET多语言支持
ASP.NET升级能力探讨(一)
ASP.NET升级能力探讨(二)
ASP.NET升级能力探讨(三)
ASP.NET超凡的代码控制(一)

ASP.NET 中的 .NET中加密和解密的实现方法 3


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 129 ::
收藏到网摘: n/a

//使用客户端的公共密钥加密对称密钥并发送给客。encryptAndSendSymmetricKey(client, rsa, symm);//使用对称密钥加密信息并发送encryptAndSendSecretMessage(client, symm, msg);}catch (Exception e){Console.WriteLine(e.Message);Console.WriteLine(e.StackTrace);}finally{try{client.Close();listener.Stop();}catch{//错误}Console.WriteLine("Server exiting...");}}private static RSAParameters getClientPublicKey(TcpClient client){// 从字节流获取串行化的公共密钥,通过串并转换写入类的实例byte[] buffer = new byte[RSA_KEY_SIZE_BYTES];NetworkStream ns = client.GetStream();MemoryStream ms = new MemoryStream();BinaryFormatter bf = new BinaryFormatter();RSAParameters result;int len = 0;int totalLen = 0;