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

ASP.NET
赫赫大名的A*寻路算法(vb.net版本)
asp.net(c#)下Jmai去说明 使用与下载
[原创]完美解决Could not load file or assembly ''AjaxPro.2'' or one of its dependencies. 拒绝访问。
asp.net下gridview 批量删除的实现方法
用CSS实现图片倾斜 只支持IE
.net get set用法小结
vs 不显示行号的操作方法
ASP.NET页面进行GZIP压缩优化的几款压缩模块的使用简介及应用测试!(附源码)
ASP.Net不执行问题一解
asp.net 无限分类
让VS2008对JQuery语法的智能感知更完美一点
扩展方法ToJSON() and ParseJSON()
asp.net下PageMethods使用技巧
Linq to SQL Delete时遇到问题的解决方法
实现ASP.NET多文件上传程序代码
ASP.NET AJAX 1.0 RC开发10分钟图解
asp.net get set用法
ASP.NET下使用WScript.Shell执行命令
asp.net2.0实现邮件发送(测试成功)
Asp.net 无限级分类实例代码

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 149 ::
收藏到网摘: 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;