Add InsecureGenerateNonCriticalKeyFlags option to generate non-critical key flags signature subpackets#291
Conversation
|
Signature Creation Time (amongst others) SHOULD be marked as critical (*). It's overkill to remove the critical bit from it, just because there is an interop issue with criticality of a different subpacket. (*) https://datatracker.ietf.org/doc/html/rfc9580#section-5.2.3.11 |
Maybe it'd be simpler to just not add the critical bit there? 🤔 |
|
I see, thanks for the review. Would it be fine to have a |
|
I updated the PR and description to only affect the key flags subpacket. |
|
I think it looks good now 👌 Note though, that I'm rather a random bystander, not anyone from the Proton team so my ack means nothing 😅 |
|
Hi 👋 Thanks for the PR! It mostly looks good to me.
I think arguably so, because an implementation that doesn't support the key flags subpacket may end up using the signing key for encryption (which in turn might cause the keyholder to need to use How about we call this flag |
|
Hi @twiss, thanks for the review!
Sounds good to me, I'll make the changes right away. |
twiss
left a comment
There was a problem hiding this comment.
Thanks! Some nitpicks below.
Co-authored-by: Daniel Huigens <d.huigens@protonmail.com>
Overview
Adds a new option to
openpgp/packet.Config,InsecureGenerateNonCriticalKeyFlags, to force theSignmethod to not add the critical flags to the key flags subpacket.Use-case
At Datadog, we have a setup where we have an RSA private key stored in a secrets manager, and we use this library to craft a GPG key from it, in order to sign deb and rpm packages, and to export the public GPG key to let customers import it in their systems.
The exported public key's signature packet contains two critical subpackets (signature date, and key flags), which are always set to true by the Sign method.
gpg --list-packets output
These critical subpackets are not accepted by some versions of
rpm, for instance the version included in OpenSUSE Leap 15.1 to 15.4 (rpm 4.14.3-150400.59.3.1). OpenSUSE versions 15.5 and 15.6 (rpm 4.14.3-150400.59.16.1) do not have this issue.For this particular case, with further testing we determined that what trips
rpmup is the critical subpacket on the key flags subpacket.rpm --import test in OpenSUSE Leap 15.4
Since we need to continue supporting these OS versions, we'd like to add opt-in configuration to force the
Signmethod to not add the critical subpackets to the key flags subpacket of a signature. In our case, we'd activate this option when adding a user id to the key to ensure the self-signature does not contain the offending critical subpacket.We currently use a fork to work around this issue, but, if possible, we'd rather continue using the upstream library.
Testing
Tested the exported public key output with the option set to true (the key flag subpacket is not critical) and false (all expected subpackets are critical).
Added unit test for the option.
Questions
Should this option be prefixed with
Insecure?