toplip:一款十分強(qiáng)大的文件加密解密CLI工具
在市場上能找到許多用來保護(hù)文件的文檔加密工具。我們已經(jīng)介紹過其中一些例如 Cryptomater、Cryptkeeper、CryptGo、Cryptr、Tomb,以及 GnuPG 等加密工具。今天我們將討論另一款叫做 “toplip” 的命令行文件加密解密工具。它是一款使用一種叫做 AES256 的強(qiáng)大加密方法的自由開源的加密工具。它同時(shí)也使用了 XTS-AES 設(shè)計(jì)以保護(hù)你的隱私數(shù)據(jù)。它還使用了 Scrypt,一種基于密碼的密鑰生成函數(shù)來保護(hù)你的密碼免于暴力破解。
優(yōu)秀的特性
相比于其它文件加密工具,toplip 自帶以下獨(dú)特且杰出的特性。
- 非常強(qiáng)大的基于 XTS-AES256 的加密方法。
- 合理的推諉。
- 加密并嵌入文件到圖片(PNG/JPG)中。
- 多重密碼保護(hù)。
- 可防護(hù)直接暴力破解。
- 無可辨識的輸出標(biāo)記。
- 開源(GPLv3)。
安裝 toplip
沒有什么需要安裝的。toplip
是獨(dú)立的可執(zhí)行二進(jìn)制文件。你所要做的僅是從 產(chǎn)品官方頁面 下載新版的 toplip
并賦予它可執(zhí)行權(quán)限。為此你只要運(yùn)行:
chmod +x toplip
使用
如果你不帶任何參數(shù)運(yùn)行 toplip
,你將看到幫助頁面。
./toplip
請?jiān)试S我給你展示一些例子。
為了達(dá)到指導(dǎo)目的,我建了兩個(gè)文件 file1
和 file2
。我同時(shí)也有 toplip
可執(zhí)行二進(jìn)制文件。我把它們?nèi)急4孢M(jìn)一個(gè)叫做 test
的目錄。
加密/解密單個(gè)文件
現(xiàn)在讓我們加密 file1
。為此,運(yùn)行:
./toplip file1 > file1.encrypted
這行命令將讓你輸入密碼。一旦你輸入完密碼,它就會加密 file1
的內(nèi)容并將它們保存進(jìn)你當(dāng)前工作目錄下一個(gè)叫做 file1.encrypted
的文件。
上述命令行的示例輸出將會是這樣:
This is toplip v1.20 (C) 2015, 2016 2 Ton Digital. Author: Jeff Marrison A showcase piece for the HeavyThing library. Commercial support available Proudly made in Cooroy, Australia. More info: https://2ton.com.au/toplip file1 Passphrase #1: generating keys...Done
Encrypting...Done
為了驗(yàn)證文件是否的確經(jīng)過加密,試著打開它你會發(fā)現(xiàn)一些隨機(jī)的字符。
為了解密加密過的文件,像以下這樣使用 -d
參數(shù):
./toplip -d file1.encrypted
這行命令會解密提供的文檔并在終端窗口顯示內(nèi)容。
為了保存文檔而不是寫入到標(biāo)準(zhǔn)輸出,運(yùn)行:
./toplip -d file1.encrypted > file1.decrypted
輸入正確的密碼解密文檔。file1.encrypted
的所有內(nèi)容將會存入一個(gè)叫做 file1.decrypted
的文檔。
請不要用這種命名方法,我這樣用僅僅是為了便于理解。使用其它難以預(yù)測的名字。
加密/解密多個(gè)文件
現(xiàn)在我們將使用兩個(gè)分別的密碼加密每個(gè)文件。
./toplip -alt file1 file2 > file3.encrypted
你會被要求為每個(gè)文件輸入一個(gè)密碼,使用不同的密碼。
上述命令行的示例輸出將會是這樣:
This is toplip v1.20 (C) 2015, 2016 2 Ton Digital. Author: Jeff Marrison A showcase piece for the HeavyThing library. Commercial support available Proudly made in Cooroy, Australia. More info: https://2ton.com.au/toplip
file2 Passphrase #1 : generating keys...Done
file1 Passphrase #1 : generating keys...Done
Encrypting...Done
上述命令所做的是加密兩個(gè)文件的內(nèi)容并將它們保存進(jìn)一個(gè)單獨(dú)的叫做 file3.encrypted
的文件。在保存中分別給予各自的密碼。比如說如果你提供 file1
的密碼,toplip
將復(fù)原 file1
。如果你提供 file2
的密碼,toplip
將復(fù)原 file2
。
每個(gè) toplip
加密輸出都可能包含最多四個(gè)單獨(dú)的文件,并且每個(gè)文件都建有各自獨(dú)特的密碼。由于加密輸出放在一起的方式,一下判斷出是否存在多個(gè)文檔不是一件容易的事。默認(rèn)情況下,甚至就算確實(shí)只有一個(gè)文件是由 toplip
加密,隨機(jī)數(shù)據(jù)都會自動加上。如果指定了多于一個(gè)文件,每個(gè)都有自己的密碼,那么你可以有選擇性地獨(dú)立解碼每個(gè)文件,以此來否認(rèn)其它文件存在的可能性。這能有效地使一個(gè)用戶在可控的暴露風(fēng)險(xiǎn)下打開一個(gè)加密的捆綁文件包。并且對于敵人來說,在計(jì)算上沒有一種低廉的辦法來確認(rèn)額外的秘密數(shù)據(jù)存在。這叫做“合理的推諉”,是 toplip 著名的特性之一。
為了從 file3.encrypted
解碼 file1
,僅需輸入:
./toplip -d file3.encrypted > file1.encrypted
你將會被要求輸入 file1
的正確密碼。
為了從 file3.encrypted
解碼 file2
,輸入:
./toplip -d file3.encrypted > file2.encrypted
別忘了輸入 file2
的正確密碼。
使用多重密碼保護(hù)
這是我中意的另一個(gè)炫酷特性。在加密過程中我們可以為單個(gè)文件提供多重密碼。這樣可以保護(hù)密碼免于暴力嘗試。
./toplip -c 2 file1 > file1.encrypted
這里,-c 2
代表兩個(gè)不同的密碼。上述命令行的示例輸出將會是這樣:
This is toplip v1.20 (C) 2015, 2016 2 Ton Digital. Author: Jeff Marrison A showcase piece for the HeavyThing library. Commercial support available Proudly made in Cooroy, Australia. More info: https://2ton.com.au/toplip
file1 Passphrase #1: generating keys...Done
file1 Passphrase #2: generating keys...Done
Encrypting...Done
正如你在上述示例中所看到的,toplip
要求我輸入兩個(gè)密碼。請注意你必須提供兩個(gè)不同的密碼,而不是提供兩遍同一個(gè)密碼。
為了解碼這個(gè)文件,這樣做:
$ ./toplip -c 2 -d file1.encrypted > file1.decrypted
This is toplip v1.20 (C) 2015, 2016 2 Ton Digital. Author: Jeff Marrison A showcase piece for the HeavyThing library. Commercial support available Proudly made in Cooroy, Australia. More info: https://2ton.com.au/toplip
file1.encrypted Passphrase #1: generating keys...Done
file1.encrypted Passphrase #2: generating keys...Done
Decrypting...Done
將文件藏在圖片中
將一個(gè)文件、消息、圖片或視頻藏在另一個(gè)文件里的方法叫做隱寫術(shù)。幸運(yùn)的是 toplip
默認(rèn)包含這個(gè)特性。
為了將文件藏入圖片中,像如下所示的樣子使用 -m
參數(shù)。
$ ./toplip -m image.png file1 > image1.png
This is toplip v1.20 (C) 2015, 2016 2 Ton Digital. Author: Jeff Marrison A showcase piece for the HeavyThing library. Commercial support available Proudly made in Cooroy, Australia. More info: https://2ton.com.au/toplip
file1 Passphrase #1: generating keys...Done
Encrypting...Done
這行命令將 file1
的內(nèi)容藏入一張叫做 image1.png
的圖片中。
要解碼,運(yùn)行:
$ ./toplip -d image1.png > file1.decrypted This is toplip v1.20 (C) 2015, 2016 2 Ton Digital. Author: Jeff Marrison A showcase piece for the HeavyThing library. Commercial support available Proudly made in Cooroy, Australia. More info: https://2ton.com.au/toplip
image1.png Passphrase #1: generating keys...Done
Decrypting...Done
增加密碼復(fù)雜度
為了進(jìn)一步使文件變得難以破譯,我們可以像以下這樣增加密碼復(fù)雜度:
./toplip -c 5 -i 0x8000 -alt file1 -c 10 -i 10 file2 > file3.encrypted
上述命令將會要求你為 file1
輸入十條密碼,為 file2
輸入五條密碼,并將它們存入單個(gè)叫做 file3.encrypted
的文件。如你所注意到的,我們在這個(gè)例子中又用了另一個(gè) -i
參數(shù)。這是用來指定密鑰生成循環(huán)次數(shù)。這個(gè)選項(xiàng)覆蓋了 scrypt
函數(shù)初始和最終 PBKDF2 階段的默認(rèn)循環(huán)次數(shù) 1。十六進(jìn)制和十進(jìn)制數(shù)值都是允許的。比如說 0x8000
、10
等。請注意這會大大增加計(jì)算次數(shù)。
為了解碼 file1
,使用:
./toplip -c 5 -i 0x8000 -d file3.encrypted > file1.decrypted
為了解碼 file2
,使用:
./toplip -c 10 -i 10 -d file3.encrypted > file2.decrypted
參考 toplip
官網(wǎng)以了解更多關(guān)于其背后的技術(shù)信息和使用的加密方式。
我個(gè)人對所有想要保護(hù)自己數(shù)據(jù)的人的建議是,別依賴單一的方法??偸鞘褂枚喾N工具/方法來加密文件。不要在紙上寫下密碼也不要將密碼存入本地或云。記住密碼,閱后即焚。如果你記不住,考慮使用任何了信賴的密碼管理器。
- KeeWeb – An Open Source, Cross Platform Password Manager
- Buttercup
- Titan – A Command line Password Manager For Linux
今天就到此為止了,更多好東西后續(xù)推出,請保持關(guān)注。
順祝時(shí)祺!