use of --passphrase-fd in batch symmetric encryption

Frank Heckenbach frank@g-n-u.de
Wed Jul 11 04:03:01 2001


William Binkley wrote:


> I am apparently too dumb to figure this out -> I've tried reading the man
> page, faq, and other docs at the gnupg site, to no useful avail. I can't seem
> to figure out how to symmetrically encrypt a batch of files at once, using
> the same passphrase, and entering the passphrase only once for the whole
> batch. I tried the following (and I am no pearl programmer, beware):
> ==============================
>
> #!/usr/bin/perl -w
>
> open ( FILE , '</home/cbinkle1/.gnupg/pass' ) or die "Can't find passfile\n";
> $j = fileno FILE;
> @files = glob "$ARGV[0]";
> $numberofelements = @files;
> for ( $i = 0; $i <= $numberofelements - 1; $i++) {
> system ( "gpg --passphrase-fd $j -c $files[$i]" );
> }
> close FILE;
> exit
> ===============================
I'm no perl programmer, either, so I don't know what's wrong with your code. But it's quite easy to do with sh ... #!/bin/sh for file do gpg --passphrase-fd 3 -c "$file" 3< /home/cbinkle1/.gnupg/pass done Frank -- Frank Heckenbach, frank@g-n-u.de http://fjf.gnu.de/ PGP and GPG keys: http://fjf.gnu.de/plan