如何强制 maven-gpg-plugin 使用主 gpg 密钥而不是子密钥?
我有一个带有子密钥的 GPG 公钥。当我尝试在发布过程中对 Maven 工件进行签名时,插件使用子密钥而不是主密钥进行签名。
在这里查看插件的文档: http://maven.apache.org/plugins/maven-gpg -plugin/sign-mojo.html
我没有看到明显的属性来设置来控制使用哪个键。这个可以控制吗?
I have a GPG public key with a sub key. When I attempt to sign my Maven artifacts as part of the release process, the plugin is signing with the sub key instead of the main key.
Looking at the docs for the plugin here:
http://maven.apache.org/plugins/maven-gpg-plugin/sign-mojo.html
I do not see an obvious property to set to control which key is used. Is it possible to control this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在邮件列表上询问了一些问题后,看来我并不是唯一遇到此问题的人。
就我而言,我使用 Mac 上的 GPG Keychain Access UI 创建了密钥对。使用相同工具创建密钥的其他用户也报告了 Maven 的相同问题。
无论出于何种原因,当您使用该 UI 创建密钥对时,它不仅会创建顶级密钥,还会创建子密钥。当您使用命令行工具创建新密钥对时,不会发生这种情况。
所以我进入命令行,撤销子项,一切开始工作。
我不确定根本问题是否与 GPG KeyChain Access UI 创建密钥的方式有关,或者是否是 Maven 插件读取密钥的方式。
After asking some questions on mailing lists, it appears I wasn't the only one with this issue.
In my case, I had created my key pairs using GPG Keychain Access UI on my Mac. Other users who had used the same tool to create their keys also reported the same issue with Maven.
For whatever reason, when you create a key pair using that UI it creates not only a top level key but also a sub key. This doesn't happen when you use the command line tools to create a new keypair.
So I went to the command line, revoked the subkey and everything started to work.
I am not sure if the underlying issue is with the way the GPG KeyChain Access UI creates keys, or if it is the way the maven plugin reads keys though.
太长了;您可以通过删除或撤销子项来控制它。建议撤销。
--
例如,此 sonatype 问题对此进行了讨论。此外,它不仅影响 UI - 我在 Windows 7 上使用 gpg4win 和命令行创建了我的密钥密钥生成同时生成了 pub 和 subkey:
评论说您有两个选择:
..
该问题中的评论说 该文档已根据说明进行更新,但链接不再有效。通过使用一些页面缓存,我能够挽救内容,内容如下:
因此,对我来说,实际步骤是
重做签名/发布。
TLDR; You can control it by deleting or revoking the subkey. Revoking is recommended.
--
This has been discussed in this sonatype issue, for example. Also, it doesn't only impact the UI - I created my keys using gpg4win on windows 7, and command line key generation generated both pub and subkeys:
Comments say that you have two options:
..
The comments in the issue say that the document was updated regarding instructions, but link no longer works. By using some page caches I was able to salvage the content, which read like this:
So, for me the practical steps were
and redoing the sign/release.