Branch Coverage

blib/lib/Crypt/MagicSignatures/Envelope.pm
Criterion Covered Total %
branch 90 150 60.0


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 4 unless @_
262 1 3 $flag eq '-data' ? :
273 4 0 if ($mkey)
276 1 3 unless ($mkey->d)
277 1 0 if carp('Unable to sign without private exponent')
284 0 3 unless $msig
288 2 1 if defined $key_id
315 0 22 unless $self->signed
320 14 8 ref $_ && ref $_ eq 'ARRAY' ? :
325 0 22 unless $mkey
331 22 0 if ($sig)
333 15 7 if ($flag ne '-data')
335 2 13 if $verified
339 13 7 if ($flag eq '-data' or $flag eq '-compatible')
343 13 0 if $verified
358 0 36 unless $self->signed
363 32 4 if (not $key_id) { }
367 29 4 unless exists $_->{'key_id'}
382 7 0 if (defined $_->{'key_id'}) { }
385 4 3 if $_->{'key_id'} eq $key_id
407 65 0 unless defined $_[1]
411 0 0 if $sig->{'key_id'} eq $_[1]
440 4 3 if $self->{'dom'}
443 2 1 if (index($self->data_type, 'xml') >= 0)
465 0 2 if ($embed) { }
479 2 0 if exists $self->{'data_type'}
491 0 1 if $sig->{'key_id'}
507 1 2 unless $self->signed
527 0 2 unless $self->data
541 0 0 if defined $sig->{'key_id'}
558 0 26 unless @_
562 6 12 if ($_[-1] eq '-data' or $_[-1] eq '-compatible' or $_[-1] eq '-base')
569 0 26 unless $key
574 0 26 if (ref $key and $key eq 'HASH') { }
575 0 0 unless $key->{'n'}