2017-09-26 75 views
-1

當我使用openssl加密一個文件時,使用相同的pubkey.pem,但密文是不同的?使用openssl加密文件,使用相同的pubkey.pem密文是不同的?

[email protected]:~/extremelyhardRSA# openssl rsautl -encrypt -pubin -inkey pubkey.pem -in test.txt -out flag.enc1 
[email protected]:~/extremelyhardRSA# openssl rsautl -encrypt -pubin -inkey pubkey.pem -in test.txt -out flag.enc2 
[email protected]:~/extremelyhardRSA# diff flag.enc1 flag.enc2 

二進制文件flag.enc1flag.enc2不同。

command picture

回答

0

基本上,密文應該總是看起來是隨機的輸出。所以兩次加密的消息不會產生相同的密文。如果你得到相同的密文,它會泄露信息。它發生在RSA使用的掩碼函數和填充函數中。

+0

謝謝!我知道了。 –

相關問題