OpenSSL 檔案加密解密

. . . .
.

加密
openssl enc -e -aes256 -in pwd -out pwd
解密
openssl enc -d -aes256 -in pwd -out pwd
測試
[email protected]:~/$ cat file 
This is a file.
[email protected]:~/$ openssl enc -e -aes256 -in file -out file_lock
enter aes-256-cbc encryption password:
Verifying - enter aes-256-cbc encryption password:
[email protected]:~/$ ls
file  file_lock
[email protected]:~/$ openssl enc -d -aes256 -in file_lock -out file_unlock
[email protected]:~/$ ls
file  file_lock  file_unlock
[email protected]:~/$ cat file_unlock 
This is a file.
[email protected]:~/$ 

參考資料: 使用 OpenSSL 或 GnuPG 加密檔案與目錄,用密碼上鎖保護機密資料



Tags: Linux