【发布时间】:2026-01-15 20:10:02
【问题描述】:
我需要加密一个文件,发送给另一个人,然后他只能使用 shell 解密它。
我一般用openssl命令加密文件:openssl enc -aes-256-cbc -salt -in [filename] -out [file out name] -pass file:[direct path to key file],然后发送文件。
然后其他人将使用openssl 命令再次解密文件:openssl enc -d -aes-256-cbc -in [encrypted file] -out [file out name] -pass file:[direct path to key file]
我会使用os.system 来执行此操作,但我觉得必须有另一种方法来使用 python 加密文件,然后可以在 shell 端解密。
【问题讨论】:
-
看看this问题
标签: python encryption cryptography openssl