File Coverage

blib/lib/Crypt/OpenPGP/Key/Secret/DSA.pm
Criterion Covered Total %
statement 32 32 100.0
branch n/a
condition 2 3 66.6
subroutine 12 12 100.0
pod 0 5 0.0
total 46 52 88.4


line stmt bran cond sub pod time code
1             package Crypt::OpenPGP::Key::Secret::DSA;
2 5     5   38 use strict;
  5         338  
  5         317  
3 5     5   26 use warnings;
  5         10  
  5         494  
4              
5             our $VERSION = '1.19'; # VERSION
6              
7 5     5   1816 use Crypt::DSA::Key;
  5         24868  
  5         190  
8 5     5   2010 use Crypt::OpenPGP::Key::Public::DSA;
  5         19  
  5         187  
9 5     5   29 use Crypt::OpenPGP::Key::Secret;
  5         10  
  5         125  
10 5     5   19 use Crypt::OpenPGP::ErrorHandler;
  5         10  
  5         141  
11 5     5   20 use base qw( Crypt::OpenPGP::Key::Secret Crypt::OpenPGP::ErrorHandler );
  5         11  
  5         2486  
12              
13 21     21 0 94 sub secret_props { qw( x ) }
14             *sig_props = \&Crypt::OpenPGP::Key::Public::DSA::sig_props;
15             *public_props = \&Crypt::OpenPGP::Key::Public::DSA::public_props;
16             *size = \&Crypt::OpenPGP::Key::Public::DSA::size;
17             *keygen = \&Crypt::OpenPGP::Key::Public::DSA::keygen;
18             *can_sign = \&Crypt::OpenPGP::Key::Public::DSA::can_sign;
19              
20             sub init {
21 16     16 0 37 my $key = shift;
22 16   66     193 $key->{key_data} = shift || Crypt::DSA::Key->new;
23 16         365 $key;
24             }
25              
26 17     17 0 2558 sub y { $_[0]->{key_data}->pub_key(@_[1..$#_]) }
27 5     5 0 463 sub x { $_[0]->{key_data}->priv_key(@_[1..$#_]) }
28              
29             sub sign {
30 7     7 0 15 my $key = shift;
31 7         19 my($dgst) = @_;
32 7         31 require Crypt::DSA;
33 7         222 my $dsa = Crypt::DSA->new;
34             my $sig = $dsa->sign(
35             Key => $key->{key_data},
36 7         227 Digest => $dgst,
37             );
38             }
39              
40             *verify = \&Crypt::OpenPGP::Key::Public::DSA::verify;
41              
42             1;