+# find a list of all interesting keys.
+if (scalar @KEYIDS == 0) {
+ my $gpg = GnuPG::Interface->new();
+ $gpg->options->meta_interactive( 0 );
+ my ($inputfd, $stdoutfd, $stderrfd, $statusfd, $handles) = make_gpg_fds();
+ $gpg->options->hash_init( 'extra_args' => [ '--with-colons', '--fast-list-mode', '--fixed-list-mode' ] );
+ my $pid = $gpg->list_sigs(handles => $handles);
+ my ($stdout, $stderr, $status) = readwrite_gpg('', $inputfd, $stdoutfd, $stderrfd, $statusfd);
+ waitpid $pid, 0;
+ if ($stdout eq '') {
+ die ("No data from gpg for list-sigs\n");
+ };
+
+ my $thiskey = undef;
+ for my $line (split /\n/, $stdout) {
+ debug("Checking line $line");
+ my ($type, undef, undef, undef, $keyid, $created, undef, undef, undef, undef) = split /:/, $line;
+ if ($type eq 'pub') {
+ $thiskey = $keyid;
+ debug("Found key $thiskey");
+ } elsif (!defined $thiskey) {
+ next;
+ } elsif ($type eq 'sig' || $type eq 'rev') {
+ if (($keyid eq '0' x 16) || ($created eq "") || ($created == 0)) {
+ push @KEYIDS, $thiskey;
+ info("Key $thiskey needs cleaning.");
+ $thiskey = undef;
+ };
+ };
+ };
+}