Branch Coverage

blib/lib/Crypt/MagicSignatures/Envelope.pm
Criterion Covered Total %
branch 125 154 81.1


line true false branch
28 11 23 if (@_ > 1) { }
30 1 10 if (@_ % 2)
38 1 9 if ($param{'alg'} and uc $param{'alg'} ne 'RSA-SHA256')
45 1 8 if ($param{'encoding'} and lc $param{'encoding'} ne 'base64url')
52 1 7 unless (defined $param{'data'})
61 6 1 if $param{'data'}
65 2 5 if $param{'data_type'}
71 2 2 unless $_->{'value'}
78 1 1 if exists $_->{'key_id'}
93 1 22 unless $string
98 17 5 if (index($string, '<') == 0) { }
2 3 elsif (index($string, '{') == 0) { }
1 2 elsif (index(my $me_c = _trim_all($string), '.YmFzZTY0dXJs.') > 0) { }
105 2 15 unless $env
108 2 15 if (not $env or $env->namespace ne $ME_NS)
117 1 14 unless (defined $data)
125 13 1 if $temp = $data->attr->{'type'}
131 1 13 unless ($self->data)
137 2 11 if ($temp = $env->at('alg') and uc $temp->text ne 'RSA-SHA256')
144 1 10 if ($temp = $env->at('encoding') and lc $temp->text ne 'base64url')
146 1 0 if carp('Encoding is not supported')
152 0 10 unless my $sig_text = $_->text
156 5 5 if ($temp = $_->attr->{'key_id'})
172 0 2 unless (defined $env)
178 8 2 if exists $env->{$_}
184 0 2 unless $self->data
187 0 2 if keys %$env
197 6 0 if $_
201 0 1 unless (lc $value->[4] eq 'base64url')
202 0 0 if carp('Encoding is not supported')
206 0 1 unless (uc $value->[5] eq 'RSA-SHA256')
207 0 0 if carp('Algorithm is not supported')
212 0 1 unless $value->[1]
213 1 0 if defined $value->[0]
218 0 1 unless $value->[2]
220 1 0 if $value->[3]
231 14 6 if $self->{'sigs'}[0]
249 73 25 unless defined $_[1]
267 23 18 unless defined $_[1]
285 1 5 unless @_
287 1 4 unless $self->data
293 1 3 $flag eq '-data' ? :
304 0 4 unless $mkey
307 1 3 unless ($mkey->d)
308 1 0 if carp('Unable to sign without private exponent')
315 0 3 unless $msig
319 2 1 if defined $key_id
343 0 22 unless $self->signed
348 14 8 ref $_ && ref $_ eq 'ARRAY' ? :
353 0 22 unless $mkey
359 22 0 if ($sig)
361 15 7 if ($flag ne '-data')
363 2 13 if $verified
367 13 7 if ($flag eq '-data' or $flag eq '-compatible')
371 13 0 if $verified
386 1 37 unless $self->signed
391 4 33 if ($key_id) { }
395 30 4 unless exists $_->{'key_id'}
410 7 0 if (defined $_->{'key_id'}) { }
413 4 3 if $_->{'key_id'} eq $key_id
435 69 2 unless defined $_[1]
439 1 2 if $sig->{'key_id'} and $sig->{'key_id'} eq $_[1]
451 16 8 if $self->{'sig_base'}
468 4 4 if $self->{'dom'}
471 1 3 unless $self->{'data'}
474 2 1 if (index($self->data_type, 'xml') >= 0)
496 1 4 if ($embed) { }
510 3 2 if exists $self->{'data_type'}
522 2 3 if $sig->{'key_id'}
538 2 2 unless $self->signed
558 2 3 unless $self->data
572 1 1 if defined $sig->{'key_id'}
590 0 26 unless @_
594 6 12 if ($_[-1] eq '-data' or $_[-1] eq '-compatible' or $_[-1] eq '-base')
601 0 26 unless $key
606 0 26 if (ref $key and $key eq 'HASH') { }
607 0 0 unless $key->{'n'}