Branch Coverage

blib/lib/Mail/DKIM/ARC/Verifier.pm
Criterion Covered Total %
branch 102 134 76.1


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'}
102 14 350 unless ($self->check_signature($signature))
118 179 169 $signature->isa('Mail::DKIM::ARC::Seal') ? :
121 348 0 if ($algorithm->wants_pre_signature_headers)
141 2 346 if $signature->{'tags'}[$#{$$signature{"tags"};}]{'raw'} =~ /^\s*$/
144 4 344 if ($rawtaglen != $#tagkeys)
151 2 342 if (grep {not /[a-z][a-z0-9_]*/i;} @tagkeys)
157 176 166 if ($signature->isa('Mail::DKIM::ARC::Seal')) { }
166 0 elsif ($signature->isa('Mail::DKIM::ARC::MessageSignature')) { }
161 0 171 if (not $instance =~ /^\d+$/ or $instance < 1 or $instance > 1024)
168 3 168 if ($self->{'seals'}[$instance])
170 0 3 if ($signature eq $self->{'seals'}[$instance]) { }
184 0 162 if (not $instance =~ /^\d+$/ or $instance < 1 or $instance > 1024)
191 3 159 if ($self->{'messages'}[$instance])
193 0 3 if ($signature->as_string eq $self->{'messages'}[$instance]->as_string) { }
211 0 364 unless @_ == 1
214 0 364 unless ($signature->check_version)
217 0 0 if (defined $signature->version) { }
227 2 358 unless ($signature->algorithm and $signature->get_algorithm_class($signature->algorithm) and !$self->{'Strict'} || $signature->algorithm ne 'rsa-sha1')
234 4 2 if (defined $signature->algorithm)
240 1 357 unless ($signature->check_canonicalization)
244 1 0 if (defined $signature->canonicalization)
251 0 357 unless ($signature->check_protocol)
255 0 0 !defined($signature->protocol) ? :
261 0 357 unless ($signature->check_expiration)
268 2 355 unless (defined $signature->domain)
275 2 353 if ($signature->domain eq "")
282 3 350 unless (defined $signature->selector)
294 0 295 unless @_ == 2
319 0 295 if $@
321 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 } })
339 5 163 if (@{$self->{'signatures'};} == 0 and not defined $self->{'signature_reject_reason'})
349 180 2186 if (my($i) = $hdr =~ /ARC-Authentication-Results:\s*i=(\d+)\s*;/i)
350 2 178 if (defined $aars[$i])
373 0 161 if (@{$self->{'algorithms'};} == 0 and @{$self->{'signatures'};} > 0)
390 0 306 unless ($signature->get_tag("d"))
395 4 302 unless ($signature->get_tag("b"))
400 151 151 unless ($signature->isa("Mail::DKIM::ARC::Seal"))
401 2 149 unless ($signature->get_tag("bh"))
405 1 148 if (($signature->get_tag('h') || '') =~ /arc-seal/i)
421 4 295 unless (eval { do { local $SIG{'__DIE__'}; $pkey = $signature->get_public_key; 1 } })
428 0 295 unless ($self->check_public_key($signature, $pkey))
434 2 0 if ($keysize < 1024 and $self->{'Strict'})
445 227 60 $algorithm->verify ? :
448 6 287 unless (eval { do { local $SIG{'__DIE__'}; $result = $algorithm->verify ? "pass" : "fail"; $details = $algorithm->{'verification_details'} || $@; 1 } })
452 6 0 if ($E =~ /(OpenSSL error: .*?) at /) { }
0 0 elsif ($E =~ /^(panic:.*?) at /) { }
467 28 140 if $self->{'result'}
486 0 140 unless (@$seals or @$messages)
502 0 140 if ($#$seals == 0)
507 0 140 if ($#$messages == 0)
513 11 129 if ($#$messages > $#$seals)
522 1 151 unless ($seals->[$i])
527 12 139 unless ($messages->[$i])
537 38 99 if ($result ne "pass")
548 7 71 if (not defined $cv or $cv ne "none")
556 2 14 if ($cv ne "pass")
567 16 53 if ($result ne "pass")
583 5 163 if $self->{'result'} eq "none"
587 177 0 ref $signature eq 'Mail::DKIM::ARC::MessageSignature' ? :
187 177 ref $signature eq 'Mail::DKIM::ARC::Seal' ? :
605 0 0 if @_