简体   繁体   English

使用已撤销的GPG密钥处理签名的git提交

[英]Handling signed git commits with revoked GPG key

I have been signing git commits for a while with GPG key "A". 我已经用GPG键“ A”签署了git commit一段时间了。 After a while I decided to revoke that key and start using GPG key "B". 一段时间后,我决定撤销该键,并开始使用GPG键“ B”。 I also continued signing new git commits with key "B". 我还继续用键“ B”签署新的git commits。

I still keep both keys (the revoked key "A" and new key "B") locally. 我仍将两个密钥(已撤销的密钥“ A”和新密钥“ B”)保留在本地。 New commits are ok, but the problem I'm now having is that all the old git commits signed with revoked key "A" are displayed with red warning when viewed with git log --show-signature . 新的提交是可以的,但是我现在遇到的问题是,当使用git log --show-signature查看时,所有用撤销的键“ A”签名的旧git提交都显示红色警告。

Here's how this warning looks in git log (most of it is screaming red): 这是此警告在git日志中的显示方式(大多数警告是红色的):

commit 39a53e42c8856278f481b9035e54eb90d8d2a0b7
gpg: Signature made Sat Aug  1 22:24:38 2015 CEST using RSA key ID 2F7EF26C
gpg: Good signature from "My Name <email1>" [ultimate]
gpg:                 aka "My Name <email2>" [ultimate]
gpg: WARNING: This key has been revoked by its owner!
gpg:          This could mean that the signature is forged.
gpg: reason for revocation: Key is superseded
gpg: revocation comment: New GPG key is used.
gpg: revocation comment: New key fingerprint: C464 17C1 4F7B D54E A082  7090 CAFA 7B1B 2914 ED81
gpg: revocation comment: New key id:          2914ED81
Author: My name <email1>
Date:   Sat Aug 1 22:24:38 2015 +0200

    Improve test helper

Is there a setting I can tell git or gpg that this key is still "ok" and trust-able, it's just that I'm not using it anymore? 有没有可以告诉git或gpg的设置,该密钥仍然“确定”且可信任,只是我不再使用它了? (I wanna keep this old key revoked) (我想保留这个旧密钥)

I'd appreciate if gpg (or git) "mildly" indicated the key is not in use instead of suggesting forged commits. 如果gpg(或git)“温和”地表示密钥未使用,而不是建议伪造的提交,我将不胜感激。 Is there a security or trust setting I could set to achieve this? 是否可以设置安全性或信任设置来实现此目的?

Update Q4 2016 with Git 2.11: 使用Git 2.11更新2016年第四季度:

git log introduces additional status codes E , X , Y , R for ERRSIG , EXPSIG , EXPKEYSIG , and REVKEYSIG , so that a user of %G? git logERRSIGEXPSIGEXPKEYSIGREVKEYSIG引入了其他状态代码EXYR ,以便%G?的用户使用%G? gets more information. 获取更多信息。
See Verifying signed git commits? 请参阅验证已签名的git commit?


There doesn't seem much to do in your case. 您的情况似乎没有什么可做的。

That was debated in 2010 , including an interesting idea as a best practice: 在2010年进行了辩论 ,其中包括一个有趣的想法作为最佳实践:

You can of course have more than one e-mail address per key, but you should NEVER have more than one key per e-mail. 当然,每个密钥可以有一个以上的电子邮件地址,但是每个电子邮件都不应具有多个。

This is pretty common actually. 实际上这很普遍。
At the very least it will happen if people are trying to transition between an older and a newer key --- for example, if they are trying to move from a less secure crypto algorithm to a more secure crypto algorithm. 至少,如果人们试图在较旧的密钥与较新的密钥之间进行转换,例如,如果他们试图从安全性较低的加密算法过渡到安全性更高的加密算法,则至少会发生这种情况。

As I understand things the best way to manage these kinds of things is to use sub-keys. 据我了解,管理此类事物的最佳方法是使用子项。 You can change the expire time on a sub-key, and then eventually you can revoke it, all the while preserving your one primary public key for signing . 您可以更改子密钥的到期时间,然后最终可以撤销它,同时始终保留一个主公钥以进行签名
Indeed it's a good idea to regularly change your sub-key and expire the older ones. 确实,定期更改子密钥并使旧密钥失效是个好主意。

See if you can use subkeys (following for instance this tutorial or this one ): 查看是否可以使用子键 (例如,在本教程 教程之后 ):

OpenPGP further supports subkeys, which are like the normal keys, except they're bound to a master key pair. OpenPGP进一步支持子密钥,该子密钥与普通密钥一样,只不过它们已绑定到主密钥对。 A subkey can be used for signing or for encryption. 子项可用于签名或加密。
The really useful part of subkeys is that they can be revoked independently of the master keys, and also stored separately from them. 子密钥真正有用的部分是,它们可以独立于主密钥而撤销,也可以与主密钥分开存储。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM