Encrypt with public key from stdin/file possible?

Atom Smasher atom at smasher.org
Sat Apr 16 09:27:59 CEST 2005

On Wed, 13 Apr 2005, David Shaw wrote:
>On Wed, Apr 13, 2005 at 02:19:04PM +0200, Sargon wrote:
>> I have a public key of a recipient in ASCII or binary form and would 
>> like to feed gpg w/o importing it first in its public keyring and 
>> afterwards specify the ID of the public key. According to my researches 
>> on the net and on the gnupg.org site, there's no way to do this though.
>> Can anyone confirm this?
> You can't do it without importing the key, but you can sort of fake what 
> you want.  Do something like:
>  gpg --no-default-keyring --keyring ./tempkeyring.gpg --import  (thekey)
>  gpg --no-default-keyring --keyring ./tempkeyring.gpg --encrypt  ......
>  rm tempkeyring.gpg

there's a better way to fake it... let's say you want to encrypt a message 
to me, and have my key in a binary file "D9F57808.key":

   gpg --no-default-keyring --keyring /path/to/D9F57808.key -er D9F57808

you may want to add "--trust-model always" to the command.

this only works with binary, not ascii, key files. keys in ascii would 
have to be converted into binary, or use the import method described by 


  PGP key - http://atom.smasher.org/pgp.txt
  762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808

 	"Because, it isn't just a stupid little mistake, Ok? You have
 	 to understand Coke's business. How does Coke make money?"

 	"They sell syrup to bottlers."

 	"Right. And...."


 	"And they license the rights to print their corporate art on
 	 the cans and bottles to those bottlers. So what are those
 	 bottlers going to say after finding out they've been paying
 	 twelve years worth of licensing fees for a fraudulent

 		-- Bob Kolody,
 		explaining the implications of his suit
 		against Coca-Cola

More information about the Gnupg-users mailing list