看板 java 關於我們 聯絡資訊
※ 引述《prodigywu (Soccer Fever)》之銘言: : 我希望server client彼此互相傳遞訊息前 : 都先將訊息加密傳出去 : 對方收到後再解密 : 但是有點疑惑需要解答 : 我想用JCE的DES來加密 : 那我勢必要把key送給對方 : 可是要怎麼樣才能把key安全的送給對方呢? : 第二個問題是說 : 產生key的過程會很耗時間嗎? : 我的server跟client會大量地互相交換訊息(字串的長度都不會很大) : 如果每傳一個訊息就產生一個新的key : overhead會不會很大呢? : 感謝回答~ 我以前的做法是這樣的: 1. Client connect to Server. 2. Server generate a public-private RSA key pair (PublicKeyA, PrivateKeyA) 3. Server send the public (PublicKeyA) key to client in PLAIN format 4. Client generate a public-private RSA key pair (PublicKeyB, PrivateKeyB) 5. Client encrypt the PublicKeyB with PublicKeyA 6. Client send the encrypted key to Server 7. Server get a secured PublicKeyB by decrypt the received data with its own PrivateKeyA 8. Server generate a DES key 9. Server encrypt the DES key with PublicKeyB 10. Server send the encrypted DES key to Client 11. Client than get a secured DES key 然後每半小時或十分鐘利用已交換的 RSA key 去重新確認新的 DES key 便可 -- 勁過呂布的勁過相簿... http://www.pixnet.net/superlubu 亂七八糟的,不好意思 m(_ _)m -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 147.8.130.225
wctang:如果C/S彼此完全沒信任資訊,如何相信PubKeyA是可信任的? 03/11 11:43
superlubu:沒有 :P 就算是用 cert 去 verify 還是可能會在中繼被騙 03/11 11:49
pao0111:推這篇... 03/12 13:22