I have keys - now I want to encrypt a file

Neil Williams linux at codehelp.co.uk
Fri Apr 9 12:29:55 CEST 2004

On Tuesday 06 April 2004 9:05, Doug Thomson wrote:
> Hi all,
> I have just installed gpg on my Solaris system.
> My requirement is to encrypt small flat files and send
> them to outside recipients.  I have successfully
> imported two public keys from these recipients.  Now I
> want to encrypt 'testfile' to prepare it for FTPing to
> one of the recipients.  What syntax should I use?  I
> have thus far tried
> gpg --encrypt-files testfile --recipient
> somebody at location.com keyname

Use the keyid for the recipient - what do you mean by keyname?

Matching by email address is possible but commonly ends up with more than one 
key available. e.g., I have two keys that would match my email address on 
keyservers and more that have not been used publicly. 

--encrypt-files is a special case:
from man gpg
The command expects the files to be encrypted
                 either on the command line or reads the filenames from stdin; 
each name must be on separate  line.  The
                 command is intended for a quick encryption of multiple files.

Normally, just use --encrypt or just -e

To send by FTP, it may be best to use ASCII armour and send as an ASCII 

The final command becomes:

$ gpg --recipient 0xDEADBEEF --armor --encrypt testfile
or just
$ gpg -ar 0xDEADBEEF -e testfile
Replace DEADBEEF with the keyid of the recipient, in my case 28BCB3E3.
Look for the keyid from this output:

$ gpg --list-key keyname

Unless the recipient is an automated script, it's best to also sign the 
encrypted file:

$ gpg -sar 0xDEADBEEF -r keyid
(to help your recipient have some confidence about the contents of the 
encrypted file).

> but I get the message 'you did not specify a user ID'

You didn't specify a UID, you specified an email address that could match more 
than one UID or none at all.

> I have checked the FAQ and do not find the answer
> there.

Check the man page, learn how to specify a keyid.


Neil Williams

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
Url : /pipermail/attachments/20040409/56d8cdd5/attachment.bin

More information about the Gnupg-users mailing list