Skip to content

Conversation

@tilpner
Copy link

@tilpner tilpner commented Jun 6, 2024

As @mammothbane already identified in #1365, the pgp module is stripping the trailing exclamation mark from fingerprints that pgp uses to identify specific subkeys.
Because the shortened fingerprint refers to the whole key instead of just the subkey, I can't decrypt any secrets I encrypt for that subkey.

According to the doc comment, this was meant for compatibility with older GPG versions. I don't know which incompatibilities @hiddeco was referring to here, or if they are still relevant.

sops/pgp/keysource.go

Lines 633 to 635 in 1c46d24

// shortenFingerprint returns the short ID of the given fingerprint.
// This is mostly used for compatibility reasons, as older versions of GnuPG
// do not always like long IDs.

Fixes #1365

@tilpner tilpner force-pushed the dont-shorten-key-ids branch 2 times, most recently from 685c48e to 3068ed0 Compare June 6, 2024 20:30
@felixfontein felixfontein requested a review from hiddeco June 6, 2024 20:46
If shortening fingerprints, the trailing '!' from subkey fingerprints is removed,
and the wrong key is selected later on, potentially resulting in just-created secrets
not being decryptable.

Fixes getsops#1365

Signed-off-by: tilpner <[email protected]>
@felixfontein
Copy link
Contributor

According to the doc comment, this was meant for compatibility with older GPG versions. I don't know which incompatibilities @hiddeco was referring to here, or if they are still relevant.

I also don't know whether this is still needed, but to avoid breaking changes for users I've created a PR which keeps the trimming, but makes sure to handle ! correctly: #1720

I think eventually we should remove the trimming function (as implemented in this PR), but I'm not sure when it's time to do that. Though definitely not in a bugfix release :)

@Luflosi
Copy link

Luflosi commented Mar 13, 2025

Since the original problem this PR aimed to fix was solved by #1720, I think this can be closed.

@tilpner tilpner closed this Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unable to force specific gpg subkey

3 participants