1

我正在尝试使用 OpenGPG,并且在尝试解密某些内容时它会打开密码提示。现在我正在尝试自动运行它,因此没有人输入密码。所以我的问题是你如何将密码传递给这个由我从批处理文件运行的exe打开的新提示。我查看了 gpg2.exe -help 并且如果有人熟悉 OpenGPG 或者如果我可以运行命令将密码传递到新提示符,则无法将密码作为参数传递,那就太好了。

gpg2.exe -o output.txt -d series.txt.gpg
4

3 回答 3

1

经过多次尝试使其正常工作后,我终于在http://linux.die.net/man/1/gpg2上查看了 gpg2.exe 的手册,并在添加了命令行参数 --batch --passphrase 之后被应用程序接受。

不这样做会导致用户被提示。

希望这对将来尝试进行此黑客攻击的任何人有所帮助。

于 2014-11-28T11:27:28.697 回答
0

GnuPG 提供了多种方式来以非交互方式传递密码。使用该参数--passphrase [password]可能是最简单的一种,取决于您的用例,其他参数也可能感兴趣(例如,如果您不想在应用程序代码中存储密码)。

来自man gpg

   --passphrase-fd n
          Read the passphrase from file descriptor n. Only the first line will be read
          from file descriptor n. If you use 0 for n, the passphrase will be read from
          STDIN. This can only be used if only one passphrase is supplied.

   --passphrase-file file
          Read  the  passphrase  from file file. Only the first line will be read from
          file file. This can only be used if only one passphrase is  supplied.  Obvi-
          ously,  a  passphrase  stored in a file is of questionable security if other
          users can read this file. Don't use this option if you can avoid it.

   --passphrase string
          Use string as the passphrase. This can only be used if only  one  passphrase
          is  supplied.  Obviously,  this is of very questionable security on a multi-
          user system. Don't use this option if you can avoid it.
于 2013-10-21T22:29:56.717 回答
0

echo password | gpg2.exe -o output.txt -d series.txt.gpg

于 2013-10-21T18:38:25.060 回答