[.net中加密算法].NET中加密和解密的实现方法 3

时间:2014-03-24  来源:安全加密  阅读:
//使用客户端的公共密钥加密对称密钥并发送给客。
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;

[.net中加密算法].NET中加密和解密的实现方法 3

http://m.bbyears.com/aspjiaocheng/5092.html

推荐访问:
相关阅读 猜你喜欢
本类排行 本类最新