Branch Coverage

blib/lib/Crypt/PKCS10.pm
Criterion Covered Total %
branch 247 404 61.1


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 69 unless $oid
540 22 47 if (exists $oids{$oid}) { }
1 46 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 13 if defined $class and ref $class and $class->isa("Crypt::PKCS10")
594 0 13 unless (defined $apiVersion)
601 0 13 unless defined $class and @_ >= 1
602 1 12 if $void
604 4 9 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 11 if @_ >= 1 and ref $_[0] eq "HASH"
644 0 12 unless @_ % 2 == 0
646 12 0 if @_
656 1 11 unless defined $der
658 0 11 if (keys %options)
662 10 1 unless exists $self->{'_binaryMode'}
670 6 5 if ($self->{'_readFile'})
671 0 6 unless open my $fh, "<", $der
675 8 3 if (&Scalar::Util::openhandle($der))
678 2 6 if $self->{'_binaryMode'}
681 0 8 unless defined $der
686 2 9 if ($self->{'_PEMonly'}) { }
6 6 elsif ($self->{'_acceptPEM'} and $der =~ /$pemre/) { }
687 1 1 if ($der =~ /$pemre/) { }
697 7 3 if ($isPEM)
702 1 6 if $self->{'_ignoreNonBase64'}
704 1 6 unless ($der =~ m[\A[A-Za-z0-9+/]+={0,2}\z] and length($der) % 4 == 0)
717 0 9 unless $tlen and $tag == 16
720 0 9 unless $llen and $len
724 0 9 if $tlen < $len
726 0 2 if ($tlen != $len and $self->{'_warnings'})
732 0 9 if ($@)
745 0 9 unless $asn->prepare($schema)
752 0 9 unless my $top = $parser->decode($der)
783 1 8 if ($self->{'signatureAlgorithm'}{'algorithm'} eq "rsassaPss")
798 0 9 unless $CRtag == 16
803 0 9 unless $CItag == 16
808 0 9 if $self->{'_verifySignature'} and not $self->checkSignature
836 111 102 unless ref $value
837 24 78 if (ref $value eq "ARRAY")
843 78 0 if (ref $value eq "HASH")
845 3 102 if ($k eq "bmpString")
849 6 96 if ($k eq "iPAddress")
852 3 3 if (length $addr == 4) { }
875 9 0 if defined $signatureAlgorithm->{'algorithm'} and exists $oids{$signatureAlgorithm->{'algorithm'}}
888 9 0 if defined $pkinfo->{'algorithm'}{'algorithm'} and exists $oids{$pkinfo->{'algorithm'}{'algorithm'}}
1041 0 24 if defined $name and exists $variantNames{$name}
1043 0 24 unless defined $name
1047 6 18 if ($name eq 'extensionRequest') { }
3 15 elsif ($name eq 'ENROLLMENT_NAME_VALUE_PAIR') { }
1054 0 3 unless my $pair = $parser->decode($der)
1062 0 15 unless my $parser = $self->_init($name, 1)
1064 0 15 if ($entry->{'values'}[1])
1067 0 15 unless my $value = $entry->{'values'} = $parser->decode($entry->{'values'}[0])
1070 9 6 if (exists $special{$name})
1084 0 6 unless my $decoded = $parser->decode($extensionRequest)
1088 14 13 if defined $name and exists $variantNames{$name}
1089 27 0 if (defined $name)
1093 0 27 unless ($parser)
1098 0 27 unless my $dec = $parser->decode($entry->{'extnValue'})
1103 21 6 if (exists $special{$asnName})
1121 0 44 exists $variantNames{$oid} ? :
1122 44 0 if (defined $name)
1125 0 44 exists $variantNames{$oid} ? :
1127 2 42 unless ($self->can($name))
1131 1 1 if wantarray
1149 0 92 unless (defined $parsed or $optional)
1163 3 3 if $format
1178 0 7 unless $self->{'certificationRequestInfo'}{'subject'}{$component}
7 2 if wantarray
1190 1 4 if wantarray
1197 18 1 if not $long and exists $shortnames{$name}
1215 1 4 if (scalar @sequence > 1) { }
1231 0 4 unless (defined $san)
1232 0 0 if wantarray
1236 2 2 unless (defined $type)
1237 1 1 if (wantarray)
1251 1 1 if wantarray
1270 2 2 if $format
1278 1 3 unless $self->{'_apiVersion'} >= 1
1285 0 3 unless defined $at
1287 2 1 if ($at eq 'rsaEncryption') { }
0 1 elsif ($at eq 'ecPublicKey') { }
1 0 elsif ($at eq 'dsa') { }
1295 0 2 ref $rsa->{'publicExponent'} ? :
1300 0 0 if ($@)
1304 0 0 if $self->{'_dieOnError'}
1312 0 0 if $detail
1316 0 0 if $rv->{'curve'}
1322 1 0 if (exists $self->{'certificationRequestInfo'}{'subjectPKInfo'}{'algorithm'}{'parameters'})
1333 0 0 if $self->{'_dieOnError'}
1346 0 1 unless exists $self->{'signatureAlgorithm'}{'parameters'}
1349 0 1 if (ref $self->{'signatureAlgorithm'}{'parameters'} eq "HASH")
1354 0 1 if ($tlen != 0 and $tag != 5)
1367 4 2 if (defined $format and $format == 2)
1368 0 4 if ($self->pkAlgorithm eq "ecPublicKey")
1374 0 2 if $format
1389 0 55 unless defined $attributes
1398 0 22 if ($self->{'_apiVersion'} < 1)
1400 0 0 unless defined $attributes
1408 0 22 unless (defined $attributes)
1409 0 0 if wantarray
1413 5 17 unless (defined $name)
1419 0 17 if ($name eq "extensionRequest")
1420 0 0 if wantarray
1429 1 16 unless (@attrs)
1430 0 1 if wantarray
1437 13 3 unless ref $values eq "ARRAY"
1440 5 11 wantarray ? :
1443 5 11 if wantarray
1445 11 0 if (@values == 1)
1467 23 20 unless ref $hash eq "HASH"
1471 1 19 if defined $exclude
1473 9 11 if @keys != 1
1475 4 7 if ref $$hash{$keys[0]} eq "HASH"
1487 10 89 if (ref $value eq "ARRAY")
1491 9 1 if @strings > 1
1494 25 64 if (ref $value eq "HASH")
1498 15 10 if @strings > 1
1502 10 54 if $value =~ /^\d+$/
1506 8 46 if $self->{'_escapeStrings'}
1508 44 10 if $value =~ m(\A[\w!\@$%^&*_=+\[\]\{\}:;|<>./?"'-]+\z)
1517 0 4 unless defined $attributes and exists $attributes->{'extensionRequest'}
1520 4 0 if ($self->{'_apiVersion'} >= 1)
1522 10 5 if exists $variantNames{"\$" . $ext}
1534 0 23 unless defined $attributes and exists $attributes->{'extensionRequest'}
1538 10 13 if exists $variantNames{$extensionName}
1541 21 55 if ($entry->{'extnID'} eq $extensionName)
1543 1 20 if ($self->{'_apiVersion'} == 0) { }
1549 3 17 if ($entry->{'_FMT'}) { }
1550 2 1 $format ? :
1553 8 9 if $format
1559 10 13 if $format
1569 0 6 unless defined $attributes and exists $attributes->{'extensionRequest'}
1573 4 2 if exists $variantNames{$extensionName}
1576 5 13 if ($entry->{'extnID'} eq $extensionName)
1577 2 3 if $entry->{'critical'}
1591 0 0 unless $self->{'_apiVersion'} >= 1
1600 0 0 if ($alg =~ /sha-?(\d+)/i) { }
0 0 elsif ($alg =~ /md-?(\d)/i) { }
0 0 elsif ($alg eq 'rsassaPss') { }
1620 0 0 unless defined $keyp->{'keytype'}
1624 0 0 if ($keyp->{'keytype'} eq "RSA")
1627 0 0 if $@
1632 0 0 if @params == 3
1637 0 0 if ($keyp->{'keytype'} eq "DSA")
1640 0 0 if $@
1646 0 0 if ($keyp->{'keytype'} eq "ECC")
1648 0 0 if $@
1656 0 0 if ($@)
1659 0 0 if $self->{'_dieOnError'}
1662 0 0 if $ok
1666 0 0 if $self->{'_dieOnError'}
1686 0 12 if length $text <= 65
1700 0 1 unless defined $v and $v == 1
1704 0 1 unless defined $self
1709 0 1 unless defined $v and $v == 1
1711 0 1 unless defined $string
1712 0 1 if $at
1723 3 10 if length $_ > $max
1732 0 1 unless $self->attributes
1740 0 1 unless $self->extensions
1743 1 2 $self->extensionPresent($_) == 2 ? :
1745 0 3 $_ eq 'subjectAltName' ? :
1759 0 4 if (not defined $v || defined($v = $self->error)) { }
0 4 elsif (ref $v) { }
1766 0 1 if (exists $kp->{'detail'})
1770 0 0 if ref $kp->{$_}
1778 0 1 if ($sp)
1782 0 0 if (ref $v)
1783 0 0 if ($v->can('as_hex')) { }