GPG question

David Shaw dshaw at jabberwocky.com
Fri Aug 11 19:19:13 CEST 2006


On Fri, Aug 11, 2006 at 10:39:57AM -0500, Brian Rosenvinge wrote:
> I need to decrypt a file that has been sent to me and immediately 
> re-encrypt the file for three new recipients.  I would like to automate 
> the process with a batch file.  To avoid the file being left 
> un-encrypted during the batch process I would like to redirect the 
> output of the decrypt command into the encrypt command for the new 
> recipients.
> 
> I have been unsuccessful in my attempts, can anyone help me out?

cat thefile.gpg | gpg | gpg -r recipient_1 -r recipient_2 -r recipient_3 --encrypt > output.gpg

The catch is that the first gpg instance is doing to need to prompt
you for a passphrase, and the second gpg instance may need to prompt
you whether the recipients are trusted (if you don't have a trust path
to them).  An easy way to fix this, is to add a "--trust-model always"
to the second instance (assuming you really do trust those recipient
keys).

David



More information about the Gnupg-users mailing list