Branch Coverage

blib/lib/Crypt/PKCS10.pm
Criterion Covered Total %
branch 252 410 61.4


line true false branch
434 0 0 if $c
448 0 0 if $len > $max[0]
449 0 0 if (exists $variantNames{$oid}) { }
451 0 0 if $len > $max[1]
453 0 0 if $len > $max[2]
456 0 0 if $len > $max[1]
466 0 0 exists $variantNames{$oid} ? :
467 0 0 if exists $variantNames{$oid}
485 0 2 unless @_ == 2 and defined $class and not ref $class
486 0 2 unless defined $version
487 0 2 unless $version >= 0 and $version <= 1
493 46 90 if /^\d/
503 0 2 unless defined $class
505 0 2 if ref $class and $class->isa("Crypt::PKCS10")
514 0 4 unless defined $class
516 0 4 unless defined $oid and defined $apiVersion and $apiVersion > 0
525 0 4 unless defined $class
527 0 4 unless defined $apiVersion and $apiVersion > 0
538 1 74 unless $oid
540 24 50 if (exists $oids{$oid}) { }
1 49 elsif (exists $oid2extkeyusage{$oid}) { }
556 0 11 unless defined $class
558 0 11 unless (defined $apiVersion)
563 3 8 if @_ == 2 and defined $oid
565 0 7 unless @_ >= 3 and defined $oid and defined $longname || defined $shortname
566 1 6 unless defined $oid and $oid =~ /^\d+(?:\.\d+)*$/
568 3 3 if (defined $longname) { }
569 1 2 if exists $oids{$oid} or exists $oid2extkeyusage{$oid}
570 1 1 if grep /^$longname$/, values %oids
572 1 0 unless exists $oids{$oid} or exists $oid2extkeyusage{$oid}
574 1 2 if defined $shortname and grep /^\U$shortname\E$/, values %shortnames
577 1 1 if (defined $longname) { }
583 1 1 if defined $shortname
592 0 16 if defined $class and ref $class and $class->isa("Crypt::PKCS10")
594 0 16 unless (defined $apiVersion)
601 0 16 unless defined $class and @_ >= 1
602 1 15 if $void
604 4 12 if ($@)
606 2 1 if (not $apiVersion or $die or not defined wantarray)
619 0 1 unless defined $class
621 0 1 if (ref $class and $class->isa("Crypt::PKCS10"))
642 1 14 if @_ >= 1 and ref $_[0] eq "HASH"
644 0 15 unless @_ % 2 == 0
646 15 0 if @_
656 1 14 unless defined $der
658 0 14 if (keys %options)
662 13 1 unless exists $self->{'_binaryMode'}
670 9 5 if ($self->{'_readFile'})
671 0 9 unless open my $fh, "<", $der
675 11 3 if (&Scalar::Util::openhandle($der))
678 2 9 if $self->{'_binaryMode'}
681 0 11 unless defined $der
686 2 12 if ($self->{'_PEMonly'}) { }
9 6 elsif ($self->{'_acceptPEM'} and $der =~ /$pemre/) { }
687 1 1 if ($der =~ /$pemre/) { }
697 10 3 if ($isPEM)
702 1 9 if $self->{'_ignoreNonBase64'}
704 1 9 unless ($der =~ m[\A[A-Za-z0-9+/]+={0,2}\z] and length($der) % 4 == 0)
717 0 12 unless $tlen and $tag == 16
720 0 12 unless $llen and $len
724 0 12 if $tlen < $len
726 0 2 if ($tlen != $len and $self->{'_warnings'})
732 0 12 if ($@)
745 0 12 unless $asn->prepare($schema)
752 0 12 unless my $top = $parser->decode($der)
783 4 8 if ($self->{'signatureAlgorithm'}{'algorithm'} eq "rsassaPss")
792 3 1 if $params->{'digestAlgorithm'}{'algorithm'}
795 3 1 if $params->{'maskGenAlgorithm'}{'algorithm'}
806 0 12 unless $CRtag == 16
811 0 12 unless $CItag == 16
816 0 12 if $self->{'_verifySignature'} and not $self->checkSignature
844 111 102 unless ref $value
845 24 78 if (ref $value eq "ARRAY")
851 78 0 if (ref $value eq "HASH")
853 3 102 if ($k eq "bmpString")
857 6 96 if ($k eq "iPAddress")
860 3 3 if (length $addr == 4) { }
883 12 0 if defined $signatureAlgorithm->{'algorithm'} and exists $oids{$signatureAlgorithm->{'algorithm'}}
896 12 0 if defined $pkinfo->{'algorithm'}{'algorithm'} and exists $oids{$pkinfo->{'algorithm'}{'algorithm'}}
1049 0 24 if defined $name and exists $variantNames{$name}
1051 0 24 unless defined $name
1055 6 18 if ($name eq 'extensionRequest') { }
3 15 elsif ($name eq 'ENROLLMENT_NAME_VALUE_PAIR') { }
1062 0 3 unless my $pair = $parser->decode($der)
1070 0 15 unless my $parser = $self->_init($name, 1)
1072 0 15 if ($entry->{'values'}[1])
1075 0 15 unless my $value = $entry->{'values'} = $parser->decode($entry->{'values'}[0])
1078 9 6 if (exists $special{$name})
1092 0 6 unless my $decoded = $parser->decode($extensionRequest)
1096 14 13 if defined $name and exists $variantNames{$name}
1097 27 0 if (defined $name)
1101 0 27 unless ($parser)
1106 0 27 unless my $dec = $parser->decode($entry->{'extnValue'})
1111 21 6 if (exists $special{$asnName})
1129 0 47 exists $variantNames{$oid} ? :
1130 47 0 if (defined $name)
1133 0 47 exists $variantNames{$oid} ? :
1135 2 45 unless ($self->can($name))
1139 1 1 if wantarray
1157 0 107 unless (defined $parsed or $optional)
1171 3 3 if $format
1186 0 7 unless $self->{'certificationRequestInfo'}{'subject'}{$component}
7 2 if wantarray
1198 1 4 if wantarray
1205 18 1 if not $long and exists $shortnames{$name}
1223 1 4 if (scalar @sequence > 1) { }
1239 0 4 unless (defined $san)
1240 0 0 if wantarray
1244 2 2 unless (defined $type)
1245 1 1 if (wantarray)
1259 1 1 if wantarray
1278 2 2 if $format
1286 1 3 unless $self->{'_apiVersion'} >= 1
1293 0 3 unless defined $at
1297 0 3 if ($at eq "rsassaPss")
1302 2 1 if ($at eq 'rsaEncryption') { }
0 1 elsif ($at eq 'ecPublicKey') { }
1 0 elsif ($at eq 'dsa') { }
1310 0 2 ref $rsa->{'publicExponent'} ? :
1315 0 0 if ($@)
1319 0 0 if $self->{'_dieOnError'}
1327 0 0 if $detail
1331 0 0 if $rv->{'curve'}
1337 1 0 if (exists $self->{'certificationRequestInfo'}{'subjectPKInfo'}{'algorithm'}{'parameters'})
1348 0 0 if $self->{'_dieOnError'}
1361 0 1 unless exists $self->{'signatureAlgorithm'}{'parameters'}
1364 0 1 if (ref $self->{'signatureAlgorithm'}{'parameters'} eq "HASH")
1369 0 1 if ($tlen != 0 and $tag != 5)
1382 7 2 if (defined $format and $format == 2)
1383 0 7 if ($self->pkAlgorithm eq "ecPublicKey")
1389 0 2 if $format
1404 0 55 unless defined $attributes
1413 0 22 if ($self->{'_apiVersion'} < 1)
1415 0 0 unless defined $attributes
1423 0 22 unless (defined $attributes)
1424 0 0 if wantarray
1428 5 17 unless (defined $name)
1434 0 17 if ($name eq "extensionRequest")
1435 0 0 if wantarray
1444 1 16 unless (@attrs)
1445 0 1 if wantarray
1452 13 3 unless ref $values eq "ARRAY"
1455 5 11 wantarray ? :
1458 5 11 if wantarray
1460 11 0 if (@values == 1)
1482 23 20 unless ref $hash eq "HASH"
1486 1 19 if defined $exclude
1488 9 11 if @keys != 1
1490 4 7 if ref $$hash{$keys[0]} eq "HASH"
1502 10 89 if (ref $value eq "ARRAY")
1506 9 1 if @strings > 1
1509 25 64 if (ref $value eq "HASH")
1513 15 10 if @strings > 1
1517 10 54 if $value =~ /^\d+$/
1521 8 46 if $self->{'_escapeStrings'}
1523 44 10 if $value =~ m(\A[\w!\@$%^&*_=+\[\]\{\}:;|<>./?"'-]+\z)
1532 0 4 unless defined $attributes and exists $attributes->{'extensionRequest'}
1535 4 0 if ($self->{'_apiVersion'} >= 1)
1537 10 5 if exists $variantNames{"\$" . $ext}
1549 0 23 unless defined $attributes and exists $attributes->{'extensionRequest'}
1553 10 13 if exists $variantNames{$extensionName}
1556 21 55 if ($entry->{'extnID'} eq $extensionName)
1558 1 20 if ($self->{'_apiVersion'} == 0) { }
1564 3 17 if ($entry->{'_FMT'}) { }
1565 2 1 $format ? :
1568 8 9 if $format
1574 10 13 if $format
1584 0 6 unless defined $attributes and exists $attributes->{'extensionRequest'}
1588 4 2 if exists $variantNames{$extensionName}
1591 5 13 if ($entry->{'extnID'} eq $extensionName)
1592 2 3 if $entry->{'critical'}
1606 0 0 unless $self->{'_apiVersion'} >= 1
1615 0 0 if ($alg =~ /sha-?(\d+)/i) { }
0 0 elsif ($alg =~ /md-?(\d)/i) { }
0 0 elsif ($alg eq 'rsassaPss') { }
1635 0 0 unless defined $keyp->{'keytype'}
1639 0 0 if ($keyp->{'keytype'} eq "RSA")
1642 0 0 if $@
1653 0 0 if $alg ne "rsassaPss"
1658 0 0 if ($keyp->{'keytype'} eq "DSA")
1661 0 0 if $@
1667 0 0 if ($keyp->{'keytype'} eq "ECC")
1669 0 0 if $@
1677 0 0 if ($@)
1680 0 0 if $self->{'_dieOnError'}
1683 0 0 if $ok
1687 0 0 if $self->{'_dieOnError'}
1707 0 15 if length $text <= 65
1721 0 1 unless defined $v and $v == 1
1725 0 1 unless defined $self
1730 0 1 unless defined $v and $v == 1
1732 0 1 unless defined $string
1733 0 1 if $at
1744 3 10 if length $_ > $max
1753 0 1 unless $self->attributes
1761 0 1 unless $self->extensions
1764 1 2 $self->extensionPresent($_) == 2 ? :
1766 0 3 $_ eq 'subjectAltName' ? :
1780 0 4 if (not defined $v || defined($v = $self->error)) { }
0 4 elsif (ref $v) { }
1787 0 1 if (exists $kp->{'detail'})
1791 0 0 if ref $kp->{$_}
1799 0 1 if ($sp)
1803 0 0 if (ref $v)
1804 0 0 if ($v->can('as_hex')) { }