GPG 对称加密:命令行上的密码短语

问题:

你想使用 GnuPG 的 –symmetric 加密,但不是交互式输入密码,而是想使用带有明文密码的命令行参数。

解决方案

Use --batch --yes --passphrase <passphrase>:

gpg_symmetric.sh
gpg --symmetric --batch --yes --passphrase 12345 <input file>

注意这可能不安全,因为查找运行程序的命令行参数比拦截交互式输入对话框的输入要容易得多。因此,仅在必要时使用此策略。


Check out similar posts by category: Cryptography