Branch Coverage

blib/lib/Mail/DKIM/ARC/Verifier.pm
Criterion Covered Total %
branch 103 136 75.7


line true false branch
56 189 2219 if (lc $field_name eq "arc-message-signature")
62 2 187 unless (eval { do { local $SIG{'__DIE__'}; my $signature = "Mail::DKIM::ARC::MessageSignature"->parse($line); $self->add_signature($signature); 1 } })
74 188 2220 if (lc $field_name eq "arc-seal")
80 1 187 unless (eval { do { local $SIG{'__DIE__'}; my $signature = "Mail::DKIM::ARC::Seal"->parse($line); $self->add_signature($signature); 1 } })
96 0 376 unless @_ == 2
98 12 364 if $self->{'result'}
101 0 364 if ($self->{'verify_time'})
107 14 350 unless ($self->check_signature($signature))
123 179 169 $signature->isa('Mail::DKIM::ARC::Seal') ? :
126 348 0 if ($algorithm->wants_pre_signature_headers)
146 2 346 if $signature->{'tags'}[$#{$$signature{"tags"};}]{'raw'} =~ /^\s*$/
149 4 344 if ($rawtaglen != $#tagkeys)
156 2 342 if (grep {not /[a-z][a-z0-9_]*/i;} @tagkeys)
162 176 166 if ($signature->isa('Mail::DKIM::ARC::Seal')) { }
166 0 elsif ($signature->isa('Mail::DKIM::ARC::MessageSignature')) { }
166 0 171 if (not $instance =~ /^\d+$/ or $instance < 1 or $instance > $MAX_SIGNATURES_TO_PROCESS)
173 3 168 if ($self->{'seals'}[$instance])
175 0 3 if ($signature eq $self->{'seals'}[$instance]) { }
189 0 162 if (not $instance =~ /^\d+$/ or $instance < 1 or $instance > $MAX_SIGNATURES_TO_PROCESS)
196 3 159 if ($self->{'messages'}[$instance])
198 0 3 if ($signature->as_string eq $self->{'messages'}[$instance]->as_string) { }
216 0 364 unless @_ == 1
219 0 364 unless ($signature->check_version)
222 0 0 if (defined $signature->version) { }
232 2 358 unless ($signature->algorithm and $signature->get_algorithm_class($signature->algorithm) and !$self->{'Strict'} || $signature->algorithm ne 'rsa-sha1')
239 4 2 if (defined $signature->algorithm)
245 1 357 unless ($signature->check_canonicalization)
249 1 0 if (defined $signature->canonicalization)
256 0 357 unless ($signature->check_protocol)
260 0 0 !defined($signature->protocol) ? :
266 0 357 unless ($signature->check_expiration)
273 2 355 unless (defined $signature->domain)
280 2 353 if ($signature->domain eq "")
287 3 350 unless (defined $signature->selector)
299 0 295 unless @_ == 2
324 0 295 if $@
326 0 295 unless (eval { do { local $SIG{'__DIE__'}; $@ = undef; $result = $public_key->check_hash_algorithm($signature->hash_algorithm); $result &&= $public_key->check_granularity($signature->domain, 0); die $@ if $@; 1 } })
344 5 163 if (@{$self->{'signatures'};} == 0 and not defined $self->{'signature_reject_reason'})
354 180 2186 if (my($i) = $hdr =~ /ARC-Authentication-Results:\s*i=(\d+)\s*;/i)
355 2 178 if (defined $aars[$i])
378 0 161 if (@{$self->{'algorithms'};} == 0 and @{$self->{'signatures'};} > 0)
395 0 306 unless ($signature->get_tag("d"))
400 4 302 unless ($signature->get_tag("b"))
405 151 151 unless ($signature->isa("Mail::DKIM::ARC::Seal"))
406 2 149 unless ($signature->get_tag("bh"))
410 1 148 if (($signature->get_tag('h') || '') =~ /arc-seal/i)
426 4 295 unless (eval { do { local $SIG{'__DIE__'}; $pkey = $signature->get_public_key; 1 } })
433 0 295 unless ($self->check_public_key($signature, $pkey))
439 2 0 if ($keysize < 1024 and $self->{'Strict'})
450 227 60 $algorithm->verify ? :
453 6 287 unless (eval { do { local $SIG{'__DIE__'}; $result = $algorithm->verify ? "pass" : "fail"; $details = $algorithm->{'verification_details'} || $@; 1 } })
457 6 0 if ($E =~ /(OpenSSL error: .*?) at /) { }
0 0 elsif ($E =~ /^(panic:.*?) at /) { }
472 28 140 if $self->{'result'}
491 0 140 unless (@$seals or @$messages)
507 0 140 if ($seals->$#* == 0)
512 0 140 if ($messages->$#* == 0)
518 11 129 if ($messages->$#* > $seals->$#*)
527 1 151 unless ($seals->[$i])
532 12 139 unless ($messages->[$i])
542 38 99 if ($result ne "pass")
553 7 71 if (not defined $cv or $cv ne "none")
561 2 14 if ($cv ne "pass")
572 16 53 if ($result ne "pass")
588 5 163 if $self->{'result'} eq "none"
592 177 0 ref $signature eq 'Mail::DKIM::ARC::MessageSignature' ? :
187 177 ref $signature eq 'Mail::DKIM::ARC::Seal' ? :
610 0 0 if @_