用aes加密管道数据
aes-pipe的Python项目详细描述
AES管道
此应用程序/库用于加密管道数据,主要开发为 与limittar一起使用以节省空间 使用管道进行数据加密以消除临时存储 潜在的大型存档和加密数据。
要求
- Python3.4+
- 密码
安装
从python包索引:
pip install aes-pipe
或下载并运行:
python3 setup.py install
用法
使用-h
参数获取帮助:
aes-pipe -h
加密数据
如果未指定密钥命令,则提示用户输入密码短语。
cat something.tar | aes-pipe > encrypted_tar
跨多个蓝光光盘加密文件
find /path/photos/ -print0 > files
limittar -0 -i files -l remaining1 -s 25025314784 | aes-pipe | cdrskin -v driveropts=burnfree -tao dev=/dev/sr0 -
limittar -0 -i remaining1 -l remaining2 -s 25025314784 | aes-pipe | cdrskin -v driveropts=burnfree -tao dev=/dev/sr0 -
...
由于剩余的文件列表在加密结束前输出,因此 光盘可以一次写入。
请注意,aes-pipe.py在 这种情况需要计算成焦油的大小极限。
从磁盘解密文件
使用上例中创建的蓝光光盘,可以 为每张光盘运行。
cat /dev/sr0 | aes-pipe -d | tar -xf -
文件将以其原始路径输出。
仅解密特定的文件和目录
这对于从备份中恢复已删除的项目很有用。 在找到项目之前,需要在每个存储区域运行此操作 跨越加密数据的范围。
cat /dev/sdX | aes-pipe -d | tar -C path/to/output/dir/ -xf - "path/of/dir in archive/" path/of/a_file.png
使用gpg公钥进行加密
输出加密密钥文件
cat something.tar | aes-pipe -c "gpg --output encrypted_key.gpg --encrypt --recipient email@example.com" > encrypted_tar
cat something.tar | aes-pipe -c "gpg --output encrypted_key.gpg --encrypt --recipient email@example.com" > encrypted_tar
这将加密密钥和nonce管道传输到gpg应用程序。这也意味着 nonce不在加密输出的前面,这意味着输出 数据大小与输入数据大小相同。
使用加密密钥文件
cat encrypted_tar | aes-pipe -d -c "gpg --decrypt encrypted_key.gpg" > something.tar
cat encrypted_tar | aes-pipe -d -c "gpg --decrypt encrypted_key.gpg" > something.tar