Branch Coverage

blib/lib/Crypt/PK/RSA.pm
Criterion Covered Total %
branch 50 104 48.0


line true false branch
21 30 77 @_ > 0 ? :
28 0 3 unless $key
33 1 2 if $type eq "private"
36 1 1 if $type eq "public"
38 1 0 if $type eq "public_x509"
45 0 0 if ($type eq 'private') { }
0 0 elsif ($type eq 'public') { }
46 0 0 unless $kh->{'N'} and $kh->{'e'} and $kh->{'d'} and $kh->{'p'} and $kh->{'q'} and $kh->{'dP'} and $kh->{'dQ'} and $kh->{'qP'}
48 0 0 if length($kh->{$_}) % 2
61 0 0 $wanthash ? :
64 0 0 unless $kh->{'N'} and $kh->{'e'}
66 0 0 if length($kh->{$_}) % 2
73 0 0 $wanthash ? :
89 0 144 unless $key
92 1 143 if (ref $key eq "HASH")
93 1 0 if ($key->{'N'} and $key->{'e'})
97 0 0 if ($key->{'n'} and $key->{'e'} and $key->{'kty'} and $key->{'kty'} eq "RSA")
102 0 0 if exists $key->{$_}
110 72 71 if (ref $key eq 'SCALAR') { }
71 0 elsif (-f $key) { }
119 0 143 unless $data
121 39 104 if ($data =~ /-----BEGIN (RSA PRIVATE|RSA PUBLIC|PUBLIC) KEY-----(.*?)-----END/gs) { }
1 103 elsif ($data =~ /-----BEGIN PRIVATE KEY-----(.*?)-----END/gs) { }
1 102 elsif ($data =~ /-----BEGIN ENCRYPTED PRIVATE KEY-----(.*?)-----END/gs) { }
0 102 elsif ($data =~ /^\s*(\{.*?\})\s*$/s) { }
1 101 elsif ($data =~ /-----BEGIN CERTIFICATE-----(.*?)-----END CERTIFICATE-----/gs) { }
6 95 elsif ($data =~ /---- BEGIN SSH2 PUBLIC KEY ----(.*?)---- END SSH2 PUBLIC KEY ----/gs) { }
6 89 elsif ($data =~ /ssh-rsa\s+(\S+)/) { }
125 0 39 unless $data = pem_to_der($data, $password)
126 39 0 if $data
130 0 1 unless $data = pem_to_der($data, $password)
135 0 1 unless $data = pem_to_der($data, $password)
142 0 0 if ($h and $h->{'kty'} eq "RSA")
144 0 0 if exists $h->{$_}
146 0 0 if $h->{'n'} and $h->{'e'}
150 0 1 unless $data = pem_to_der($data)
154 0 6 unless $data = pem_to_der($data)
156 6 0 if $typ and $e and $N and $typ eq "ssh-rsa"
161 6 0 if $typ and $e and $N and $typ eq "ssh-rsa"
166 89 0 if $rv
177 1 0 unless ref $key
178 0 1 unless ref $key eq "Crypt::PK::RSA"
185 1 0 unless ref $key
186 0 1 unless ref $key eq "Crypt::PK::RSA"
193 1 0 unless ref $key
194 0 1 unless ref $key eq "Crypt::PK::RSA"
201 1 0 unless ref $key
202 0 1 unless ref $key eq "Crypt::PK::RSA"
209 1 0 unless ref $key
210 0 1 unless ref $key eq "Crypt::PK::RSA"
217 1 0 unless ref $key
218 0 1 unless ref $key eq "Crypt::PK::RSA"