我查到有个bug是关于gpg-agent和gpg搭配导致此类报错的。这听起来也挺合理,因为里面有agent_genkey的报错。
能否请帮忙确认一下gpg-agent是否存在,如果存在请关闭测试一下。
https://github.com/google/end-to-end/issues/326

On Fri, Dec 28, 2018 at 11:51 PM chenlhlinux <chenlhli...@qq.com> wrote:

> 刚刚我搭建了一个全新的环境并且安装了gpg 2.1.18,我在1.4.23中重新生成了一个密钥,经测试,公钥可以正常导入,导入私钥时的报错信息为:
> root@localhost:~# gpg --import test.gpg
> gpg: key 7F694E59020861E1: public key "testtest <test@test>" imported
> gpg: error getting the KEK: End of file
> gpg: Total number processed: 1
> gpg:               imported: 1
> gpg:       secret keys read: 1
> 我在2.1.18中生成密钥时也出现了错误,错误信息及其前后几行为:
> Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o
> We need to generate a lot of random bytes. It is a good idea to perform
> some other action (type on the keyboard, move the mouse, utilize the
> disks) during the prime generation; this gives the random number
> generator a better chance to gain enough entropy.
> gpg: agent_genkey failed: End of file
> Key generation failed: End of file
> root@localhost:~#
> 这很奇怪,可能是我的环境有问题。
> ---Original---
> *From:* "Tong Hui"<tongh...@gmail.com>
> *Date:* Fri, Dec 28, 2018 22:14 PM
> *To:* "chenlhlinux"<chenlhli...@qq.com>;
> *Cc:* "Shell Xu"<shell909...@gmail.com>;"debian-chinese-gb@lists debian.
> org"<debian-chinese-gb@lists.debian.org>;
> *Subject:* Re: gnupg导入私钥的问题
>
> 这就很奇怪了,理论上来说 gpg v1 导出的私钥 gpg v2 是应该能够支持的啊。
>
> 不如再生成一个测试密钥多做一些测试吧,也许是 gpg 的一个bug呢。
>
> On Fri, Dec 28, 2018 at 9:52 PM chenlhlinux <chenlhli...@qq.com> wrote:
> >
> >
> 我发现出问题的的机器上的gpg的版本号为2.2.12,正常的机器上的gpg的版本号为1.*。刚刚我在异常的机器上安装了1.4.23版本的gpg,现在已经可以正常导入。
> > 感谢!
> > ---Original---
> > From: "Shell Xu"<shell909...@gmail.com>
> > Date: Fri, Dec 28, 2018 20:54 PM
> > To: "chenlhlinux"<chenlhli...@qq.com>;
> > Cc: "debian-chinese-gb@lists debian. org"<
> debian-chinese-gb@lists.debian.org>;
> > Subject: Re: gnupg导入私钥的问题
> >
> > 那么首先恭喜你,避免了最糟的情况。
> > 能对比一下你正常机器和异常机器的差异么?两者分别是什么发行,gpg的版本号各是多少?
> >
> > On Fri, Dec 28, 2018 at 1:40 PM chenlhlinux <chenlhli...@qq.com> wrote:
> >>
> >> 私钥在其他的机器上导入是正常的,私钥应该没有问题。
> >> ---Original---
> >> From: "Shell Xu"<shell909...@gmail.com>
> >> Date: Fri, Dec 28, 2018 09:59 AM
> >> To: "chenlhlinux"<chenlhli...@qq.com>;
> >> Cc: "debian-chinese-gb@lists debian. org"<
> debian-chinese-gb@lists.debian.org>;
> >> Subject: Re: gnupg导入私钥的问题
> >>
> >> 我问个题外话。备份出来的时候有试过测试恢复/导入么?理论上私钥都是要测试恢复的,否则等发生问题发现备份出了错就有意思了。
> >> 简单测试方法是设定GNUPGHOME环境变量,这样会产生一个和当前隔离的环境。如果这个环境下可以正常导入,那说明基本无大问题了。
> >> 我一般还会把~/.gnupg连根拷贝一份,以防万一。
> >>
> >> 如果备份的时候已经经过了测试恢复,那么你可以试试找第二台机器去导入,确定是机器问题还是文件问题。
> >>
> >> On Fri, Dec 28, 2018 at 12:20 AM chenlhlinux <chenlhli...@qq.com>
> wrote:
> >>>
> >>> 大家好:
> >>>      刚刚我想在gpg中导入我的私钥,命令是:gpg --import 私钥文件名
> >>> 报错信息为:
> >>> gpg: key 171F1787E07E87D2: "chenlhlinux (clh) <chenlhli...@qq.com>"
> not changed
> >>> gpg: error getting the KEK: End of file
> >>> gpg: Total number processed: 1
> >>> gpg:              unchanged: 1
> >>> gpg:       secret keys read: 1
> >>> 经确认,私钥文件没有问题,且公钥可以正常导入。
> >>> 请问这是什么原因,如何解决?
> >>>
> >>>
> >>> 感谢!
> >>
> >>
> >>
> >> --
> >> 彼節者有間,而刀刃者無厚;以無厚入有間,恢恢乎其於游刃必有餘地矣。
> >> blog: http://shell909090.org/
> >> twitter: @shell909090
> >> about.me: http://about.me/shell909090
> >
> >
> >
> > --
> > 彼節者有間,而刀刃者無厚;以無厚入有間,恢恢乎其於游刃必有餘地矣。
> > blog: http://shell909090.org/
> > twitter: @shell909090
> > about.me: http://about.me/shell909090
>
>
>
> --
> /***
>  * @ 启智开源 编码自由
>  * @ Open Mind, Open Source, Coding for Freedom!
>  * @ 佟辉 Tong Hui (Tony)
>  * @ Email tonghuix AT member DOT fsf DOT org
>  * @ Web https://tonghuix.io
>  * @ XMPP/Jabber tonghuix AT member DOT fsf DOT org
>  */
>


-- 
彼節者有間,而刀刃者無厚;以無厚入有間,恢恢乎其於游刃必有餘地矣。
blog: http://shell909090.org/
twitter: @shell909090 <https://twitter.com/shell909090>
about.me: http://about.me/shell909090

回复