Encrypt with key ID

John Clizbe JPClizbe at tx.rr.com
Mon May 14 22:23:05 CEST 2007

jane grove wrote:
> Thanks, John.
> However, when I use the command "gpg --batch -ea -r keyid filename", I got
> an "encryption failed: unusable public key" error message.
> Interestingly, when I use the command without batch mode like "gpg -ea
> -r keyid filename", I'm able to encrypt the file.  So the batch mode
> is having problems.
> How can I encrypt the file using recipient public keyid correctly in
> batch mode?
From the man page:

                 Use  batch  mode.   Never  ask, do not allow interactive com-
                 mands.  --no-batch disables this option.

       --no-tty  Make sure that the TTY (terminal) is never used for any  out-
                 put.  This option is needed in some cases because GnuPG some-
                 times prints warnings to the TTY if --batch is used.

       --yes     Assume "yes" on most questions.

       --no      Assume "no" on most questions.

gpg -ea is only a non-interactive command as long as all recipient keys are
considered trusted *and* the output filename does not already exist.

--batch -ea by itself fails for a non trusted key. Along with the 'encryption
failed: unusable public key' message, you should have received a 'There is no
assurance this key belongs to the named user' message. --batch --yes will handle
the output file already existing, but not the untrusted key.

If you must use batch, the you need to add --yes if the output file name may
already exist (it will be overwritten); and you need to either sign recipient
keys with a trusted key or add --always-trust to the command line.

John P. Clizbe                      Inet:   John (a) Mozilla-Enigmail.org
You can't spell fiasco without SCO. PGP/GPG KeyID: 0x608D2A10/0x18BB373A
"what's the key to success?"        / "two words: good decisions."
"what's the key to good decisions?" /  "one word: experience."
"how do i get experience?"          / "two words: bad decisions."

"Just how do the residents of Haiku, Hawai'i hold conversations?"

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 662 bytes
Desc: OpenPGP digital signature
Url : /pipermail/attachments/20070514/67132d2b/attachment.pgp 

More information about the Gnupg-users mailing list