cryptography
目錄
- ECB
- CBC
- CFB
- OFB
- CTR
- RSA
- OAEP
- 參考資料以及繪圖軟體
ECB
說明 : 明文、密文為 1 對 1
加密(Encrypt) :
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
解密(Decrypt) :
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- block 是個別加密
- 會被重送攻擊
- block 可以被調位置
- 安全等級低 : 因為密文同等同於明文也是相同訊息
補充 – 重送攻擊 :
中間人攻擊的低階版本
主要是在不同區塊產生分叉之後,因為分開之後 2 方都還擁有分開之前的資料
所以可以在 2 邊做一樣的交易,但因為分開之後各自經營的客戶與交易並不會相互交換訊息,所以可以在 B 處拿到東西並且用一樣的憑證在 C 處拿到東西
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
另一個簡單的舉例 : Alice 想向 Bob 證明自己的身分所以提供了密碼,但 Eve 竊聽了對話並保留了密碼,之後 Eve(冒充 Alice)連接到 Bob,Eve 可以傳送從 Bob 接受的最後一個對談中讀取的 Alice 的密碼讓 Eve 得到存取權限。
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
CBC
說明 : 在 ECB 加密的基礎上增加 XOR 運算
加密(Encrypt) :
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
解密(Decrypt) :
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- 一定要上一個 block 加密完成才能加密下一個 block
- 當某一個 block 的 bit 出錯時,只會影響該 block 以及下一個 block
- 如果 block 被丟失時,則會讓後續所有的 block 都被影響
補充 – 初始化向量 :
電腦隨機生成相同大小的密文區塊
CFB
說明 : 不同順序的 CBC 加密
加密(Encrypt) :
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
解密(Decrypt) :
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
補充 – CFB 的缺陷
如果想要指定直接加密第 x 個明文,需要從頭開始加密
OFB
說明 : 彌補 CFB 加密的缺陷,只需要重複加密 (x - 1) 次初始化向量
加密(Encrypt) :
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
解密(Decrypt) :
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
CTR
說明 : 節省 OFB 加密的運算效率,讓加密過程不需重複 (x - 1) 次加密,改成使用 counter(計數器) 取代初始化向量
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- 可同步加密解密
- 丟失任一 block 均不會影響其他 block
補充 – CTR 小重點
不可忽略區塊加密
RSA
說明 : 目前常見的加密方法,運用質因數運算
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
解密流程
運用蒙哥馬利複除法
以下以 為例, 互值
小註解 :
- 收到 已知
- 各名詞解釋
- : 密文
- : RSA 公鑰中的模數
- : RSA 私鑰中的解密指數
- : 模數 的倍數,用於處理模運算
- : 明文
補充–更詳盡的資料
https://hackmd.io/@Koios/RSA
OAEP
說明 : 一般來說會結合 RSA 加密
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- 是 RSA 加密中的位數
- 是協議中的固定整數
- 是 位長的明文訊息
- 為隨機預言(oracle)
- 是 XOR
運作流程(加密)
- 用 位長的 使消息填滿到 位的長度
- 隨機生成 位長的 串
- 用 將 位長的 擴展到 位長
- 將 位長的 縮至 位長
之後可以運用 RSA 加密編碼的消息,利用 OAEP 避免 RSA 加密後的確定性
解密流程
- 恢復 為
- 恢復消息 為
參考資料以及繪圖軟體