Skip to content

Commit

Permalink
Skip over non-exportable signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
nielslaukens committed May 19, 2016
1 parent ba8496a commit 1a62be3
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions ksp-mail.pl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@


if( @ARGV == 0 ) {
print STDERR "Usage: $0 keyid ...\n";
print STDERR "Usage: $0 keyid ... < keyring\n";
exit 64;
}
my @mykeyid = @ARGV; @ARGV = ();
Expand Down Expand Up @@ -140,25 +140,29 @@ sub process_packet {
or die("could not find '\\bsigclass 0x' in signature packet\n:$packet");
my $sigclass = hex($1);

if( $sigclass >= 0x10 && $sigclass <= 0x13 ) {
# certification signature
if( $sig_by eq $key[-1]->{keyid} ) {
# self signature
print STDERR "WARNING: multiple selfsigs" if defined $key[-1]->{uid}[-1]->{selfsig};
$key[-1]->{uid}[-1]->{selfsig} = $packetbin;

} elsif( grep { $_ eq $sig_by } @mykeyid ) {
# signature by @mykey
push @{ $key[-1]->{uid}[-1]->{sig} }, {
packet => $packetbin,
keyid => $sig_by,
};
}
} elsif( $sigclass == 0x30 ) {
# Revokation
if( $sig_by eq $key[-1]->{keyid} ) {
# self signature
$key[-1]->{uid}[-1]->{revoked} = 1;
if( $packet !~ m/\bhashed subpkt 4 len 1 \(not exportable\)$/m ) {
# only loop over exportable signatures.

if( $sigclass >= 0x10 && $sigclass <= 0x13 ) {
# certification signature
if( $sig_by eq $key[-1]->{keyid} ) {
# self signature
print STDERR "WARNING: multiple selfsigs" if defined $key[-1]->{uid}[-1]->{selfsig};
$key[-1]->{uid}[-1]->{selfsig} = $packetbin;

} elsif( grep { $_ eq $sig_by } @mykeyid ) {
# signature by @mykey
push @{ $key[-1]->{uid}[-1]->{sig} }, {
packet => $packetbin,
keyid => $sig_by,
};
}
} elsif( $sigclass == 0x30 ) {
# Revokation
if( $sig_by eq $key[-1]->{keyid} ) {
# self signature
$key[-1]->{uid}[-1]->{revoked} = 1;
}
}
}

Expand Down

0 comments on commit 1a62be3

Please sign in to comment.