Skip to content

Add InsecureGenerateNonCriticalSignatureCreationTime option to generate non-critical signature creation time subpackets#292

Merged
twiss merged 3 commits intoProtonMail:mainfrom
KSerrania:kserrania/insecure-generate-non-critical-signature-creation-time
Jul 30, 2025
Merged

Add InsecureGenerateNonCriticalSignatureCreationTime option to generate non-critical signature creation time subpackets#292
twiss merged 3 commits intoProtonMail:mainfrom
KSerrania:kserrania/insecure-generate-non-critical-signature-creation-time

Conversation

@KSerrania
Copy link
Copy Markdown
Contributor

@KSerrania KSerrania commented Jul 29, 2025

Overview

Adds a new option to openpgp/packet.Config,InsecureGenerateNonCriticalSignatureCreationTime, to force the Sign method to not add the critical flag to the signature creation date subpacket.

Use-case

Hello again from Datadog - this is kind of a follow-up to #291.

After this change, we were able to have rpm --import commands work on the affected rpm versions contained in openSUSE 15.1 to 15.4.

However, a new problem arose. yum in CentOS 7 and AmazonLinux 2 (version 3.4.3-168.el7.centos and 3.4.3-158.amzn2.0.6, respectively) does not manage to read a key specified in the gpgkey field of a repository definition, if that key only has a critical bit on the signature creation time subpacket (it worked fine when both the key flags and signature creation time had critical bits).

Since the keys we generate must support all these OSes at the same time, we'd like to add another opt-in configuration to force the Sign method to not add the critical bit to the signature creation time 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.

Testing

Tested the exported public key output with the option set to true (the signature creation time subpacket is not critical) and false (all expected subpackets are critical).
Added unit test for the option.

@KSerrania KSerrania changed the title Add InsecureGenerateNonCriticalSignatureCreationDate option to generate non-critical signature creation date subpackets Add InsecureGenerateNonCriticalSignatureCreationTime option to generate non-critical signature creation time subpackets Jul 29, 2025
Copy link
Copy Markdown
Collaborator

@twiss twiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, a new problem arose. yum in CentOS 7 and AmazonLinux 2 (version 3.4.3-168.el7.centos and 3.4.3-158.amzn2.0.6, respectively) does not manage to read a key specified in the gpgkey field of a repository definition, if that key only has a critical bit on the signature creation time subpacket (it worked fine when both the key flags and signature creation time had critical bits).

Insanity, but OK. Thanks for the PR! Tiny nitpicks below.

Just to make sure that this is really the issue, have you tested that a key generated with this patch works for you on all OSes?

Comment thread openpgp/packet/config.go
Comment thread openpgp/packet/signature_test.go Outdated
Comment thread openpgp/packet/signature_test.go Outdated
Comment thread openpgp/packet/config.go Outdated
@KSerrania
Copy link
Copy Markdown
Contributor Author

Just to make sure that this is really the issue, have you tested that a key generated with this patch works for you on all OSes?

Yes, this time I re-tested with this + the previous change on the entire suite of OSes we test (Debian 9 to 12, Ubuntu 14 to 24, CentOS/RHEL 6 to 9, openSUSE 42 to 15, and Amazon Linux 2 to 2023).

Co-authored-by: Daniel Huigens <d.huigens@protonmail.com>
@twiss twiss force-pushed the kserrania/insecure-generate-non-critical-signature-creation-time branch from dbf9040 to e41a962 Compare July 30, 2025 14:24
Copy link
Copy Markdown
Collaborator

@twiss twiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks!

@twiss twiss merged commit de87788 into ProtonMail:main Jul 30, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants