Branch Coverage

blib/lib/Crypt/PK/ECC.pm
Criterion Covered Total %
branch 53 126 42.0


line true false branch
112 0 1 unless $crv
113 1 0 if (defined $k and length $k > 0) { }
0 0 elsif (defined $x and defined $y) { }
114 0 1 if length($k) % 2
118 0 0 if length($x) % 2
119 0 0 if length($y) % 2
120 0 0 if length $y != length $x
128 60 193 @_ > 0 ? :
135 0 8 unless $key
136 4 4 if substr($type, 0, 7) eq "private"
137 4 0 if substr($type, 0, 6) eq "public"
144 0 0 unless defined $kh->{'curve_oid'}
145 0 0 unless defined $kh->{'curve_name'}
147 0 0 if ($type and $type eq 'private') { }
0 0 elsif ($type and $type eq 'public') { }
148 0 0 unless $kh->{'pub_x'} and $kh->{'pub_y'} and $kh->{'k'}
150 0 0 if length($kh->{$_}) % 2
160 0 0 $wanthash ? :
163 0 0 unless $kh->{'pub_x'} and $kh->{'pub_y'}
165 0 0 if length($kh->{$_}) % 2
172 0 0 $wanthash ? :
188 0 87 unless $key
191 1 86 if (ref $key eq "HASH")
192 1 0 if ($key->{'pub_x'} and $key->{'pub_y'} or $key->{'k'})
197 0 0 if ($key->{'crv'} and $key->{'kty'} and $key->{'kty'} eq "EC" and $key->{'d'} || $key->{'x'} && $key->{'y'})
201 0 0 if exists $key->{$_}
210 5 81 if (ref $key eq 'SCALAR') { }
81 0 elsif (-f $key) { }
219 0 86 unless $data
221 37 49 if ($data =~ /-----BEGIN (EC PRIVATE|EC PUBLIC|PUBLIC) KEY-----(.*?)-----END/gs) { }
2 47 elsif ($data =~ /-----BEGIN PRIVATE KEY-----(.*?)-----END/gs) { }
2 45 elsif ($data =~ /-----BEGIN ENCRYPTED PRIVATE KEY-----(.*?)-----END/gs) { }
0 45 elsif ($data =~ /^\s*(\{.*?\})\s*$/s) { }
0 45 elsif ($data =~ /-----BEGIN CERTIFICATE-----(.*?)-----END CERTIFICATE-----/gs) { }
3 42 elsif ($data =~ /---- BEGIN SSH2 PUBLIC KEY ----(.*?)---- END SSH2 PUBLIC KEY ----/gs) { }
3 39 elsif ($data =~ /(ecdsa-\S+)\s+(\S+)/) { }
222 0 37 unless $data = pem_to_der($data, $password)
224 37 0 if $rv
227 0 2 unless $data = pem_to_der($data, $password)
231 0 2 unless $data = pem_to_der($data, $password)
238 0 0 if ($h and $h->{'kty'} eq "EC")
240 0 0 if exists $h->{$_}
247 0 0 unless $data = pem_to_der($data)
251 0 3 unless $data = pem_to_der($data)
253 3 0 if $pubkey and $typ =~ /^ecdsa-(.+?)-(.*)$/
258 3 0 if $pubkey and $typ =~ /^ecdsa-(.+?)-(.*)$/
265 39 0 if $rv
290 1 0 unless ref $key
291 0 1 unless ref $key eq "Crypt::PK::ECC"
298 1 0 unless ref $key
299 0 1 unless ref $key eq "Crypt::PK::ECC"
306 1 0 unless ref $key
307 0 1 unless ref $key eq "Crypt::PK::ECC"
314 1 0 unless ref $key
315 0 1 unless ref $key eq "Crypt::PK::ECC"
322 1 0 unless ref $key
323 0 1 unless ref $key eq "Crypt::PK::ECC"
330 1 0 unless ref $key
331 0 1 unless ref $key eq "Crypt::PK::ECC"
338 2 0 unless ref $privkey
339 2 0 unless ref $pubkey
340 0 2 unless ref $privkey eq "Crypt::PK::ECC" and $privkey->is_private
341 0 2 unless ref $pubkey eq "Crypt::PK::ECC"