English 中文(简体)
GPG Error Code 2
原标题:GPG Error Code 2

结果,全球公益物总会退回2个。 我的法典如下:

$cmd = "/usr/bin/gpg -a --recipient $to -e -o $outfile $infile";

外部档案是加密数据的书面档案,档案中是未经加密的数据。

I don t know why this is happening. Can anyone please tell me what s wrong. Thanks.

最佳回答

GPG正在问,你是否希望继续使用未经签名的钥匙进行加密。 由于用户无法输入<代码> Y 产生错误。

页: 1

问题回答

See this message: http://lists.gnupg.org/pipermail/gnupg-users/2008-January/032410.html

It appears to be a permission problem. gpg is trying to access a directory that it can t have access to, so it fails with a fatal error. (error code 2)

您可以确定,具体指明一份homedir指令,其中附有一份可按gpg加以解释的目录。 与此类似:

$cmd = "/usr/bin/gpg -a --recipient $to -e -o $outfile $infile --homedir /path/to/dir";

信息:man gpg:

--homedir directory
Set the name of the home directory to directory

If this option is not used it defaults to "~/.gnupg". It does not make sense to use this in a options file. This also overrides the environment variable $GNUPGHOME.

您还可能希望更清晰地补充值得信赖的关键清单:

gpg.exe --edit-key KEY_NAME
trust
5 (level of trust)
Y
Save

I ve had some problems of --always-trust parameter not functioning properly on XP windows, this helped me solve the problem.

我也存在同样的问题,但对于脱节的指挥而言。

At first and general, you can get the error message by redirecting stderr to stdout.

$cmd = "/usr/bin/gpg -a --recipient $to -e -o $outfile $infile 2>&1";

Then you can modify gpg s parameters to suit your needs. Because I had a files encrypted with a key with pass phrase I had to add several parameters.

我开始发言。

gpg  -o $out -d $path

But it complained, that it can not open tty, then with --no-tty it outputs some other errors and finally the command for decoding files with key with pass phrase is

gpg --batch --passphrase $pass_phrase --no-tty -o $outfile -d $path_to_encoded_file

我希望这能帮助某人。





相关问题
Extend Contacts application on Android to provide encryption

I want to encrypt individual contacts stored by the Contacts application on Android based on user s preference. So, I am thinking I ll have to hook/extend the Contacts application before the it stores ...

Make md5 strong

Im making a website that will intergrate with game that only support md5 hashing metod (atm). Which ofc is not especially safe anymore. But how could i make it stronger? Should I just generate long ...

How to Pack/Encrypt/Unpack/Decrypt a bunch of files in Java?

I m essentially trying to do the following on a Java/JSP-driven web site: User supplies a password Password is used to build a strongly-encrypted archive file (zip, or anything else) containing a ...

Thread & Queue vs Serial performance

I though it ll be interesting to look at threads and queues, so I ve written 2 scripts, one will break a file up and encrypt each chunk in a thread, the other will do it serially. I m still very new ...

Convert PHP encryption code to C#

I m trying to convert this piece of code from PHP to C#. It s part of a Captive Portal. Could somebody explain what it does? $hexchal = pack ("H32", $challenge); if ($uamsecret) { $newchal = ...

Encryption: how to have 1 iv despite multiple fields

I ve been stuck trying to arrive at a best solution for this for a while. I know that an initialization vector has to be unique for each item being encrypted. So if I m encrypting an address and I ...

热门标签