Branch Coverage

blib/lib/Crypt/MagicSignatures/Envelope.pm
Criterion Covered Total %
branch 88 148 59.4


line true false branch
28 5 14 if (@_ > 1 and not @_ % 2) { }
33 0 5 if ($self{'alg'} and uc $self{'alg'} ne 'RSA-SHA256')
35 0 0 if carp('Algorithm is not supported')
39 0 5 if ($self{'encoding'} and lc $self{'encoding'} ne 'base64url')
41 0 0 if carp('Encoding is not supported')
45 0 5 unless (defined $self{'data'})
46 0 0 if carp('No data payload defined')
57 2 3 if $self{'data_type'}
63 0 0 unless $_->{'value'}
70 0 0 if exists $_->{'key_id'}
85 11 3 if (index($string, '<') == 0) { }
2 1 elsif (index($string, '{') == 0) { }
1 0 elsif (index(my $me_c = _trim_all($string), '.YmFzZTY0dXJs.') > 0) { }
92 0 11 unless $env
95 0 11 if not $env or $env->namespace ne $ME_NS
101 0 11 unless $data
106 11 0 if $temp = $data->attr->{'type'}
112 0 11 unless $self->data
115 1 10 if ($temp = $env->at('alg') and uc $temp->text ne 'RSA-SHA256')
117 1 0 if carp('Algorithm is not supported')
121 1 9 if ($temp = $env->at('encoding') and lc $temp->text ne 'base64url')
123 1 0 if carp('Encoding is not supported')
129 0 9 unless my $sig_text = $_->text
133 4 5 if ($temp = $_->attr->{'key_id'})
149 0 2 unless (defined $env)
155 8 2 if exists $env->{$_}
161 0 2 unless $self->data
164 0 2 if keys %$env
174 6 0 if $_
178 0 1 unless (lc $value->[4] eq 'base64url')
179 0 0 if carp('Encoding is not supported')
183 0 1 unless (uc $value->[5] eq 'RSA-SHA256')
184 0 0 if carp('Algorithm is not supported')
189 0 1 unless $value->[1]
190 1 0 if defined $value->[0]
195 0 1 unless $value->[2]
197 1 0 if $value->[3]
202 12 5 if $self->{'sigs'}[0]
220 55 19 unless defined $_[1]
238 19 15 unless defined $_[1]
256 0 3 unless @_
262 1 2 $flag eq '-data' ? :
273 3 0 if ($mkey)
276 0 3 unless $mkey->d
282 0 3 unless $msig
286 2 1 if defined $key_id
313 0 22 unless $self->signed
318 14 8 ref $_ && ref $_ eq 'ARRAY' ? :
323 0 22 unless $mkey
329 22 0 if ($sig)
331 15 7 if ($flag ne '-data')
333 2 13 if $verified
337 13 7 if ($flag eq '-data' or $flag eq '-compatible')
341 13 0 if $verified
356 0 36 unless $self->signed
361 32 4 if (not $key_id) { }
365 29 4 unless exists $_->{'key_id'}
380 7 0 if (defined $_->{'key_id'}) { }
383 4 3 if $_->{'key_id'} eq $key_id
405 65 0 unless defined $_[1]
409 0 0 if $sig->{'key_id'} eq $_[1]
438 4 3 if $self->{'dom'}
441 2 1 if (index($self->data_type, 'xml') >= 0)
463 0 2 if ($embed) { }
477 2 0 if exists $self->{'data_type'}
489 0 1 if $sig->{'key_id'}
505 1 2 unless $self->signed
525 0 2 unless $self->data
539 0 0 if defined $sig->{'key_id'}
556 0 25 unless @_
560 6 11 if ($_[-1] eq '-data' or $_[-1] eq '-compatible' or $_[-1] eq '-base')
567 0 25 unless $key
572 0 25 if (ref $key and $key eq 'HASH') { }
573 0 0 unless $key->{'n'}