173

I'm trying to use interesting password management tool named Pass.

I did the following:

  1. Installed gpg tool $ sudo dnf install gpg
  2. Generated a key using $ gpg --gen-key
  3. Typed $ pass init "foobar id of my gpg key" as stated here
  4. Got

mkdir: created directory ‘/home/chichivica/.password-store/’ Password store initialized for foobar@email.com

  1. Tried to add a simple password

$ pass insert foo Enter password for foo: Retype password for foo:

  1. And there is the problem

gpg: A45A123C: There is no assurance this key belongs to the named user gpg: [stdin]: encryption failed: Unusable public key

Could anyone give me some advice?

12
  • What is gpg -K printing?
    – Jens Erat
    Oct 27, 2015 at 7:52
  • @JensErat just this /home/chichivica/.gnupg/secring.gpg ----------------------------------- sec 2048R/96F0E0C0 2015-10-26 uid Ivan Talalaev (chichivica) <foo@bar.com> ssb 2048R/76A1D91D 2015-10-26 Oct 27, 2015 at 11:31
  • Where in (6) is the ID A45A123C coming from? Your master key ID is another one.
    – Jens Erat
    Oct 27, 2015 at 12:02
  • 1
    Hi @ArmanOrtega, The solution marked as answer helped me! Sep 14, 2017 at 14:36
  • 1
    It appears that --list-keys may not list encryption subkey IDs, but gpg --list-keys --keyid-format long does
    – ealfonso
    Sep 14, 2018 at 22:49

2 Answers 2

351

I had the same issue after copying my key pair from one machine to another. The solution for me was the set the trust level of the keys:

gpg --edit-key <KEY_ID>
gpg> trust

You will be asked to select the trust level from the following:

1 = I don't know or won't say
2 = I do NOT trust
3 = I trust marginally
4 = I trust fully
5 = I trust ultimately
m = back to the main menu

I selected 5 since I created the key so of course I trust it ultimately :). It will ask you to confirm your decision:

Your decision? 5
Do you really want to set this key to ultimate trust? (y/N) y

After confirming, quit with:

gpg> quit

You should then be able to encrypt using that key.

6
  • 3
    key_id is the mailid you have used
    – kumar
    Mar 15, 2019 at 8:25
  • 7
    gpg> quit to exit.
    – John Mee
    Apr 2, 2019 at 21:51
  • 1
    or simply gpg> q also exits.
    – mike23
    Apr 22, 2019 at 9:41
  • 1
    Unfortunately it did not work for me. Still get the same message. I had a script that used a passwordless key to encrypt my duplicity backups. Looks like I have to accept unencrypted from now on. :(
    – ñull
    Sep 29, 2020 at 19:34
  • 2
    i had to set the trust explicitly for the encryption ssb, i.e. select it first in the gpg prompt with key <SSB_ID> so that an asterisk appears next to it
    – Sam
    Mar 11, 2021 at 10:40
2

I had same issue in batch mode and adding the flag --trust-model always worked for me.

The full command for batch mode with Ultimate trust, non-interactive passphrase is as below:

gpg --batch --trust-model always --recipient <recipient uid> --pinentry-mode=loopback --passphrase <your passphrase> --encrypt-files *.*

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.