Linux记事本实现数据加密的实用方案
核心思路
方法一 文件级加密的两种常用做法
gpg --symmetric --cipher-algo AES256 --output note.txt.gpg note.txtgpg --decrypt --output note.txt note.txt.gpggpg --encrypt --recipient [email protected] note.txt(生成 note.txt.gpg)gpg --decrypt --output note.txt note.txt.gpgopenssl enc -aes-256-cbc -salt -in note.txt -out note.txt.encopenssl enc -d -aes-256-cbc -in note.txt.enc -out note.txt方法二 容器级加密与图形化工具
sudo cryptsetup luksFormat /dev/sdXsudo cryptsetup open /dev/sdX mydata → sudo mkfs.ext4 /dev/mapper/mydata → sudo mount /dev/mapper/mydata /mntsudo umount /mnt → sudo cryptsetup close mydataveracrypt --create /path/to/container.volveracrypt /path/to/container.vol /mnt/encveracrypt -d /mnt/enc方法三 便捷工作流与注意事项