Skip to content

Handle OpenPGP-compliant CSF message verfication#40

Merged
alecpl merged 1 commit intopear:masterfrom
dkg:CSF-newlines
Apr 5, 2025
Merged

Handle OpenPGP-compliant CSF message verfication#40
alecpl merged 1 commit intopear:masterfrom
dkg:CSF-newlines

Conversation

@dkg
Copy link
Contributor

@dkg dkg commented Mar 14, 2025

GnuPG has traditionally emitted a spurious newline when outputting the text verified from a cleartext signing framework message, if the signed message doesn't contain a trailing newline.

This is clearly wrong according to the OpenPGP specification, which says:

The line ending (i.e., the ) before the '-----BEGIN PGP
SIGNATURE-----' line that terminates the signed text is not
considered part of the signed text.

The test in Crypt_GPG presumes that the trailing newline is returned, as that has been traditional GnuPG (mis)behavior.

This change adjusts the test suite so that it passes regardless of whether GnuPG conforms to the specification or misbehaves in the traditional way.

See https://dev.gnupg.org/T7106 for discussion with upstream.

See also https://gitlab.com/freepg/gnupg/-/merge_requests/15, where the FreePG project is bringing a patched version of GnuPG into compliance with the specification.

Finally, please also see the discussion over on
https://bugs.debian.org/1099043 -- debian's GnuPG is being brought into compliance with the OpenPGP standard for CSF messages, so we need something like this to ensure that the Crypt_GPG test suite succeeds.

GnuPG has traditionally emitted a spurious newline when outputting the
text verified from a cleartext signing framework message, if the
signed message doesn't contain a trailing newline.

This is clearly wrong according to the OpenPGP specification, which
says:

> The line ending (i.e., the <CR><LF>) before the '-----BEGIN PGP
> SIGNATURE-----' line that terminates the signed text is not
> considered part of the signed text.

The test in Crypt_GPG presumes that the trailing newline is returned,
as that has been traditional GnuPG (mis)behavior.

This change adjusts the test suite so that it passes regardless of
whether GnuPG conforms to the specification or misbehaves in the
traditional way.

See https://dev.gnupg.org/T7106 for discussion with upstream.

See also https://gitlab.com/freepg/gnupg/-/merge_requests/15, where
the FreePG project is bringing a patched version of GnuPG into
compliance with the specification.

Finally, please also see the discussion over on
https://bugs.debian.org/1099043 -- debian's GnuPG is being brought
into compliance with the OpenPGP standard for CSF messages, so we need
something like this to ensure that the Crypt_GPG test suite succeeds.
@alecpl alecpl merged commit 5e7ede3 into pear:master Apr 5, 2025
11 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