本文介绍了gpg解密失败,没有密钥错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个gpg .key文件,用作解密.dat.pgp文件的密码。加密的.data.pgp文件在一个使用相同的.key文件的服务器上成功解密,使用以下命令

  cat xxx_gpg.key | / usr / bin / gpg --batch --quiet -o xxx.dat --passphrase-fd O -d xxx.dat.pgp 

但是,当我将相同的密钥移动到另一个服务器xxx_gpg.key并运行上面的命令时,我收到以下错误 -

  gpg:解密失败:没有密钥

编辑:



我发现 gpg --list-secret-keys 在服务器上返回一些数据,但没有其他结果返回服务器。



我们如何配置密钥

解决方案

看起来像秘密密钥不在另一台机器上,所以即使有正确的密码(从文件中读取)也不会工作。



这些选项应该可以工作,




  • 复制钥匙扣(可能只需要密钥密钥,但公共环路是公开的)到另一台机器

  • 或导出密钥&然后将其导入另一台机器上



man gpg

也许




- 密钥环文件

将文件添加到当前的键盘列表中。如果文件以波形符号
和斜线开头,那么它们将被$ HOME目录替换。如果file-
名称不包含斜杠,则假定在GnuPG home
目录(〜/ .gnupg中,如果--homedir或$ GNUPGHOME不被使用) p>

请注意,这将添加到当前列表的键盘。如果意图是
单独使用指定的密钥环,请使用 - keyring 以及 - no-default-keyring



- 密钥钥匙文件

- keyring ,但用于密钥匙扣。



I have a gpg .key file that is used as passphrase for decrypting a .dat.pgp file. The encrypted .data.pgp file gets successfully decrypted on one server with same .key file using following command

cat xxx_gpg.key | /usr/bin/gpg --batch --quiet -o xxx.dat --passphrase-fd O -d xxx.dat.pgp

But, when I move same key to another server xxx_gpg.key and run same above command, I get following error -

gpg: decryption failed: No secret key

EDIT:

I find that gpg --list-secret-keys returns some data on server where it works but no results are returned for other server.

How can we configure secret key

解决方案

Looks like the secret key isn't on the other machine, so even with the right passphrase (read from a file) it wouldn't work.

These options should work, to

  • Either copy the keyrings (maybe only secret keyring required, but public ring is public anyway) over to the other machine
  • Or export the secret key & then import it on the other machine

A few useful looking options from man gpg:

And maybe

这篇关于gpg解密失败,没有密钥错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 17:19
查看更多