Branch Coverage

blib/lib/Mail/DKIM/Verifier.pm
Criterion Covered Total %
branch 65 92 70.6


line true false branch
60 70 631 if (lc $field_name eq "dkim-signature")
66 1 69 unless (eval { do { local $SIG{'__DIE__'}; my $signature = "Mail::DKIM::Signature"->parse($line); $self->add_signature($signature); 1 } })
78 17 684 if (lc $field_name eq "domainkey-signature")
84 0 17 unless (eval { do { local $SIG{'__DIE__'}; my $signature = "Mail::DKIM::DkSignature"->parse($line); $self->add_signature($signature); 1 } })
99 0 86 unless @_ == 1
104 0 86 if @{$self->{'signatures'};} > $MAX_SIGNATURES_TO_PROCESS
108 13 73 unless ($self->check_signature($signature))
125 58 15 if ($algorithm->wants_pre_signature_headers)
141 0 86 unless @_ == 1
144 1 85 unless ($signature->check_version)
147 1 0 if (defined $signature->version) { }
157 2 83 unless ($signature->algorithm and $signature->get_algorithm_class($signature->algorithm))
162 2 0 if (defined $signature->algorithm)
168 4 79 if ($self->{'Strict'})
169 2 2 if ($signature->algorithm eq "rsa-sha1")
171 2 0 if (defined $signature->algorithm)
178 2 79 unless ($signature->check_canonicalization)
182 2 0 if (defined $signature->canonicalization)
189 4 75 unless ($signature->check_protocol)
193 0 4 !defined($signature->protocol) ? :
199 2 73 unless ($signature->check_expiration)
206 0 73 unless (defined $signature->domain)
213 0 73 if ($signature->domain eq "")
220 0 73 unless (defined $signature->selector)
232 0 59 unless @_ == 2
257 5 52 if $@
259 7 52 unless (eval { do { local $SIG{'__DIE__'}; $@ = undef; $result = $public_key->check_hash_algorithm($signature->hash_algorithm); my $empty_g_means_wildcard = $signature->isa("Mail::DKIM::DkSignature"); $result &&= $public_key->check_granularity($signature->identity, $empty_g_means_wildcard); die $@ if $@; 1 } })
275 73 0 if (defined $i and $i =~ /\@([^\@]*)$/)
282 0 73 unless @_ == 2
299 1 80 if (@{$self->{'signatures'};} == 0 and not defined $self->{'signature_reject_reason'})
316 12 68 if (@{$self->{'algorithms'};} == 0 and @{$self->{'signatures'};} > 0)
332 3 70 unless (check_signature_identity($signature))
340 11 59 unless (eval { do { $pkey = $signature->get_public_key; 1 } })
347 7 52 unless ($self->check_public_key($signature, $pkey))
353 49 3 if ($k eq "rsa")
356 1 26 if ($keysize < 1024 and $self->{'Strict'})
367 39 10 $algorithm->verify ? :
370 2 49 unless (eval { do { $result = $algorithm->verify ? "pass" : "fail"; $details = $algorithm->{'verification_details'} || $@; 1 } })
374 2 0 if ($E =~ /(OpenSSL error: .*?) at /) { }
0 0 elsif ($E =~ /^(panic:.*?) at /) { }
0 0 elsif ($E =~ /^FATAL: (.*) at /) { }
407 70 3 if (not $self->{'result'} or $result eq "pass")
420 0 0 unless $self->{'headers_by_name'}{'from'}
473 0 0 $sender_policy ? :
0 0 $author_policy ? :
484 0 4 if @_