getsops / getsops/sops

Unable to decrypt with PGP on Yubikey

Open
#1,952 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

area/keyservice keyservice/pgp
Dominant language
Go
Stars
23.1k
Forks
1.1k
Avg merge
1d 11h
Merged PRs (30d)
9

Description

sops -v
sops 3.10.2 (latest)
gpg --version
gpg (GnuPG) 2.4.8
libgcrypt 1.11.2
Copyright (C) 2025 g10 Code GmbH
License GNU GPL-3.0-or-later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

I have an OpenPGP key on my yubikey smart card, which I can use to decrypt. e.g. this works:

gpg -d foo.gpg

But when calling sops, an error occurs

sops -d bar

Output:

Failed to get the data key required to decrypt the SOPS file.

Group 0: FAILED
  xxxx: FAILED
    - | could not decrypt data key with PGP key:
      | github.com/ProtonMail/go-crypto/openpgp error: could not
      | load secring: open /Users/fzakfeld/.gnupg/pubring.gpg: no
      | such file or directory; GnuPG binary error: failed to
      | decrypt sops data key with pgp: gpg: encrypted with RSA key,
      | ID xxxx
      | gpg: using "xxxx" as
      | default secret key for signing
      | gpg: public key decryption failed: No secret key
      | gpg: decryption failed: No secret key

How can I debug this further? Reading https://github.com/getsops/sops/issues/189 it seems like gpg2 is supported and sops is trying out the gpg binary

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with sops -d bar and compare it with the working gpg -d foo.gpg command, using the reported sops 3.10.2 and GnuPG 2.4.8 versions. Investigate how sops invokes GnuPG for PGP decryption and how that interacts with the Yubikey-backed secret key. Done means identifying the cause and providing a verified fix or clear debugging guidance.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, cryptography, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.