不管是数据库备份还是文件备份,其中都有可能会有敏感数据,所以对备份加密是对敏感数据保护的最后防线。
使用GnuPG加密
gpg -c test.txt
提示要求输入2次密码,即生成加密后的文件test.txt.gpg
加密后的文件是无法直接读取其中数据的
解密
gpg -d test.txt.gpg >test.txt
使用OpenSSL加密
使用 -des-ede3-cbc算法加密为例
openssl enc -des-ede3-cbc -in test.txt -out test.txt.enc
提示要求输入2次密码
解密
openssl enc -d -des-ede3-cbc -in test.txt.enc -out test.txt.x