]> git.donarmstrong.com Git - bin.git/blob - checksigs
remove convert_to_xls and .sa_bin
[bin.git] / checksigs
1 #! /usr/bin/perl
2
3 use warnings;
4 use strict;
5
6 use IO::Dir;
7
8 use Getopt::Long;
9
10 my $config = {gpg         => 'gpg',
11              };
12
13 ($config->{program_name}) = $0 =~/([^\/]+)\s*$/;
14
15 GetOptions($config,'gpg=s',);
16
17 $config->{gpg_command} = qq($config->{gpg});
18
19 my @keys_to_check = @ARGV;
20
21
22 my %got_uid_already;
23 sub _get_unknown_keys($$){
24      my ($config,$key_id) = @_;
25
26      my $uid_listing = qx($config->{gpg_command} --with-colons --list-sigs $key_id 2>/dev/null);
27      foreach my $key_record (split(/\n/,$uid_listing)) {
28           next unless $key_record =~ /\:/;
29           my ($record_type,$calculated_trust,$key_length,$algorithm,
30               $full_key_id,$creation_date,$expiration_date,$serial_no,
31               $owner_trust,$user_id,$signature_class,$key_capabilities,
32               $smime_fingerprint,$flag_field,
33              ) = split(/\:/,$key_record);
34           next unless defined $user_id and lc($user_id) eq lc('[User ID not found]');
35           next if exists $got_uid_already{$full_key_id};
36           qx($config->{gpg_command} --recv-keys $full_key_id 2>/dev/null);
37           $got_uid_already{$full_key_id} = 1;
38           print "Retreveved key: 0x".(substr $full_key_id, -8)."\n";
39      }
40 }
41
42 foreach my $key_id (@keys_to_check) {
43      _get_unknown_keys($config,$key_id);
44      print qx($config->{gpg_command} --check-sigs $key_id);
45 }