Branch Coverage

blib/lib/Crypt/PK/ECC.pm
Criterion Covered Total %
branch 51 120 42.5


line true false branch
113 0 1 unless $crv
114 1 0 if (defined $k and length $k > 0) { }
0 0 elsif (defined $x and defined $y) { }
115 0 1 if length($k) % 2
119 0 0 if length($x) % 2
120 0 0 if length($y) % 2
121 0 0 if length $y != length $x
129 80 205 @_ > 0 ? :
136 0 8 unless $key
138 4 4 if $type =~ /\Aprivate(?:_short|_compressed)?\z/
140 4 0 if $type =~ /\Apublic(?:_short|_compressed)?\z/
147 0 0 unless defined $kh->{'curve_oid'}
148 0 0 unless defined $kh->{'curve_name'}
150 0 0 if ($type and $type eq 'private') { }
0 0 elsif ($type and $type eq 'public') { }
151 0 0 unless $kh->{'pub_x'} and $kh->{'pub_y'} and $kh->{'k'}
153 0 0 if length($kh->{$_}) % 2
163 0 0 $wanthash ? :
166 0 0 unless $kh->{'pub_x'} and $kh->{'pub_y'}
168 0 0 if length($kh->{$_}) % 2
175 0 0 $wanthash ? :
191 0 122 unless $key
194 1 121 if (ref $key eq "HASH")
195 1 0 if ($key->{'pub_x'} and $key->{'pub_y'} or $key->{'k'})
200 0 0 if ($key->{'crv'} and $key->{'kty'} and $key->{'kty'} eq "EC" and $key->{'d'} || $key->{'x'} && $key->{'y'})
204 0 0 if exists $key->{$_}
213 23 98 if (ref $key eq 'SCALAR') { }
98 0 elsif (-f $key) { }
222 0 121 unless $data
224 65 56 if ($data =~ /(-----BEGIN (PUBLIC|EC PRIVATE|PRIVATE|ENCRYPTED PRIVATE) KEY-----(.+?)-----END (PUBLIC|EC PRIVATE|PRIVATE|ENCRYPTED PRIVATE) KEY-----)/s) { }
0 56 elsif ($data =~ /-----BEGIN CERTIFICATE-----(.+?)-----END CERTIFICATE-----/s) { }
6 50 elsif ($data =~ /-----BEGIN OPENSSH PRIVATE KEY-----(.+?)-----END OPENSSH PRIVATE KEY-----/s) { }
3 47 elsif ($data =~ /---- BEGIN SSH2 PUBLIC KEY ----(.+?)---- END SSH2 PUBLIC KEY ----/s) { }
3 44 elsif ($data =~ /(ecdsa-\S+)\s+(\S+)/) { }
0 44 elsif ($data =~ /^\s*(\{.*?\})\s*$/s) { }
227 9 56 unless ($rv)
229 9 0 if defined $der
231 60 5 if $rv
245 3 0 if $pubkey and $typ =~ /^ecdsa-(.+?)-(.*)$/
251 0 0 if ($h->{'kty'} eq "EC")
252 0 0 if exists $h->{'x'}
253 0 0 if exists $h->{'y'}
254 0 0 if exists $h->{'d'}
264 43 1 if $rv
289 1 0 unless ref $key
290 0 1 unless ref $key eq __PACKAGE__
297 1 0 unless ref $key
298 0 1 unless ref $key eq __PACKAGE__
305 1 0 unless ref $key
306 0 1 unless ref $key eq __PACKAGE__
313 1 0 unless ref $key
314 0 1 unless ref $key eq __PACKAGE__
321 1 0 unless ref $key
322 0 1 unless ref $key eq __PACKAGE__
329 1 0 unless ref $key
330 0 1 unless ref $key eq __PACKAGE__
337 2 0 unless ref $privkey
338 2 0 unless ref $pubkey
339 0 2 unless ref $privkey eq __PACKAGE__ and $privkey->is_private
340 0 2 unless ref $pubkey eq __PACKAGE__