Branch Coverage

blib/lib/Convert/PEM.pm
Criterion Covered Total %
branch 87 136 63.9


line true false branch
29 20 0 if (exists $param{'Name'}) { }
34 15 5 if exists $param{'ASN'}
35 0 20 if exists $param{'Cipher'}
38 15 5 if (exists $pem->{'ASN'})
41 0 15 unless $asn->prepare($pem->{'ASN'})
45 0 20 unless $pem->_getform(%param)
53 6 14 defined $param{'InForm'} ? :
54 0 20 unless $in =~ /^(PEM|DER)$/
57 6 14 defined $param{'OutForm'} ? :
58 0 20 unless $out =~ /^(PEM|DER)$/
68 138 15 $m ? :
84 0 56 unless open my $FH, $fname
90 7 49 $pem->{'InForm'} eq 'DER' ? :
100 0 29 unless my $fname = delete $param{'Filename'}
102 4 25 $pem->{'OutForm'} eq 'DER' ? :
106 0 29 unless open my $FH, ">$fname"
120 51 11 if (exists $pem->{'ASN'}) { }
122 43 8 if (my $macro = $param{'Macro'} || $pem->{'Macro'})
123 0 43 unless $asn = $asn->find($macro)
126 0 51 unless $obj = $asn->decode($param{'DER'})
138 0 59 if (exists $param{'DER'})
140 0 59 unless my $blob = $param{'Content'}
143 0 59 unless my $dec = $pem->explode($blob)
146 0 59 unless $dec->{'Object'} eq $name
151 43 16 if (%headers and $headers{'Proc-Type'} eq "4,ENCRYPTED")
155 4 39 unless $buf = $pem->decrypt("Ciphertext", $buf, "Info", $headers{'DEK-Info'}, "Password", $param{'Password'})
158 0 55 unless my $obj = $pem->from_der(%param)
169 101 4 if (exists $pem->{'ASN'}) { }
171 94 7 if (my $macro = $param{'Macro'} || $pem->{'Macro'})
172 0 94 unless $asn = $asn->find($macro)
175 0 101 unless $buf = $asn->encode($param{'Content'})
190 21 48 if ($param{'Password'})
192 0 21 unless ($buf, $info) = $pem->encrypt("Plaintext", $buf, %param)
216 46 16 if ($headers)
219 95 0 if $k
238 22 48 if $headers
257 1 1 wantarray ? :
261 0 0 ref $_[0] || $_[0] eq __PACKAGE__ ? :
262 0 0 if (defined $_[0])
268 0 0 wantarray ? :
273 28 7 ref $_[0] || $_[0] eq __PACKAGE__ ? :
275 21 0 if exists $Convert::PEM::CTYPES{$cn} and exists $Convert::PEM::CTYPES{$cn}{'c'}
278 2 8 if ($1) { }
2 6 elsif ($2) { }
284 6 0 $4 ? :
0 6 $5 ? :
294 0 0 ref $_[0] || $_[0] eq __PACKAGE__ ? :
295 0 0 if (my $cn = has_cipher($_[0]))
297 0 0 if ($@)
304 27 0 ref $_[0] || $_[0] eq __PACKAGE__ ? :
307 27 0 unless defined $all
309 27 0 if (exists $Convert::PEM::CTYPES{$cn})
311 13 14 if ($@)
312 14 0 if ($all and exists $Convert::PEM::CTYPES{$cn}{'c'}) { }
315 30 110 if $def->{'c'} eq $old_cm
332 0 43 unless my $cmod = $Convert::PEM::CTYPES{$ctype}
335 0 43 unless eval "use $cmod->{'c'}; 1;"
341 4 39 unless my $buf = $cbc->decrypt($param{'Ciphertext'})
349 0 21 unless $param{'Password'}
351 3 18 unless $param{'Cipher'}
353 0 21 unless my $cmod = $Convert::PEM::CTYPES{$ctype}
355 0 21 unless eval "use $cmod->{'c'}; 1;"
358 0 21 unless my $iv = $pem->_getiv(%param, "bs", $cmod->{'bs'})
365 0 21 unless my $buf = $cbc->encrypt($param{'Plaintext'})
375 1 20 if (exists $p{'IV'})
376 1 0 if ($p{'IV'} =~ /^[a-fA-F\d]+$/) { }
379 1 0 length $iv == $p{'bs'} ? :
387 0 20 if length $iv != $p{'bs'}