freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

net中加密和解密的實現(xiàn)方法-閱讀頁

2024-08-23 13:19本頁面
  

【正文】 CryptoStream(ns, transform, )。(msgAsBytes, 0, )。 } } 客戶端的工作流程是:   建立和發(fā)送公共密鑰給服務(wù)器?! ?解密該對稱密鑰并將它作為私有的不對稱密鑰?! 〈a如下:namespace {public class CryptoClient {private const int RSA_KEY_SIZE_BITS = 1024。private const int TDES_KEY_SIZE_BITS = 192。private const int TDES_IV_SIZE_BYTES = 128。string host。SymmetricAlgorithm symm。if (!=2){(USAGE)。}try{host = args[0]。 }catch{(USAGE)。}try //連接{client = new TcpClient()。}catch(Exception e){()。return。rsa = new RSACryptoServiceProvider()。sendPublicKey((false),client)。 = TDES_KEY_SIZE_BITS。extractSymmetricKeyInfo(rsa, symm, ms)。}catch(Exception e){()。}finally{try{()。BinaryFormatter bf = new BinaryFormatter()。}private static MemoryStream getRestOfMessage(TcpClient client){//獲取加密的對稱密鑰、初始化矢量、秘密信息。 NetworkStream ns = ()。int len=0。} = 0。}private static void extractSymmetricKeyInfo(RSACryptoServiceProvider rsa,SymmetricAlgorithm symm,MemoryStream msOrig) {MemoryStream ms = new MemoryStream()。(buffer,0,)。// 獲取TDES初始化矢量buffer = new byte[TDES_IV_SIZE_BYTES]。 = (buffer,false)。int len = (buffer,0,)。ICryptoTransform transform =(,)。(buffer, 0, len)。// 內(nèi)存流現(xiàn)在是解密信息,是字節(jié)的形式,將它轉(zhuǎn)換為字符串 = 0。()。(The host sent me this secret message:)。 } } }   結(jié)論  使用對稱算法加密本地數(shù)據(jù)時比較適合。需要將數(shù)據(jù)通過網(wǎng)絡(luò)發(fā)送時,首先使用接收的公共不對稱密鑰加密對稱密鑰。盡管文章保證只有某個私有密鑰可以解密相應(yīng)公共密鑰加密的信息,但是它沒有保證是誰發(fā)送的公共密鑰,發(fā)送者也可能是假的。
點(diǎn)擊復(fù)制文檔內(nèi)容
環(huán)評公示相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1