利用openssl加密解密tar包

将文件夹package打成tar包 package.tar.gz 并加密
密码是 password
tar -czf - package | openssl des3 -salt -k password -out package.tar.gz
加密的tar包只能在Linux上解密,无法在Windows上使用。

解密tar包并且解压缩
openssl des3 -d -k password -salt -in package.tar.gz | tar xzf -
其中 -k password 可以不使用,这样执行完命令后会提示你输入,加上 -k参数可运用在程序中,这样可自动设置密码。

猜你喜欢

转载自blog.csdn.net/u011285208/article/details/87854596