具有最高加密的 7z 命令列:AES-256 + 加密檔名

具有最高加密的 7z 命令列:AES-256 + 加密檔名

我有一個問題。我正在嘗試備份和加密文件,但使用更新的 aes256 或 aes512 加密。

1)我聽說7z預設為aes128,我想使用最好的(aes256...我認為?),我該怎麼做?

這是我的命令:

cd /mnt/MyBackupHardDrive ;

7z a MyFullComputerBackup-AES256.7z -t7z -m0=lzma2:d1024m -mx=9 -aoa -mfb=64 -md=32m -ms=on /home/MyHomeDirectory

2)這是否也會自動加密檔案名稱?

謝謝你盡你所能的幫助!

答案1

可使用 7z 取得 AES 256 加密,並使檔案和檔案名稱僅在使用密碼時可見。我注意到您自己的命令列中缺少重要的“密碼”選項。

我從手冊頁中大量借用了一個範例:

7z a \
  -t7z -m0=lzma2 -mx=9 -mfb=64 \
  -md=32m -ms=on -mhe=on -p'eat_my_shorts' \
   archive.7z dir1

稍微多一點安全的方法是實際將該-p欄位留空,然後 7z 會在實際建立存檔之前提示您輸入密碼。

解釋:

對於那些不熟悉 7z 命令列的人,這裡有一個解釋:

a                   Add (dir1 to archive.7z)
-t7z                Use a 7z archive
-m0=lzma2           Use lzma2 method
-mx=9               Use the '9' level of compression = Ultra
-mfb=64             Use number of fast bytes for LZMA = 64
-md=32m             Use a dictionary size = 32 megabytes
-ms=on              Solid archive = on
-mhe=on             7z format only : enables or disables archive header encryption
-p{Password}        Add a password

測試存檔:

7z l -slt archive.7z可以使用我在下面演示的命令來測試後續存檔:

andrew@illium~/test$ 7z l -slt archive.7z

7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,8 CPUs x64)

Scanning the drive for archives:
1 file, 12919 bytes (13 KiB)

Listing archive: archive.7z


Enter password (will not be echoed):   <-------------
--
Path = archive.7z
Type = 7z
Physical Size = 12919
Headers Size = 247
Method = LZMA2:14 7zAES
Solid = -
Blocks = 1

----------
Path = dir1
Size = 0
Packed Size = 0
Modified = 2017-06-23 14:10:59
Attributes = D_ drwxr-xr-x
CRC = 
Encrypted = -
Method = 
Block = 

Path = dir1/200px-Aum_calligraphy.svg.png
Size = 12663
Packed Size = 12672
Modified = 2015-05-06 07:29:23
Attributes = A_ -rw-r--r--
CRC = 77BD9922
Encrypted = +                    <-------------
Method = LZMA2:14 7zAES:19       <-------------
Block = 0

andrew@illium~/test$ 

請注意密碼的呼叫以及給予加密的符號:7zAES:19 又稱 AES-256(為了清楚起見,我已經在這些點上標記了箭頭)。

注意事項:

  1. 請注意,手冊頁中有一條針對在 Linux 下使用 7z 進行歸檔的特定警告:

    DO NOT USE the 7-zip format for backup purpose on Linux/Unix because :
    - 7-zip does not store the owner/group of the file.
    
  2. 另請注意手冊頁中給出的有關 Linux 下目錄備份的一些限制和解決方法...

相關內容