使用gpg-agent

时间:2018-07-03 15:31:02

标签: node.js macos gnupg

这个问题曾经被问过,但是答案不再起作用了(或者至少对我而言)。

使用NodeJS:

exec(`gpg2 --batch --yes --passphrase-file ${passphrase} -d ${textFile} > ${decryptedFile}`)

尝试运行gpg2时出现此错误:

/bin/sh: gpg2: command not found

如果我更改为gpg,它可以工作,但是总是要求我输入密码。

在Ubuntu中,我使用gpg-agent保存密码并使用gpg2没问题。

我已经在Mac上尝试过此操作:

$ brew install gnupg gnupg2
Warning: gnupg 2.2.8 is already installed and up-to-date
To reinstall 2.2.8, run `brew reinstall gnupg`
$ gpg-agent --version
gpg-agent (GnuPG) 2.2.8
libgcrypt 1.8.3
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

0 个答案:

没有答案