Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v6] Add back armor checksum for non-v6 artifacts #1741

Merged
merged 4 commits into from Apr 9, 2024

Conversation

larabr
Copy link
Collaborator

@larabr larabr commented Apr 8, 2024

We need to include the checksum to workaround a GnuPG bug where data fails to be decoded if the base64 ends with no padding chars (=) (see https://dev.gnupg.org/T7071).
Pure v6 artifacts are unaffected and won't include the checksum, as mandated by the spec.

Breaking change:
openpgp.armor takes an additional emitChecksum argument (defaults to false).
NB: some types of data must not include the checksum, but compliance is left as responsibility of the caller: this function does not carry out any checks. Refer to the crypto-refresh for more details.

…ibility"

This reverts commit b41298a:

As per crypto-refresh, v6 signatures MUST NOT include the CRC checksum.
Also, the GPG issue isn't actually caused by the missing checksum, but it's due to
a failure to properly decode base64 with no trailing padding char (=).
We need to include the checksum to workaround an GnuPG bug
where data fails to be decoded if the base64 ends with no padding chars (=)
(see https://dev.gnupg.org/T7071)
src/cleartext.js Outdated Show resolved Hide resolved
src/key/key.js Outdated Show resolved Hide resolved
src/encoding/armor.js Outdated Show resolved Hide resolved
src/encoding/armor.js Outdated Show resolved Hide resolved
@larabr larabr changed the title [v6] Add back armor checksum where allowed by the spec [v6] Add back armor checksum for non-v6 artifacts Apr 9, 2024
@larabr larabr requested a review from twiss April 9, 2024 11:44
return armor(enums.armor.publicKey, packetlist.write(), null, null, 'This is a revocation certificate');
// An ASCII-armored Transferable Public Key packet sequence of a v6 key MUST NOT contain a CRC24 footer.
const emitChecksum = this.keyPacket.version !== 6;
return armor(enums.armor.publicKey, packetlist.write(), null, null, 'This is a revocation certificate', emitChecksum);
Copy link
Member

Choose a reason for hiding this comment

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

Not really related to this change but maybe we should pass the config also here?

@larabr larabr merged commit 90c8fbb into openpgpjs:v6 Apr 9, 2024
11 of 12 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.

None yet

2 participants