Branch Coverage

blib/lib/Crypt/PKCS11/Easy.pm
Criterion Covered Total %
branch 1 124 0.8


line true false branch
197 2 0 unless $pkcs11->load($self->_module)
201 0 0 unless $pkcs11->Initialize
212 0 0 unless ($self->has_key)
235 0 0 if ($self->has_token)
240 0 0 unless my $slot_ids = $self->_pkcs11->GetSlotList(1)
243 0 0 if (scalar @$slot_ids > 1)
259 0 0 if ($self->rw) { }
267 0 0 unless my $session = $self->_pkcs11->OpenSession($self->slot, $flags)
280 0 0 if ($_ =~ /^(firmware|hardware|library|cryptoki)Version$/u)
286 0 0 if ref $h->{$_}
291 0 0 if length $h->{$_} == 0
301 0 0 unless my $info = $self->_pkcs11->GetInfo
314 0 0 unless my $token = $self->_pkcs11->GetTokenInfo($slot_id)
322 0 0 $token->{'flags'} & $f ? :
334 0 0 unless (defined $arg{'id'} or defined $arg{'token'})
340 0 0 if (defined $arg{'id'}) { }
0 0 elsif ($arg{'token'}) { }
344 0 0 unless $slot = $self->_pkcs11->GetSlotInfo($arg{'id'})
354 0 0 if ($_->{'token'}{'label'} and $arg{'token'} eq $_->{'token'}{'label'})
360 0 0 unless $slot
370 0 0 $slot->{'flags'} & $f ? :
375 0 0 if ($slot->{'flag'}{'token_present'})
385 0 0 if ($self->_has_session) { }
388 0 0 unless $session = $self->_pkcs11->OpenSession($slot_id, 4)
406 0 0 unless my $slot_ids = $self->_pkcs11->GetSlotList($with_token)
436 0 0 unless $pin
441 0 0 unless $self->_session->Login(1, $pin)
455 0 0 unless my $objects = $self->_session->FindObjects(1)
462 0 0 if (scalar @$objects == 0)
516 0 0 unless ($sig_length)
529 0 0 $hash eq 'SHA1' ? :
533 0 0 if ($r != 0)
539 0 0 if ($r != 0)
548 0 0 if ($r != 0)
573 0 0 $hash eq 'SHA1' ? :
577 0 0 if ($r != 0)
586 0 0 if ($r != 0)
599 0 0 unless (exists $args->{'file'} or exists $args->{'data'})
604 0 0 if ($args->{'file'})
608 0 0 if (not ref $file) { }
0 0 elsif (ref $file ne 'Path::Tiny') { }
616 0 0 unless exists $args->{'mech'}
639 0 0 if ($params)
642 0 0 if ($r != 0)
659 0 0 unless ($args{'mech'})
664 0 0 unless $self->_session->SignInit($args{'mech'}, $self->_key)
668 0 0 unless my $sig = $self->_session->Sign($args{'data'})
691 0 0 unless $args{'sig'}
694 0 0 unless ($args{'mech'})
699 0 0 unless $self->_session->VerifyInit($args{'mech'}, $self->_key)
704 0 0 unless $v
715 0 0 unless ($args{'mech'})
721 0 0 unless $self->_session->DigestInit($args{'mech'})
724 0 0 unless $d
742 0 0 unless $1
753 0 0 unless my $mech_info = $self->_pkcs11->GetMechanismInfo($slot_id, $_)
758 0 0 $mech_info->{'flags'} & $f ? :
776 0 0 unless my $mech_list = $self->_pkcs11->GetMechanismList($slot_id)
780 0 0 $Crypt::PKCS11::Easy::CKM_NAME{$_} ? :
792 0 0 unless ($args{'mech'})
800 0 0 unless $self->_session->EncryptInit($args{'mech'}, $self->_key)
804 0 0 unless my $encrypted_data = $self->_session->Encrypt($args{'data'})