Package: signing-party
Severity: wishlist
Tags: patch
Submitter: Jon Åslund <[EMAIL PROTECTED]>

Christoph
-- 
[EMAIL PROTECTED] | http://www.df7cb.de/
--- Begin Message ---
Here is a small patch to let caff import keys from a file.

-- 
Jon Åslund, Karl Hasselström
Index: caff
===================================================================
--- caff        (revision 126)
+++ caff        (working copy)
@@ -85,6 +85,10 @@
 
 Select the key that is used for signing, in case you have more than one key.
 
+=item B<--key-file> I<file>
+
+Import keys from file. Can be give more than once.
+
 =back
 
 =head1 FILES
@@ -169,6 +173,10 @@
 If true, then skip the step of fetching keys from the keyserver.
 Default: B<0>.
 
+=item B<key-files> [list of files]
+
+A list of files containing keys to be imported.
+
 =head2 Signing settings
 
 =item B<no-sign> [boolean]
@@ -282,6 +290,7 @@
        $CONFIG{'secret-keyring'} = $ENV{'HOME'}.'/.gnupg/secring.gpg' unless 
defined $CONFIG{'secret-keyring'};
        $CONFIG{'no-download'} = 0 unless defined $CONFIG{'no-download'};
        $CONFIG{'no-sign'} = 0 unless defined $CONFIG{'no-sign'};
+        $CONFIG{'key-files'} = () unless defined $CONFIG{'key-files'};
        $CONFIG{'mail-template'} = <<'EOM' unless defined 
$CONFIG{'mail-template'};
 Hi,
 
@@ -698,6 +707,7 @@
        '--no-download'   =>  \$params->{'no-download'},
        '-S'              =>  \$params->{'no-sign'},
        '--no-sign'       =>  \$params->{'no-sign'},
+       '--key-file=s@'   =>  \$params->{'key-files'},
        )) {
        usage(\*STDERR, 1);
 };
@@ -735,6 +745,7 @@
 $CONFIG{'no-mail'}     = $params->{'no-mail'}     if defined 
$params->{'no-mail'};
 $CONFIG{'mail'}        = $params->{'mail'}        if defined $params->{'mail'};
 $CONFIG{'no-sign'}     = $params->{'no-sign'}     if defined 
$params->{'no-sign'};
+push @{$CONFIG{'key-files'}}, @{$params->{'key-files'}} if defined 
$params->{'key-files'};
 
 
 #################
@@ -762,6 +773,24 @@
                }
        }
 
+########################
+# import keys from files
+########################
+foreach my $keyfile (@{$CONFIG{'key-files'}}) {
+    my $gpg = GnuPG::Interface->new();
+    $gpg->call( $CONFIG{'gpg'} );
+    $gpg->options->hash_init('homedir' => $GNUPGHOME);
+    $gpg->options->meta_interactive( 0 );
+    my ($inputfd, $stdoutfd, $stderrfd, $statusfd, $handles) = make_gpg_fds();
+    my $pid = $gpg->import_keys(handles => $handles, command_args => $keyfile);
+    my ($stdout, $stderr, $status) = readwrite_gpg('', $inputfd, $stdoutfd, 
$stderrfd, $statusfd);
+    info ("Importing keys from $keyfile");
+    waitpid $pid, 0;
+    if ($status !~ /^\[GNUPG:\] IMPORT_OK/m) {
+       warn $stderr;
+    }
+}
+
 #############################
 # receive keys from keyserver
 #############################

--- End Message ---

Attachment: signature.asc
Description: Digital signature

Reply via email to