我有一个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 :
- 导出 导出所有所有键盘的键(默认键盘键和通过选项键入键$ key $ / code)的),或至少提供一个名称,给定的名称。新的密钥环向STDOUT或写入带有选项 - output 的文件。与 - 护甲一起使用邮寄这些密钥。
-export-secret-keys 与 - 导出相同,但是导出密钥。
- 导入 - 快速导入 导入/合并键。这将给定的键添加到密钥环。快速版本目前只是一个同义词。
也许
- 密钥环文件 将文件添加到当前的键盘列表中。如果文件以波形符号和斜线开头,那么它们将被$ 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.pgpBut, 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 keyEDIT:
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:
--export Either export all keys from all keyrings (default keyrings and those registered via option --keyring), or if at least one name is given, those of the given name. The new keyring is written to STDOUT or to the file given with option --output. Use together with --armor to mail those keys.
--export-secret-keys Same as --export, but exports the secret keys instead.
--import --fast-import Import/merge keys. This adds the given keys to the keyring. The fast version is currently just a synonym.
And maybe
--keyring file Add file to the current list of keyrings. If file begins with a tilde and a slash, these are replaced by the $HOME directory. If the file‐ name does not contain a slash, it is assumed to be in the GnuPG home directory ("~/.gnupg" if --homedir or $GNUPGHOME is not used).
Note that this adds a keyring to the current list. If the intent is to use the specified keyring alone, use --keyring along with --no-default-keyring.
--secret-keyring file Same as --keyring but for the secret keyrings.
更多推荐
gpg解密失败,没有密钥错误
发布评论