Default Directory
Harter, Shan
Shan.Harter@systrends.com
Wed May 16 18:49:01 2001
The ability to import keys to the key ring, key admin, key creation seems to
restricted to the c:\gnupg directory. If I move the keyring to another
directory and keep C:\gnupg in my path, will it add to keyring?
I'll run some tests. Any information on this would be appreciated.
Shan
-----Original Message-----
From: Steven Scott [mailto:steven_scott@solutionconsultantsinc.com]
Sent: Wednesday, May 16, 2001 9:10 AM
To: gnupg-users@gnupg.org
Subject: Fw: GnuPG:mailing-list-> request script
I sent this to the group as others were looking for the same idea.
Steven Scott
Solution Consultants Inc.
Email: mailto:steven_scott@solutionconsultantsinc.com
Script:
#!/usr/bin/perl
#
# v0.1
#
use Getopt::Std;
use Expect;
sub Usage
{
print STDERR << 'EOF';
Usage : gpgdir.pl [options] -i <in-directory> -o <out-directory>
Options:
[-v] verbose mode
[-e ] : encrypt
[-d <passphrase>] : decrypt with passphrase
[-s <passphrase>] enable symmetric mode for encryption with this passphrase
[-k <key-id>]: required to specify which key to use.
Parameters:
-i <in-directory>: directory where input files stand
-o <out-directory>: directory where ciphered files should be written
EOF
exit(0);
}
sub Specify
{
getopts("vs:i:o:d:ek:");
if (($opt_s) and (! $opt_k) and (! $opt_d) and ($opt_e))
{
if ($opt_v)
{
print "choice: symmetric encryption\n";
}
}
elsif ((! $opt_s) and ( $opt_k) and (! $opt_d) and ($opt_e))
{
if ($opt_v)
{
print "choice: encryption with a public key\n";
}
}
elsif ((! $opt_s) and (! $opt_k) and ( $opt_d) and (! $opt_e))
{
if ($opt_v)
{
print "choice:decrypt method\n";
}
}
else
{
print "Error : wrong combination of options and parameters\n";
Usage;
}
if ($opt_v)
{
if ($opt_i)
{
print "input directory should be " . $opt_i . "\n";
}
else
{
Usage;
exit(0);
}
if ($opt_o)
{
print "output directory should be " . $opt_o . "\n";
}
else
{
Usage;
exit(0);
}
if ($opt_s)
{
print "use symmetric cipher\n";
}
else
{
print "DON'T use symmetric cipher\n";
}
}
}
Specify;
opendir(DIR, $opt_i) or die "can't opendir $opt_i: $!";
while (defined($file = readdir(DIR)))
{
$file2=$file;
if ($opt_s)
{
$methode='-c';
$extension='.pgp';
$passphrase=$opt_s . "\r";
}
elsif ($opt_k)
{
$methode=' -e -r ' . $opt_k ;
$extension='.gpg';
}
elsif ($opt_d)
{
$methode='--passphrase -d';
if (($file ne '.') and ($file ne '..'))
{
substr($file2,-4)="";
}
$passphrase=$opt_d . "\r";
}
if (($file ne '.') and ($file ne '..'))
{
$command = "gpg --yes --openpgp " . $methode . " --output " . $opt_o .
$file2 . $extension . " " . $opt_i . $file;
if ($opt_s)
{
$command2 = Expect->spawn($command) or die "Couldn't start program: $!\n";
$command2->log_stdout(0);
unless ($command2->expect(undef, -re => 'passphrase:'))
{
die "Error : toooo looOOoong ";
}
print $command2 $passphrase;
unless ($command2->expect(undef, -re => 'passphrase:'))
{
die "Error : tooooo looOOoong";
}
print $command2 $passphrase;
$status=$command2->soft_close();
}
elsif ($opt_d)
{
$command2 = Expect->spawn($command) or die "Couldn't start program: $!\n";
$command2->log_stdout(0);
unless ($command2->expect(undef, -re => ''))
{
die "Error : toooooo long";
}
print $command2 $passphrase;
$command2->clear_accum();
$status=$command2->soft_close();
}
else
{
$status = system($command);
}
if ($opt_v)
{
print $file . "\n";
print $command;
print "\n";
print "Status=" . $status . "\n\n";
}
}
}
closedir(DIR);
----- Original Message -----
From: "O . H ." <olih@swing.be>
To: <steven_scott@solutionconsultantsinc.com>
Sent: Wednesday, May 16, 2001 11:31 AM
Subject: GnuPG:mailing-list-> request script
> hi,
>
> here is the small script that i use to encrypt a entire directory.
> need some cleaning... but as i say,it works ;-)
_______________________________________________
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users