GPG encryption failing with No public key Error
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 23.1k
- Forks
- 1.1k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 9
Description
Hi
We are trying to use sops with gpg to encrypt some of the yaml files. We are using the sops golibrary to perform the encryption and decryption functionality on the YAML files. We have built a sample public and private keys and have imported the private key using gpg --import command. The keys are imported successfully and are available through gpg --list-keys command.
------------------------
pub rsa2048 2020-08-21 [SC] [expires: 2022-08-21]
681E3A89EB1DAFD36EB883120A73BB48E26694D8
uid [ unknown] Docker <Docker@cluster.local>
sub rsa2048 2020-08-21 [E] [expires: 2022-08-21]
But when we are trying to use the same key to encrypt a file, it seems to be failing with the following error:
failed to encrypt new data key with master key "681E3A89EB1DAFD36EB883120A73BB48E26694D8": could not encrypt data key with PGP key: golang.org/x/crypto/openpgp error: key with fingerprint 681E3A89EB1DAFD36EB883120A73BB48E26694D8 is not available in keyring and could not be retrieved from keyserver; GPG binary error: gpg binary failed with error: exit status 2, gpg: 681E3A89EB1DAFD36EB883120A73BB48E26694D8: skipped: No public key
gpg: [stdin]: encryption failed: No public key
We are expecting that the execution is failing at this step
The same keys seems to be working fine most of the time, it is failing with the above error 5 out of 10 times when executed. As the error is not consistent we are not sure what are we missing here.
can someone help us identify what exactly is the issue here?
Thank you in advance!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at pgp/keysource.go around line 83 and reproduce encryption with the fingerprint and GPG commands shown in the report. Compare the Go openpgp and GPG paths across repeated runs; done means identifying the cause of the intermittent “No public key” failure and recording or fixing it with a regression test if the relevant test location is found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100